I have a custom module with custom phtml which will print the product. But it seems that, the below code

$this->getPriceHtml($_product, true);

won't render any thing on that page. So I tried to change my code to

$product_block = new Mage_Catalog_Block_Product;
echo $product_block->getPriceHtml($_product, true);

But it generated an error message like this.

Call to a member function getStoreLabel() on a non-object in lines XX

How can i fix this problem?

  • how did you configured your custom phtml file. Show the relevant layout update codes Sep 10 '14 at 14:40


custom phtml block class should need to extends Mage_Catalog_Block_Product_Abstract

then  `$this->getPriceHtml($_product, true);` will be workss 


class YoumoduleNamespace_yourModuleName_Block_yourclass extends Mage_Catalog_Block_Product_Abstract  

You may use this solution http://davemacaulay.com/call-this-getpricehtml-custom-magento-template/ if you cannot/don't want to extend some classes.

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.