I've a problem, I want to show the label of a custom attribute in the product page. I explain me better, starting from this link because is what I want to do: http://www.customy.com/blog/how-to-display-video-on-magento-product-page/
I want a video product in the sidebar of the product page, so I create a new custompage.phtml and i put this in the sidebar from catalog.xml, in my custompage.phtml I put this code to have the custom label:
getResource()->getAttribute('video')->getStoreLabel();?>but I have this error:
"Fatal error: Call to a member function getResource() on a non-object in ..path//"
I have try different code but still have this problem. I think that I forget to put something in my .phtml but I'm new of Magento and I don't know what!
Thank in advance!
Since $_product didn't work then you'll need to load the object before attempting to access the attribute. Try this:
$product_id = Mage::registry('current_product')->getId();
$_product=Mage::getModel('catalog/product')->load($product_id);
echo $_product->getResource()->getAttribute('video')->getStoreLabel();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With