I added custom tab in product page and then showed necessary information in custom file with name: customtabinfo.phtml, now i need display attrubutes, but when i try get attribute: <?php echo $_product->getAttributeText('custom_attribute'); ?> - i see error: Fatal error: Call to a member function getAttributeText() on a non-object.

How i can display my attribute? Thanks


or can try:


$product_id = Mage::registry('current_product')->getId();
$attribute = $_product->getResource()->getAttribute('latitude');
if ($attribute)
    echo $attribute_value = $attribute ->getFrontend()->getValue($_product);

it's also working =)

| improve this answer | |

Try with this:

| improve this answer | |

Normally in your custom block for your phtml you should do

public function getProduct(){
       $this->product = Mage::registry('current_order');
    return $this->product;

Then in your phtml

echo $this->getProduct()->getAttributeText('custom_attribute')
| improve this answer | |

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.