0
votes

Catalog Product listing page's template file is list.phtml. Where the rendering of all the products in category happens using foreach loop.

I am confused about the rendering of the price.phtml. Because there is no block for it in handle

Now, <?php echo $this->getPriceHtml($_product, true) ?> returns price of the product.

How this method is linked to price.phtml ?
Please shed some light. Thanks

1

1 Answers

0
votes

The Block class that is used with list.phtml is Mage_Catalog_Block_Product_List, so the method getPriceHtml is located either in this class or in some of this class'es parents. In this case, method happened to be in Mage_Catalog_Block_Product_Abstract, direct parent of our block class:

public function getPriceHtml($product, $displayMinimalPrice = false, $idSuffix = '')
{
    $type_id = $product->getTypeId();
    if (Mage::helper('catalog')->canApplyMsrp($product)) {
        $realPriceHtml = $this->_preparePriceRenderer($type_id)
            ->setProduct($product)
            ->setDisplayMinimalPrice($displayMinimalPrice)
            ->setIdSuffix($idSuffix)
            ->toHtml();
        $product->setAddToCartUrl($this->getAddToCartUrl($product));
        $product->setRealPriceHtml($realPriceHtml);
        $type_id = $this->_mapRenderer;
    }

    return $this->_preparePriceRenderer($type_id)
        ->setProduct($product)
        ->setDisplayMinimalPrice($displayMinimalPrice)
        ->setIdSuffix($idSuffix)
        ->toHtml();
}