Magento:将"最近查看"移动到产品页面会产生奇怪的缓存错误

Gee*_*ide 5 php caching magento

因此,我们将"最近查看过的"块放入我们的产品视图中.一开始看起来一切看起来都不错,但我现在看到与null布局有关的奇怪错误.如果我关闭缓存它工作正常,但启用完整页面缓存时调用$ this-> getColumnCount(); 在模板中.

我最近在产品页面上查看过的内容是:

在catalog_product_view的内容块中的catalog.xml中:

            <block type="reports/product_viewed" name="reports.product.viewed" as="recently_viewed" template="reports/product_viewed.phtml">
                <action method="setColumnCount"><columns>4</columns></action>
                <action method="setItemLimit"><type>recently_viewed</type><limit>4</limit></action>
            </block>
Run Code Online (Sandbox Code Playgroud)

在模板文件中:catalog/product/view.phtml:

             <?php echo $this->getChildHtml('recently_viewed') ?>
Run Code Online (Sandbox Code Playgroud)

一切都很好,第一次加载,但如果我点击另一个产品视图,然后重新加载它错误的页面.我将错误追溯到了类:Mage_Page_Helper_Layout.

函数getCurrentPageLayout(),有一行:

 $this->getLayout()->getBlock('root')
Run Code Online (Sandbox Code Playgroud)

和$ this-> getLayout返回null,导致getBlock调用抛出异常.
如果我禁用缓存没有错误出现,一切正常.

jok*_*net 1

您运行的是哪个版本?据我所知,Magento Enterprise 1.9 在全页缓存方面存在严重问题。抱歉,我无法提供更多帮助。