1

I want to show some product custom attribute in product view page at TAB like following image.

enter image description here

So far I've tried following

<?php $_product = $this->getProduct(); ?>

But it return with NULL

Then I tried following

<?php $_product = Mage::registry('current_product'); ?>

But after using above the page goes blank and nothing will appear.

I'm making changes in following path

/public_html/app/code/core/Mage/Catalog/Block/Product/View/Tabs.php

In core file just for testing purpose. Once It will work I'll override it.

  • if you want to display attributes there you can do that in description.phtml. – Shrikant Oct 7 '16 at 13:22
0

Well I've sorted this by doing following

I've override the Tabs.php

app/code/local/Mage/Catalog/Block/Product/View/Tabs.php

In above file I've placed following code in starting

protected $_product = null;

function getProduct()
{
    if (!$this->_product) {
        $this->_product = Mage::registry('product');
    }
    return $this->_product;
}

then in app/design/frontend/mytheme/default/template/catalog/product/viewtabs.phtml

I've used it like following

<?php 
    $_product = $this->getProduct();
    $attribute = $_product->getData("attributecode");
?>
0

Try this code in this template file (of course you should copy it to your child theme): app/design/frontend/base/default/template/catalog/product/view/description.phtml

<?php 
$_product = Mage::registry('current_product');
$att = $_product->getResource()->getAttribute('your_attribute_id');
echo $att->getFrontend()->getValue($_product);
?>
  • Thanks for the answer @zitix but as I've told my question is $_product = Mage::registry('current_product'); not working for me it gives me a blank page. I've found the answer by myself check my answer. – Kaushal Suthar Oct 7 '16 at 13:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.