Question

I can see $prices = array_map('floatval', $prices); in Mage_Catalog_Model_Layer_Filter_Price.

I was wondering if I could intval without creating my own block, etc..?

Was it helpful?

Solution

There is no event dispatched in the methods that use floatval (loadPrices, loadPreviousPrices, loadNextPrices) so you have to create your own model that rewrites these methods. All you need is a single model (so no blocks)

class [Namespace]_[Module]_Model_Catalog_Layer_Filter_Price 
    extends Mage_Catalog_Model_Layer_Filter_Price {
    public function loadPrices($limit, $offset = null, $lowerPrice = null, $upperPrice = null) {
        $prices = parent::loadPrices($limit, $offset, $lowerPrice, $upperPrice);
        if ($prices) {
            $prices = array_map('intval', $prices);
        }
        return $prices;
    } 
    //do the same for loadPreviousPrices and loadNextPrices
}
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top