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:
\public_html\app\design\frontend\base\default\template\catalog\product\
\public_html\app\design\frontend\base\default\template\catalog\product\
$enquiry_only = Mage::getModel('catalog/product')
->load($_product->getId())
->getAttributeText('enquiry_only');
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'];
}
0 comments:
Post a Comment
Thanks for commenting. I will Reply you soon