I need to extend getPriceHtml method of Mage_Catalog_Block_Products class.
Why?
I need to change template for price only for my custom extension of RSS (Aph_Rss > works fine!). This extension use getPriceHtlmRss($product,true)
new method, now I want extend getPriceHtml > getPriceHtmlRss
to add inline css into price-last / special-price tag for email-marketing automation in specific template > priceRss.phtml
I've created Aph/Catalog/etc -> config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<config>
<global>
<blocks>
<catalog>
<rewrite>
<product>Aph_Catalog_Block_Product</product>
</rewrite>
</catalog>
</blocks>
</global>
</config>
Then created Aph/Catalog/Block/Product.php
<?php
include('Mage/Catalog/Block/Product.php');
class Aph_Catalog_Block_Product extends Mage_Catalog_Block_Product
{
protected $_finalPrice = array();
public function getPriceHtmlRss($product)
{
$this->setTemplate('catalog/product/priceRss.phtml');
$this->setProduct($product);
return $this->toHtml();
}
}
Then created: app/design/frontend/default/mytheme/template/catalog/product/priceRss.phtml
Last step:
Created file app/etc/modules/Aph_Catalog.xml
<?xml version="1.0"?>
<config>
<modules>
<Aph_Catalog>
<active>true</active>
<codePool>local</codePool>
</Aph_Catalog>
</modules>
</config>
Visiting http://www.mydomain.tld/rss/catalog/category/cid/193/store_id/2/
-> no price shown. priceRss.phtml
not loaded. Why?