在结帐页面中显示产品属性在 magento 中不起作用

Display product attribute in checkout page not working in magento

我添加了属性形状。

attribute code -> shape
attribute label -> Shape
values -> diamond, square, round
input type -> multi select

现在我想在结帐页面中显示属性形状详细信息。我在 app\design\frontend\mytheme\mytheme\template\checkout\cart\item\default.phtml

中尝试了以下代码

我的代码如下:

echo $_item->getShape();

很遗憾,没有显示任何内容。我怎样才能做到这一点。任何帮助将不胜感激!!

问题是您试图从模型 Mage_Sales_Model_Quote_Item 中获取形状。不幸的是,它不是这样工作的。

请尝试这个解决方案:

$product = Mage::getSingleton('catalog/product')->load($_item->getProduct()->getId());
echo $product->getShape();