Magento Get product Attribute Value
Magento Get product Attribute Value : If you are working with magento you often need to work with products and their attributes. Magento provides flexibility to add product attributes dynamically. Here we are going to explain how to get product attribute value. Syntax and example is given below –
Magento Get product Attribute Value Syntax
Here is syntax to get product value syntax-
Magento Get product Attribute Value
$productId = 55; $storeId = 1; $product = Mage::getModel('catalog/product')->setStoreId($storeId)->load($productId); $attrText = $product->getAttributeText('your_attribute'); |
If you want to use option id Here is another example of the set attribute and get value.
Magento Set product Attribute Value And Get Attribute Value
Here is syntax to set and get attribute value in magento product-
Magento Set product Attribute Value And Get Attribute Value
$attributeOptionId = Mage::getResourceModel('catalog/product')->getAttributeRawValue($productId, 'your_attribute', $storeId); $product = Mage::getModel('catalog/product') ->setStoreId($storeId) ->setData('your_attribute', $attributeOptionId); $attrText = $product->getAttributeText('your_attribute'); |
Advertisements