Exemplo n.º 1
0
 public function getCacheKey()
 {
     if (!$this->_isCacheActive()) {
         parent::getCacheKey();
     }
     $this->_category = Mage::getSingleton('catalog/layer')->getCurrentCategory();
     $total = $this->_getProductCollection()->getSize();
     Mage::getSingleton('core/session')->setSizeValue('');
     $toolbar = new Mage_Catalog_Block_Product_List_Toolbar();
     $cacheKey = 'ProductList_' . $this->_category->getId() . '_' . $toolbar->getCurrentOrder() . '_' . $toolbar->getCurrentDirection() . '_' . $toolbar->getCurrentMode() . '_' . $toolbar->getCurrentPage() . '_' . $toolbar->getLimit() . '_' . $total . '_' . Mage::App()->getStore()->getCode();
     foreach (Mage::app()->getRequest()->getParams() as $key => $value) {
         if (is_array($value)) {
             $value = implode('_', $value);
         }
         $realValue = '';
         $valueArray = array();
         $valueArray = explode('_', $value);
         asort($valueArray);
         $value = implode('_', $valueArray);
         if (is_array($value)) {
             foreach ($value as $k => $v) {
                 $realValue .= '_' . $v;
             }
         } else {
             $realValue = $value;
         }
         if (!in_array(strtolower($key), array('utm_source', 'utm_content', 'utm_campaign', 'utm_medium', 'utm_term', 'gclid'))) {
             $cacheKey .= "_" . $key . '-' . $realValue;
         }
     }
     return $cacheKey;
 }
Exemplo n.º 2
0
 public function getCacheKey()
 {
     if (!$this->_isCacheActive()) {
         parent::getCacheKey();
     }
     $_taxRateRequest = Mage::getModel('tax/calculation')->getRateRequest();
     $_customer = Mage::getSingleton('customer/session')->getCustomer();
     $this->_category = Mage::getSingleton('catalog/layer')->getCurrentCategory();
     $_page = $this->getPage();
     $toolbar = new Mage_Catalog_Block_Product_List_Toolbar();
     $cacheKey = 'ProductLayerView_' . $this->_category->getId() . '_' . $toolbar->getCurrentOrder() . '_' . $toolbar->getCurrentDirection() . '_' . $toolbar->getCurrentMode() . '_' . $toolbar->getCurrentPage() . '_' . $toolbar->getLimit() . '_' . Mage::App()->getStore()->getCode() . '_' . Mage::App()->getStore()->getCurrentCurrencyCode() . '_' . $_customer->getGroupId() . '_' . $_taxRateRequest->getCountryId() . "_" . $_taxRateRequest->getRegionId() . "_" . $_taxRateRequest->getPostcode() . "_" . $_taxRateRequest->getCustomerClassId() . "_" . Mage::registry('current_tag') . '_' . '';
     /* ... layern navigation + search */
     foreach (Mage::app()->getRequest()->getParams() as $key => $value) {
         $cacheKey .= $key . '-' . $value . '_';
     }
     return $cacheKey;
 }