Full Page Cache: Enterprise PageCache Model Cookie

How to work/flow Enterprise_PageCache_Model_Cookie class in Magento? (Magento EE 1.13.0.2)

Object : $this => class Enterprise_PageCache_Model_Cookie

Following constants is used in above class:

const COOKIE_CUSTOMER = 'CUSTOMER';
const COOKIE_CUSTOMER_GROUP = 'CUSTOMER_INFO';
const COOKIE_MESSAGE = 'NEWMESSAGE';
const COOKIE_CART = 'CART';
const COOKIE_COMPARE_LIST = 'COMPARE';
const COOKIE_POLL = 'POLL';
const COOKIE_RECENTLY_COMPARED = 'RECENTLYCOMPARED';
const COOKIE_WISHLIST = 'WISHLIST';
const COOKIE_WISHLIST_ITEMS = 'WISHLIST_CNT';
const COOKIE_CUSTOMER_LOGGED_IN = 'CUSTOMER_AUTH';
const COOKIE_FORM_KEY = 'CACHED_FRONT_FORM_KEY';

Subprocessors cookie names:

  • const COOKIE_CATEGORY_PROCESSOR = 'CATEGORY_INFO';

Cookie to store last visited category id:

  • const COOKIE_CATEGORY_ID = 'LAST_CATEGORY';

Customer segment ids cookie name:

  • const CUSTOMER_SEGMENT_IDS = 'CUSTOMER_SEGMENT_IDS';

Cookie name for users who allowed cookie save:

  • const IS_USER_ALLOWED_SAVE_COOKIE = 'user_allowed_save_cookie';

Following variables is used in above class:

  • $_salt

Some important functions and its purpose in this class:

  • getCategoryCookieValue() : This function is used for get catalog cookie value.
  • setCategoryViewedCookieValue() : This function is used to set cookie with visited category id.

Functions in class Enterprise_PageCache_Model_Cookie

There are 9 functions are present in class Enterprise_PageCache_Model_Cookie

    • /**Retrieve encryption salt
           * @return null|sting **/

protected function _getSalt()

 /**Set cookie with obscure value
     * @param string $name The cookie name
     * @param string $value The cookie value
     * @param int $period Lifetime period
     * @param string $path
     * @param string $domain
     * @param int|bool $secure
     * @param bool $httponly
     * @return Mage_Core_Model_Cookie **/
     public function setObscure(
        $name, $value, $period = null, $path = null, 
$domain = null, $secure = null, $httponly =
         null
    ) 
 /** Keep customer cookies synchronized with customer session
     *
     * @return Enterprise_PageCache_Model_Cookie **/
     public function updateCustomerCookies()
/** Register viewed product ids in cookie
     * @param int|string|array $productIds
     * @param int $countLimit
     * @param bool $append **/
    public static function registerViewedProducts($productIds, $countLimit, $append = true)
    
/**Set catalog cookie
     * @param string $value **/
     public static function setCategoryCookieValue($value)
    
/** Get catalog cookie
     * @static * @return bool*/
     public static function getCategoryCookieValue()
    
 /**Set cookie with visited category id
     * @param int $id **/
    public static function setCategoryViewedCookieValue($id)
    
 /** Set cookie with form key for cached front
     * @param string $formKey **/
    public static function setFormKeyCookieValue($formKey)
    
 /**Get form key cookie value
     * @return string|bool **/
     public static function getFormKeyCookieValue()
    
Variation of sample data for different pages (Homepage, Product Listing Page, Product Info Page)

Variables : These values for Homepage (when not logged-in):
URL: https://localhost/oscp-store/mage-ent-test/index.php

$_salt = null

Variables : These values for Homepage(when logged-in):
URL: https://localhost/oscp-store/mage-ent-test/index.php

$_salt = f1b64e77da18310f9bd404ca22748142

Variables :These values for Product Listing Page(when logged-in):
URL:
https://localhost/oscp-store/mage-ent-test/furniture

$_salt = 14e5edf2a11a1a557377d59e74f62ead

Variables: These values for Product Info Page(when logged-in):
URL:
https://localhost/oscp-store/mage-ent-test/furniture/couch.html

$_salt = 14e5edf2a11a1a557377d59e74f62ead

Latest Posts