2013-04-01 176 views

回答

0

嘗試了這一點

$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

+0

沒有這不起作用 – sonam

+0

你在收集的故事嗎? – Mufaddal

相關問題