我无法弄清楚这一点!得到一个magento中的所有产品属性的数组
我想获取产品属性列表到list.phtml页面的数组中。我已经尝试了一切。我看到很多使用的解决方案
$attributes = $product->getAttributes();
但我不能得到这个工作,它只是提出了一个空白页。任何帮助将不胜感激,我已经花了几个小时在这个迄今为止...
我使用的Magento版本1.4.2.0
更新:这正是我想要做的事:
$neededAttributes = Mage::helper('mymodule')->getNeededAttributes();
$attributes = $product->getAttributes();
foreach ($attributes as $attribute) {
if(in_array($attribute->getAttributeCode(), $neededAttributes)) {
$attributename = $attribute->getAttributeCode();
echo $attributename;
}
}
这是在设计文件gallery.phtml/adminhtml /默认/缺省/目录/产品/帮手/
出于某种原因,我不能让getAttributeCode函数返回任何东西。
您是否试过先获取产品收藏? – kjy112 2011-02-10 19:21:15
你有没有像XDebug一样使用调试器进行逐步调试? – greg0ire 2011-02-10 19:54:33
您是在询问特定产品的属性值,还是所有可能的属性代码列表? – 2011-02-10 22:36:03