$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'
原文:http://magentocookbook.wordpress.com/2010/03/05/get-product-attribute-value-by-attribute-name/
时间: 2024-09-30 10:53:34