I've created a media attribute, and now i'm triyng to display this attribute to my product view page.
I've tried this code below:
$hdr_img = $cur_product->getResource()->getAttribute('header_img');
if ($hdr_img)
{
$ban_img = $this->helper('catalog/image')->init($cur_product, 'header_img')->resize(1600, 312);
echo $ban_img;
}
But all I got is a :
Fatal error: Uncaught Error: Call to a member function getResource() on unknown in /var/www/virtual/unikamakeup.com/htdocs/app/design/frontend/sns_simo/default/template/catalog/product/view.phtml:132 Stack trace: #0 /var/www/virtual/unikamakeup.com/htdocs/app/code/core/Mage/Core/Block/Template.php(241): include() #1 /var/www/virtual/unikamakeup.com/htdocs/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/sns_si...') #2 /var/www/virtual/unikamakeup.com/htdocs/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView() #3 /var/www/virtual/unikamakeup.com/htdocs/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Template->_toHtml() #4 /var/www/virtual/unikamakeup.com/htdocs/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml() #5 /var/www/virtual/unikamakeup.com/htdocs/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Text_List->_toHtml() #6 /var/www/virtual/unikamakeup.com/htdocs/app/code/core/ in /var/www/virtual/unikamakeup.com/htdocs/app/design/frontend/sns_simo/default/template/catalog/product/view.phtml on line 132