Exemplo n.º 1
0
 /**
  * Return cache page id without application. Depends on GET super global array.
  *
  * @param Enterprise_PageCache_Model_Processor $processor
  * @return string
  */
 public function getPageIdWithoutApp(Enterprise_PageCache_Model_Processor $processor)
 {
     $this->_updateCategoryViewedCookie($processor);
     $queryParams = $_GET;
     /**
      * unset known tracking codes
      */
     unset($queryParams["trk_module"]);
     unset($queryParams["trk_msg"]);
     unset($queryParams["trk_contact"]);
     unset($queryParams["utm_source"]);
     unset($queryParams["utm_medium"]);
     unset($queryParams["utm_term"]);
     unset($queryParams["utm_campaign"]);
     unset($queryParams["utm_content"]);
     /** End Edit */
     $sessionParams = Enterprise_PageCache_Model_Cookie::getCategoryCookieValue();
     if ($sessionParams) {
         $sessionParams = (array) json_decode($sessionParams);
         foreach ($sessionParams as $key => $value) {
             if (in_array($key, $this->_paramsMap) && !isset($queryParams[$key])) {
                 $queryParams[$key] = $value;
             }
         }
     }
     ksort($queryParams);
     $queryParams = json_encode($queryParams);
     Enterprise_PageCache_Model_Cookie::setCategoryCookieValue($queryParams);
     return $processor->getRequestId() . '_' . md5($queryParams);
 }
Exemplo n.º 2
0
 /**
  * Update catalog session from cookies
  */
 protected function _prepareCatalogSession()
 {
     $sessionParams = Enterprise_PageCache_Model_Cookie::getCategoryCookieValue();
     if ($sessionParams) {
         $session = Mage::getSingleton('catalog/session');
         $sessionParams = (array) json_decode($sessionParams);
         foreach ($sessionParams as $key => $value) {
             if (in_array($key, $this->_paramsMap)) {
                 $session->setData($key, $value);
             }
         }
     }
 }
Exemplo n.º 3
0
 /**
  * Clear request path cache by tag
  * (used for redirects invalidation)
  *
  * @param Varien_Event_Observer $observer
  * @return $this
  */
 public function fixInvalidCategoryCookie(Varien_Event_Observer $observer)
 {
     $categoryId = $observer->getCategoryId();
     if (Enterprise_PageCache_Model_Cookie::getCategoryCookieValue() != $categoryId) {
         Enterprise_PageCache_Model_Cookie::setCategoryViewedCookieValue($categoryId);
         Enterprise_PageCache_Model_Cookie::setCurrentCategoryCookieValue($categoryId);
     }
 }
Exemplo n.º 4
0
 /**
  * Update catalog session from GET or cookies
  *
  * @param string $queryParams
  */
 protected function _prepareCatalogSession()
 {
     $queryParams = json_decode($this->_getQueryParams(), true);
     if (empty($queryParams)) {
         $queryParams = Enterprise_PageCache_Model_Cookie::getCategoryCookieValue();
         $queryParams = json_decode($queryParams, true);
     }
     if (is_array($queryParams) && !empty($queryParams)) {
         $session = Mage::getSingleton('catalog/session');
         $flipParamsMap = array_flip($this->_paramsMap);
         foreach ($queryParams as $key => $value) {
             if (in_array($key, $this->_paramsMap)) {
                 $session->setData($flipParamsMap[$key], $value);
             }
         }
     }
 }