当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Catalog_Block_Product_List::getCacheKeyInfo方法代码示例

本文整理汇总了PHP中Mage_Catalog_Block_Product_List::getCacheKeyInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Catalog_Block_Product_List::getCacheKeyInfo方法的具体用法?PHP Mage_Catalog_Block_Product_List::getCacheKeyInfo怎么用?PHP Mage_Catalog_Block_Product_List::getCacheKeyInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Catalog_Block_Product_List的用法示例。


在下文中一共展示了Mage_Catalog_Block_Product_List::getCacheKeyInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getCacheKeyInfo

 public function getCacheKeyInfo()
 {
     $info = parent::getCacheKeyInfo();
     $info[] = $this->getRequest()->getRequestUri();
     $info[] = $this->getRequest()->getRequestString();
     $info[] = Mage::app()->getStore()->getCurrentCurrencyCode();
     $info[] = Mage::getSingleton('customer/session')->getCustomerGroupId();
     return $info;
 }
开发者ID:technomagegithub,项目名称:magento,代码行数:9,代码来源:List.php

示例2: getCacheKeyInfo

 /**
  * Returns array that uniquely identifies this product list in cache storage
  *
  * I have added the array keys: category_id, customer_group and website_id to ensure that we get correct product
  * prices in every instance of this product list
  *
  * @return array Cache key info
  * @throws Mage_Core_Exception
  */
 public function getCacheKeyInfo()
 {
     // Get Magento's standard product list block cache key info
     $info = parent::getCacheKeyInfo();
     // Dispatch event so others can modfify cache key info of this block without modifying module
     Mage::dispatchEvent('st_productlistblockcache_cache_info_add_before', array('cache_key_info' => $info));
     /** @var Mage_Catalog_Model_Category|null $currentCategory Current category model or null */
     $currentCategory = Mage::registry('current_category');
     /** @var string $categoryId Current category id. Empty string if we don't know. */
     $categoryId = '';
     // If we know current category, then add category id to cache key info
     if ($currentCategory instanceof Mage_Catalog_Model_Category) {
         $categoryId = $currentCategory->getId();
     }
     // Add category_id to cache key info
     $info['category_id'] = $categoryId;
     /** @var int $customerGroupId Get logged in user's customer group id */
     $customerGroupId = (int) Mage::getSingleton('customer/session')->getCustomerGroupId();
     // Add customer_group to cache key info
     $info['customer_group'] = $customerGroupId;
     /** @var int $currentWebsiteId Current website ID */
     $currentWebsiteId = (int) Mage::app()->getWebsite()->getId();
     // Add website_id to cache key info
     $info['website_id'] = $currentWebsiteId;
     /** @var string $layerStateKey */
     $layerStateKey = $this->getLayer()->getStateKey();
     $info['layer_state_key'] = $layerStateKey;
     /** @var string $formKey */
     $formKey = Mage::getSingleton('core/session')->getFormKey();
     $info['form_key'] = $formKey;
     /** @var string $originalRequestUri */
     $originalRequestUri = Mage::app()->getRequest()->getOriginalRequest()->getRequestUri();
     $info['request_uri'] = $originalRequestUri;
     // Current currency code
     $info['currency'] = Mage::app()->getStore()->getCurrentCurrencyCode();
     // Current locale code
     $info['locale'] = Mage::app()->getLocale()->getLocaleCode();
     // Dispatch event so others can modfify cache key info of this block without modifying module
     Mage::dispatchEvent('st_productlistblockcache_cache_info_add_after', array('cache_key_info' => $info));
     return $info;
 }
开发者ID:p-makowski,项目名称:product-list-block-cache,代码行数:50,代码来源:List.php


注:本文中的Mage_Catalog_Block_Product_List::getCacheKeyInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。