If you’re pulling in products in custom templates and wanting to display information like the price you’ll run into the issue of how intimidating the price.phtml file for prices is, simply extracting one of the prices from the product would not be suitable due to the variations in tax rules and sale prices. Also sometimes using the product list or view templates isn’t suited to yours need.

In this case you can do a dirty hack and directly call the function from the block.

This will directly load in the block and call the function. $_product is your catalog/product model.

If you’re making multiple calls to the block within a foreach/while loop you can initiate the Mage_Catalog_Block_Product block outside of the loop and then make multiple calls to the getPriceHtml function.

This function is very simple and looks like the following:

As the price.phtml function accesses functions within the block we cannot simply render the template in our template. You could however add a new block into your layout xml with the correct block type and make numerous files and achieve the same effect.

Dave Macaulay
Dave Macaulay
I'm an enthusiastic, slightly eccentric Magento developer who bores with the idea of another basic brief.
  • martinsjastad

    Dude I like the design of this site and your writing is no-nonsense focused content! Props. Thanks

    • daavem

      Thanks buddy! What’s the point in complicating simple stuff to sound clever eh?