Magento CE 1.7.0.2 – Display Current Product Attribute in Callout PHTML File

attributescatalogce-1.7.0.2modelregistry

There is a callout phtml file called in my right sidebar (let's call it attribute.phtml), on the product page.

I'm trying to show the attribute value in that callout.

The attribute is a drop down, so it should be

<?php echo $_product->getAttributeText('attributecode'); ?>

But I am missing something before that, I'm wondering how can I load it for the current product ? Note: this is not inside list or view , it's in template/callouts . I'm stuck, any help would be really appreciated right now…

Best Answer

The product should be available from the registry:

$_product = Mage::registry('current_product');

You should then be able to pull any required attributes straight out of it:

echo $_product->getAttributeText('attributecode');
Related Topic