/** * For 1.3 ONLY. I LOVE 1.3 :) */ public function getRangeItemCounts($range) { if (!Mage::helper('amshopby')->isVersionLessThan(1, 4)) { return parent::getRangeItemCounts($range); } $items = $this->getData('range_item_counts_' . $range); if (is_null($items)) { // logic is the same, but we need to pass different params. $items = $this->_getResource()->getCount($this->getAttributeModel(), $range, $this->_getBaseCollectionSql()); $this->setData('range_item_counts_' . $range, $items); } return $items; }
/** * @dataProvider getRangeItemCountsDataProvider */ public function testGetRangeItemCounts($inputRange, $expectedItemCounts) { $this->assertEquals($expectedItemCounts, $this->_model->getRangeItemCounts($inputRange)); }
/** * For 1.3 ONLY. I LOVE 1.3 :) */ public function getRangeItemCounts($range) { //slider if (3 == Mage::getStoreConfig('amshopby/general/price_type')) { return array(0 => 1, 1 => 2); } if (!Mage::helper('amshopby')->isVersionLessThan(1, 4)) { return parent::getRangeItemCounts($range); } $items = $this->getData('range_item_counts_' . $range); if (is_null($items)) { $items = $this->_getResource()->getCount($this->getAttributeModel(), $range, $this->_getBaseCollectionSql()); $this->setData('range_item_counts_' . $range, $items); } return $items; }