@@ -81,6 +81,7 @@ protected function _getResource()
8181 /**
8282 * Get price range for building filter steps
8383 *
84+ * @throws Mage_Core_Model_Store_Exception
8485 * @return int
8586 */
8687 public function getPriceRange ()
@@ -100,7 +101,7 @@ public function getPriceRange()
100101 if ($ calculation == self ::RANGE_CALCULATION_AUTO ) {
101102 $ index = 1 ;
102103 do {
103- $ range = 10 ** (strlen (floor ($ maxPrice )) - $ index );
104+ $ range = 10 ** (strlen (( string ) floor ($ maxPrice )) - $ index );
104105 $ items = $ this ->getRangeItemCounts ($ range );
105106 $ index ++;
106107 } while ($ range > self ::MIN_RANGE_POWER && count ($ items ) < 2 );
@@ -136,6 +137,7 @@ public function getMaxPriceInt()
136137 * Get information about products count in range
137138 *
138139 * @param int $range
140+ * @throws Mage_Core_Model_Store_Exception
139141 * @return array
140142 */
141143 public function getRangeItemCounts ($ range )
@@ -145,17 +147,17 @@ public function getRangeItemCounts($range)
145147 if (is_null ($ items )) {
146148 $ items = $ this ->_getResource ()->getCount ($ this , $ range );
147149 // checking max number of intervals
148- $ i = 0 ;
150+ $ index = 0 ;
149151 $ lastIndex = null ;
150152 $ maxIntervalsNumber = $ this ->getMaxIntervalsNumber ();
151153 $ calculation = Mage::app ()->getStore ()->getConfig (self ::XML_PATH_RANGE_CALCULATION );
152- foreach ($ items as $ k => $ v ) {
153- ++$ i ;
154- if ($ calculation == self ::RANGE_CALCULATION_MANUAL && $ i > 1 && $ i > $ maxIntervalsNumber ) {
155- $ items [$ lastIndex ] += $ v ;
156- unset($ items [$ k ]);
154+ foreach ($ items as $ key => $ value ) {
155+ ++$ index ;
156+ if ($ calculation == self ::RANGE_CALCULATION_MANUAL && $ index > 1 && $ index > $ maxIntervalsNumber ) {
157+ $ items [$ lastIndex ] += $ value ;
158+ unset($ items [$ key ]);
157159 } else {
158- $ lastIndex = $ k ;
160+ $ lastIndex = $ key ;
159161 }
160162 }
161163
@@ -168,10 +170,11 @@ public function getRangeItemCounts($range)
168170 /**
169171 * Prepare text of item label
170172 *
171- * @deprecated since 1.7.0.0
172173 * @param int $range
173174 * @param float $value
175+ * @throws Mage_Core_Model_Store_Exception
174176 * @return string
177+ * @deprecated since 1.7.0.0
175178 */
176179 protected function _renderItemLabel ($ range , $ value )
177180 {
@@ -187,6 +190,7 @@ protected function _renderItemLabel($range, $value)
187190 *
188191 * @param float|string $fromPrice
189192 * @param float|string $toPrice
193+ * @throws Mage_Core_Model_Store_Exception
190194 * @return string
191195 */
192196 protected function _renderRangeLabel ($ fromPrice , $ toPrice )
@@ -208,8 +212,10 @@ protected function _renderRangeLabel($fromPrice, $toPrice)
208212
209213 /**
210214 * Get price aggreagation data cache key
211- * @deprecated after 1.4
215+ *
216+ * @throws Mage_Core_Model_Store_Exception
212217 * @return string
218+ * @deprecated after 1.4
213219 */
214220 protected function _getCacheKey ()
215221 {
@@ -247,6 +253,7 @@ protected function _getAdditionalRequestData()
247253 /**
248254 * Get data generated by algorithm for build price filter items
249255 *
256+ * @throws Mage_Core_Model_Store_Exception
250257 * @return array
251258 */
252259 protected function _getCalculatedItemsData ()
@@ -292,6 +299,7 @@ protected function _getCalculatedItemsData()
292299 /**
293300 * Get data for build price filter items
294301 *
302+ * @throws Mage_Core_Model_Store_Exception
295303 * @return array
296304 */
297305 protected function _getItemsData ()
@@ -349,8 +357,8 @@ protected function _validateFilter($filter)
349357 return false ;
350358 }
351359
352- foreach ($ filter as $ v ) {
353- if (($ v !== '' && $ v !== '0 ' && (float ) $ v <= 0 ) || is_infinite ((float ) $ v )) {
360+ foreach ($ filter as $ value ) {
361+ if (($ value !== '' && $ value !== '0 ' && (float ) $ value <= 0 ) || is_infinite ((float ) $ value )) {
354362 return false ;
355363 }
356364 }
@@ -362,6 +370,7 @@ protected function _validateFilter($filter)
362370 * Apply price range filter
363371 *
364372 * @param Varien_Object $filterBlock deprecated
373+ * @throws Mage_Core_Model_Store_Exception
365374 * @return $this
366375 */
367376 public function apply (Zend_Controller_Request_Abstract $ request , $ filterBlock )
@@ -387,8 +396,8 @@ public function apply(Zend_Controller_Request_Abstract $request, $filterBlock)
387396
388397 $ priorFilters = [];
389398 $ counter = count ($ filterParams );
390- for ($ i = 1 ; $ i < $ counter ; ++$ i ) {
391- $ priorFilter = $ this ->_validateFilter ($ filterParams [$ i ]);
399+ for ($ index = 1 ; $ index < $ counter ; ++$ index ) {
400+ $ priorFilter = $ this ->_validateFilter ($ filterParams [$ index ]);
392401 if ($ priorFilter ) {
393402 $ priorFilters [] = $ priorFilter ;
394403 } else {
@@ -454,6 +463,7 @@ public function setCustomerGroupId($customerGroupId)
454463 /**
455464 * Retrieve active currency rate for filter
456465 *
466+ * @throws Mage_Core_Model_Store_Exception
457467 * @return float
458468 */
459469 public function getCurrencyRate ()
@@ -484,6 +494,7 @@ public function setCurrencyRate($rate)
484494 /**
485495 * Get maximum number of intervals
486496 *
497+ * @throws Mage_Core_Model_Store_Exception
487498 * @return int
488499 */
489500 public function getMaxIntervalsNumber ()
@@ -494,6 +505,7 @@ public function getMaxIntervalsNumber()
494505 /**
495506 * Get interval division limit
496507 *
508+ * @throws Mage_Core_Model_Store_Exception
497509 * @return int
498510 */
499511 public function getIntervalDivisionLimit ()
@@ -524,6 +536,7 @@ public function getResetValue()
524536 /**
525537 * Get 'clear price' link text
526538 *
539+ * @throws Mage_Core_Model_Store_Exception
527540 * @return false|string
528541 */
529542 public function getClearLinkText ()
0 commit comments