Пример #1
0
 /**
  * Retrieves max price.
  *
  * @return float
  */
 public function getMaxPrice()
 {
     $Params = $this->getLayer()->getProductCollection()->getExtendedSearchParams();
     $uniquePart = strtoupper(md5(serialize($Params)));
     $cacheKey = 'MAXPRICE_' . $this->getLayer()->getStateKey() . '_' . $uniquePart;
     $cachedData = Mage::app()->loadCache($cacheKey);
     if (!$cachedData) {
         $stats = $this->getLayer()->getProductCollection()->getStats($this->_getFilteredField());
         $max = $stats[$this->_getFilteredField()]['max'];
         if (!is_numeric($max)) {
             $max = parent::getMaxPrice();
         }
         $cachedData = (double) $max;
         $tags = $this->getLayer()->getStateTags();
         $tags[] = self::CACHE_TAG;
         Mage::app()->saveCache($cachedData, $cacheKey, $tags);
     }
     return $cachedData;
 }