因此,我们已将“最近查看”块放入我们的产品 View 中。起初一切似乎都很好,但我现在看到了与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>

在模板文件中:catalog/product/view.phtml:
             <?php echo $this->getChildHtml('recently_viewed') ?>

第一次的一切加载都很好,但是如果我单击另一个产品 View ,然后重新加载页面,它就会出错。我将错误追溯到类:Mage_Page_Helper_Layout。

函数getCurrentPageLayout()有一行:
 $this->getLayout()->getBlock('root')

$ this-> getLayout返回null,这将导致getBlock调用引发异常。
如果我禁用了缓存,则不会出现任何错误,并且一切正常。

最佳答案

您正在运行哪个版本?据我所知,Magento Enterprise 1.9在全页缓存方面存在严重问题。抱歉,我帮不上忙。

关于php - Magento : Moving "Recently Viewed" to product page creates weird caching error,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/3961991/

10-12 12:34
查看更多