I am sure that you all must have faced the difficulty to display the price including tax, special price etc. in a way how Magento works while developing a custom module or an extension.
Magento uses blocks terminology in its architecture to display the views. Blocks are classes in Magento modules which handles the content output and communicate directly with phtml templates. Data and information is passed to the template through Block methods, implemented in the block class.
$this->getPriceHtml () Method is used in the templates to display the product price in html format. This method returns the rendered html with currency symbol and defined number format. It also displays the products special price and minimum price.
However this is a very useful method for custom created templates or content blocks where we need to display the formatted price but still this function cannot be used directly with the $product object.
By default we can use getPrice() function to display the price of the product though it does not allow to include additional features such as tax and special prices. For including that, we need to implement the following code.
To use this function on any custom template page or even in a controller, use the following code:
//this is an example code and can be used in any .phtml file or controller class
$product_block = new Mage_Catalog_Block_Product;
//$product is product object
//if inside a loop than unset the instance.
I hope it will be helpful to you.