我想在Magento产品页面中显示产品选项值

我想在Magento产品页面中显示产品选项值,magento,Magento,我想在Magento产品页面中显示产品选项值。我尝试了以下代码: <?php echo $_product->getAttributeText('color'); ?> 但是选项没有显示。如果您在“实际产品视图”页面上,您可以使用帮助器获取所需内容: echo $_helper->productAttribute($_product, $_product->getColor(), 'color'); 或 或者,您可以尝试以下方法: $_product-&g

我想在Magento产品页面中显示产品选项值。我尝试了以下代码:

<?php echo $_product->getAttributeText('color'); ?> 


但是选项没有显示。

如果您在“实际产品视图”页面上,您可以使用帮助器获取所需内容:

echo $_helper->productAttribute($_product, $_product->getColor(), 'color');

或者,您可以尝试以下方法:

$_product->getResource()->getAttribute('color')->getFrontend()->getValue($_product);

如果您位于“实际产品视图”页面,则可以使用帮助器获取所需内容:

echo $_helper->productAttribute($_product, $_product->getColor(), 'color');

或者,您可以尝试以下方法:

$_product->getResource()->getAttribute('color')->getFrontend()->getValue($_product);
你可以把这个

<?php $attributeValue = Mage::getModel('catalog/product')->load($_product->getId())->getColor();?>

你可以选择这个

<?php $attributeValue = Mage::getModel('catalog/product')->load($_product->getId())->getColor();?>

多一点上下文(您在哪里使用此代码段,可能的错误消息)将有助于我们帮助您;-)多一点上下文(您在哪里使用此代码段,可能的错误消息)将有助于我们帮助您;-)