阅读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# 下获取数据库表的行列名