我尝试了很多stuf,但没有一个工作.我想我可以在产品页面上获得自定义属性,但我想知道如何将它们放在购物车页面中? (属性只是一个简单的书面文字)
谢谢.
$_item-> getProduct() – > load()将重新加载数据库中的所有产品数据.虽然这将工作,但请记住,每次调用load()Magento将执行数据库查询.
通过将属性与引用项一起加载,可以实现更好的性能.只需创建一个自定义模块并将其添加到config.xml中
<global>
<sales>
<quote>
<item>
<product_attributes>
<one_custom_attribute_code />
<another_custom_attribute_code />
</product_attributes>
</item>
</quote>
</sales>
</global>
完成后,您可以访问自定义属性,而不需要额外的数据库查询.
$_item->getProduct()->getAnotherCustomAttributeCode();
这里有一篇关于这个的文章:https://www.atwix.com/magento/accessing-custom-attribute-at-checkout-or-cart/