在签出页面中显示产品属性在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中获取Shape。不幸的是,它不是这样工作的。

请尝试此解决方案:

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