我使用启用了全页缓存的 Magento EE 1.12 版
a)我的产品详细信息页面被缓存 b)因此我在此页面中的购物车不显示动态项目计数 c)所以我无法在我的产品详细信息页面中显示有效的购物车项目计数
我遵循的步骤
1)我创建了一个块并从 header.phtml 调用 2)试图使该 topcart.phtml 块不被缓存
作为magento的新手,我得到了一些缓存打孔的链接
我按照以下链接但没有成功
我的文件结构
app-代码-本地-企业-PageCache->等-cache.xml
和 PageCache - 模型 - 容器 - TopCart.php
代码如下图
我创建了文件 cache.xml 和 cart.php 容器文件
<page_html_topcart>
<block>page/html_topcart</block>
<name>topcart</name>
<placeholder>PAGE_HTML_HEADER_CART</placeholder>
<container>Enterprise_PageCache_Model_Container_TopCart</container>
<cache_lifetime>36400</cache_lifetime>
</page_html_topcart>
这是我的 topcart.php 容器文件看起来像
protected function _getIdentifier()
{
$cacheId = $this->_getCookieValue(Enterprise_PageCache_Model_Cookie::COOKIE_CUSTOMER, '')
. '_'
. $this->_getCookieValue(Enterprise_PageCache_Model_Cookie::COOKIE_CUSTOMER_LOGGED_IN, '');
return $cacheId;
}
protected function _getCacheId()
{
return 'CONTAINER_TOPCART_' . md5($this->_placeholder->getAttribute('cache_id') . $this->_getIdentifier());
}
protected function _renderBlock()
{
$block = $this->_getPlaceHolderBlock(); //('page/html_header_cart');
Mage::dispatchEvent('render_block', array('block' => $block, 'placeholder' => $this->_placeholder));
return $block->toHtml();
}
请通过有用的链接和步骤帮助我