Full Page Cache: Enterprise_PageCache_Model_Container_CatalogProductItem
Enterprise_PageCache_Model_Container_CatalogProductItem class in Magento? (Magento EE 1.13.0.2)
Object:$this => Enterprise_PageCache_Model_Container_CatalogProductItem
Following constants is used in above class :
- const BLOCK_NAME_RELATED = ‘CATALOG_PRODUCT_ITEM_RELATED’;
- const BLOCK_NAME_UPSELL = ‘CATALOG_PRODUCT_ITEM_UPSELL’;
Following variables is used in above class:
- $_parentBlock
- $_itemId
- $_itemPosition
- $_infoCacheId
- $_sharedInfoData
Some important functions and its purpose in this class:
- _getInfoCacheId(): This function returns cache identifier for informational data related to product lists.
- _saveInfoCache(): This function is used to saves informational cache, containing parameters used to show lists.
- _getItemId(): This function is used to get next item id.
- applyInApp(): Generate and apply container content in controller after application is initialized
- applyWithoutApp(): This function is used for check if could be applied without application
- _getCacheId(): This function is used for to get cache id.
Functions used in class Enterprise_PageCache_Model_Container_CatalogProductItem
- /**Get parent block type
* @return null|string **/
protected function _getListBlockType()
{
$blockName = $this->_placeholder->getName();
if ($blockName == self::BLOCK_NAME_RELATED) {
return ‘enterprise_targetrule/catalog_product_list_related’;
} elseif ($blockName == self::BLOCK_NAME_UPSELL) {
return ‘enterprise_targetrule/catalog_product_list_upsell’;
}
return null;
} - /**Returns cache identifier for informational data about product lists
* @return string **/
protected function _getInfoCacheId()
{
if (is_null($this->_infoCacheId)) {
$this->_infoCacheId = ‘CATALOG_PRODUCT_LIST_SHARED_’
. md5($this->_placeholder->getName()
. $this->_getCookieValue(Enterprise_PageCache_Model_Cookie::COOKIE_CART, ”)
. $this->_getProductId());
}
return $this->_infoCacheId;
} - /**Saves informational cache, containing parameters used to show lists.
* @return Enterprise_PageCache_Model_Container_CatalogProductItem **/
protected function _saveInfoCache()
{
} - /**Get shared info param
* @param string|null $key
* @return mixed **/
protected function _getSharedParam($key = null)
{
} - /**Set shared info param
* @param string $key
* @param mixed $value
* @return Enterprise_PageCache_Model_Container_CatalogProductItem **/
protected function _setSharedParam($key, $value)
{
$placeholderName = $this->_placeholder->getName();
if (is_null(self::$_sharedInfoData[$placeholderName][‘info’])) {
$this->_getSharedParam();
}
self::$_sharedInfoData[$placeholderName][‘info’][$key] = $value;
return $this;
} - /** Get parent (container) block
* @return false|Enterprise_TargetRule_Block_Catalog_Product_List_Abstract
*/
protected function _getParentBlock()
{
if (is_null($this->_parentBlock)) {
$blockType = $this->_getListBlockType();
$this->_parentBlock = $blockType ? Mage::app()->getLayout()->createBlock($blockType) : false;
}
return $this->_parentBlock;
} - /**Get next item id
* @return int|null **/
protected function _getItemId()
{
} - /**Pop current item id
* @return int **/
protected function _popItem()
{
} - /**Generate and apply container content in controller after application is initialized
* @param string $content
* @return bool*/
public function applyInApp(&$content)
{
$result = parent::applyInApp($content);
$this->_saveInfoCache();
return $result;
} - /**Check if could be applied without application
* @param string $content
* @return bool*/
public function applyWithoutApp(&$content){} - /**Render element that was not cached
* @return false|string **/
protected function _renderBlock()
{
} - /** Retrieve cache id
* @return string*/
protected function _getCacheId()
{
return parent::_getCacheId() . $this->_getProductId();
}
Sample data for Product Page
Variables:
URL : https://localhost/oscp-store/mage-ent-test/furniture/living-room/ottoman.html
Note: Ottoman have assign only one related product and don’t have any upsell product.
- $_parentBlock = /** Parent (container) block **/
Enterprise_TargetRule_Block_Catalog_Product_List_Related - $_itemId = /** Current item id **/
52 - $_itemPosition = /** Container position in list **/
0 - $_infoCacheId = /** $_itemPosition **/
CATALOG_PRODUCT_LIST_SHARED_866b61fa36e19333d7c7d515c23ad5b4 - $_sharedInfoData = /**Data shared between all instances of current container**/
= Array [2] 0 = CATALOG_PRODUCT_ITEM_RELATED = Array [3] first = true
info = Array [1] cursor = 1
1 = CATALOG_PRODUCT_ITEM_UPSELL = Array [3] first = true
info = Array [0] cursor = 1