因此,我們已將「最近瀏覽過的」模塊放入我們的產品視圖中。一切看起來都很好,但我現在看到奇怪的錯誤,這與空佈局有關。如果我關閉緩存工作正常,但啓用完整頁面緩存失敗時調用$ this-> getColumnCount();在模板中。Magento:將「最近瀏覽」移動到產品頁面會產生奇怪的緩存錯誤
我所做的產品頁面上啓用最近查看的是:
在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>
在模板文件
:目錄/產品/圖一個.phtml:
<?php echo $this->getChildHtml('recently_viewed') ?>
一切加載罰款的第一次,但當時如果我在其他產品視圖中單擊,然後重新加載頁面的錯誤它出來。我將錯誤追溯到類:Mage_Page_Helper_Layout。
功能getCurrentPageLayout(),有一行:
$this->getLayout()->getBlock('root')
和$這個 - > getLayout被返回null這將導致getBlock調用拋出異常。
如果我禁用緩存沒有錯誤出現,一切工作正常。
的是,在企業版?如果你看看'app/code/core/Enterprise/PageCache/etc/cache.xml',它似乎提供了一個解決方案,但我不熟悉該功能或它的工作原理。 – clockworkgeek 2010-10-18 19:41:18
是它的企業版。感謝指針。我正在研究該代碼,但似乎無法完全關閉該塊的緩存。即使我將cache_lifetime設置爲1,它仍然給我相同的錯誤,並且如果我從cache.xml中取出該xml塊,它只會無限期地緩存該頁面,並且在我單擊其他項目時不會更新。 – GeekPride 2010-10-18 22:14:10