閱讀796 返回首頁    go 阿裏雲 go 技術社區[雲棲]


magento -- 根據屬性名獲得產品的屬性值

$productId = 10; $attributeName = 'my_attribute_name'; $product = Mage::getModel('catalog/product')->load($productId); $attributes = $product->getAttributes(); $attributeValue = null; if(array_key_exists($attributeName , $attributes)){ $attributesobj = $attributes["{$attributeName}"]; $attributeValue = $attributesobj->getFrontend()->getValue($product); } echo $attributeValue; //attribute value for 'my_attribute_name' 

 

原文:https://magentocookbook.wordpress.com/2010/03/05/get-product-attribute-value-by-attribute-name/

最後更新:2017-04-02 04:26:02

  上一篇:go magento -- 推薦插件 -- Shop by manufacturer/brand/character/etc
  下一篇:go C# 下獲取數據庫表的行列名