Question

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?

Was it helpful?

Solution

hkinterview,

custom phtml block class should need to extends Mage_Catalog_Block_Product_Abstract

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

example

class YoumoduleNamespace_yourModuleName_Block_yourclass extends Mage_Catalog_Block_Product_Abstract  

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top