Magento Themes and Magento Extensions

How to fix Fatal error: Call to a member function getStoreLabel() in price.phtml

Share

Play with Magento 1.8 CE and some one may get this fatal error:

1
Fatal error: Call to a member function getStoreLabel() on a non-object in /app/design/frontend/.../.../template/catalog/product/price.phtml

This is not happen with Magento 1.7 CE! We are not sure if it is Magento’s bug but a “quick and dirty” fix may help you.

Solution

Step 1:

Open file /app/design/frontend/<PACKAGE>/<THEME>/template/catalog/product/price.phtml to edit.

If it is not there, just copy /app/design/frontend/base/default/template/catalog/product/price.phtmlto

/app/design/frontend/<PACKAGE>/<THEME>/template/catalog/product/

Step 2: Find this code:

1
$_specialPriceStoreLabel = $this->getProductAttribute('special_price')->getStoreLabel();

And change it to:

1
2
3
//$_specialPriceStoreLabel = $this->getProductAttribute('special_price')->getStoreLabel();
$_specialPriceStoreLabel = '';
if ($this->getProductAttribute('special_price')) $_specialPriceStoreLabel = $this->getProductAttribute('special_price')->getStoreLabel();

Save the file, clear Magento cache and try it!

Comments are closed.