Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

In tabs.phtml $this->getProduct(); doesnt return object
 
janose
Jr. Member
 
Total Posts:  2
Joined:  2010-05-07
 

Hello,

i have a really weird problem in magento 1.6. I’m trying to fix the tabs on the product description page.
I have the following error:

Fatal error: Call to a member function getData() on a non-object in ... tabs.phtml

What i tried so far.

Product displays in the view.phtml template file. View.phtml calls $this->getChildHtml(’info_tabs’).
Now…

In view.phtml $this->getProduct(); returns an object with details regarding the selected product BUT
in tabs.phtml $this->getProduct(); does not. That is why i get the Fatal error.

When i replace
$_product = Mage::getModel(’catalog/product’)->load($_myproduct->getData(’entity_id’));
with
$_product = Mage::getModel(’catalog/product’)->load(117);
it works, but of course it needs to get the id of the selected product.

Anybody faced this issue?
Btw products were imported and not manually added, but it shouldn’t make a difference since in view.phtml i gets the product object.

Cheers

 
Magento Community Magento Community
Magento Community
Magento Community
 
nguyentrongtiep
Jr. Member
 
Total Posts:  6
Joined:  2012-05-02
 

<?php
$_product = Mage::registry('product');
$productId = $_product->getId();
?>

It’s work for me. Hope helpful for you.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top