Layered navigation: intval on price filter
-
22-10-2019 - |
문제
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..?
해결책
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
}
제휴하지 않습니다 magento.stackexchange