0
我想通過屬性id在magento中顯示屬性與html ...要注意的是,我不必在產品頁面上顯示它,但在自定義模塊的PHTML .....請幫我,我已經花了近8小時,這對我來說很重要顯示屬性的屬性id不在magento的產品頁面
我想通過屬性id在magento中顯示屬性與html ...要注意的是,我不必在產品頁面上顯示它,但在自定義模塊的PHTML .....請幫我,我已經花了近8小時,這對我來說很重要顯示屬性的屬性id不在magento的產品頁面
嘗試了這一點
$attributes = Mage::getSingleton('eav/config')
->getEntityType(Mage_Catalog_Model_Product::ENTITY)
->getAttributeCollection()
->addSetInfo();
foreach ($attributes as $attribute)
{
if ($attribute->usesSource())
{
echo "{$attribute->getFrontendLabel()}:\n";
foreach ($attribute->getSource()->getAllOptions() as $option)
{
echo " {$option['label']}\n";
}
echo "\n";
}
}
或者試試下面的代碼
$attributeModel = Mage::getSingleton('eav/config')
->getAttribute('catalog_product', $attributeCode);
其中$attributecode
是屬性代碼,例如顏色,製造。
如需進一步信息可以參考這個Link
沒有這不起作用 – sonam
你在收集的故事嗎? – Mufaddal