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; }
public function getLimit() { if (Mage::helper('adjnav')->isPageAutoload()) { $mode = $this->getCurrentMode(); $limit = Mage::getStoreConfig('design/adjnav_endless_page/products_on_' . $mode . '_page'); if ($limit) { $this->setData('_current_limit', $limit); return $limit; } } return parent::getLimit(); }
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; }
/** * Retrieve loaded category collection * * @return Mage_Catalog_Model_Resource_Collection_Abstract | null */ protected function _getProductCollection() { /* For catalog list and search results * Expects getListBlock as Mage_Catalog_Block_Product_List */ if (is_null($this->_productCollection)) { $this->_productCollection = $this->getListBlock()->getLoadedProductCollection(); } /* For collections of cross/up-sells and related * Expects getListBlock as one of the following: * Enterprise_TargetRule_Block_Catalog_Product_List_Upsell | _linkCollection * Enterprise_TargetRule_Block_Catalog_Product_List_Related | _items * Enterprise_TargetRule_Block_Checkout_Cart_Crosssell | _items * Mage_Catalog_Block_Product_List_Related | _itemCollection * Mage_Catalog_Block_Product_List_Upsell | _itemCollection * Mage_Checkout_Block_Cart_Crosssell, | setter items */ if ($this->_showCrossSells && is_null($this->_productCollection)) { $this->_productCollection = $this->getListBlock()->getItemCollection(); } // Support for CE if (is_null($this->_productCollection) && ($this->getBlockName() == 'catalog.product.related' || $this->getBlockName() == 'checkout.cart.crosssell')) { $this->_productCollection = $this->getListBlock()->getItems(); } //limit collection for page product $this->_productCollection->setCurPage($this->getCurrentPage()); // we need to set pagination only if passed value integer and more that 0 $limit = (int) Mage_Catalog_Block_Product_List_Toolbar::getLimit(); if ($limit) { $this->_productCollection->setPageSize($limit); } return $this->_productCollection; }