Sanjoy Roy

[MCM, MCP, SCJP] – Senior PHP Programmer

Magento – How to get a product attribute value?

I have created an extra attribute ‘enquiry_only’ in the back-end, this is how I can retrieve the attribute value in the product info template page:

$enquiry_only = Mage::getModel('catalog/product')

Alternatively we can use like:

$prod = Mage::getModel('catalog/product')->load($_product->getEntityId());
					$prod = $prod->getData(); 								
					$enquiry_only = 'No';		
					$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'enquiry_only');
					foreach ( $attribute->getSource()->getAllOptions(true, true) as $option){
						if ($option['value'] == $prod['enquiry_only'])
							$enquiry_only = $option['label'];


Comments are closed.

%d bloggers like this: