Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I include a dynamic block in the product page with full page caching turned on?
    text
    copied!<p>We would like to add a dynamic block to the product page. The problem is that the product page has full page caching (and we cannot turn that off due to speed issues). We want to display different information on each product page based on the logged in user's account, and it varies from product to product.</p> <p>I created a separate block that has its own caching, but this displays the same block from the previous product page. I'm trying to alter it's caching method so it doesn't save the cache from the previous product page.</p> <p>It works the first few times I go to the product pages, but then suddenly starts displaying a Magento error page that says, "The website encountered an error while retrieving <a href="http://www.mycompany.com/productpage.html">http://www.mycompany.com/productpage.html</a>. It may be down for maintenance or configured incorrectly."</p> <p>Here is what I've done so far. I created app/code/local/MyCompany/MyModule/PageCache/etc/config.xml to add MyCompany_PageCache_Model.</p> <p>Then I created the file that controls caching in app/code/local/MyCompany/MyModule/PageCache/Model/Container/MyFile.php with these functions:</p> <pre><code>protected function _getCacheId() { return 'CONSTANT_CACHE' . md5($this-&gt;_placeholder-&gt;getAttribute('cache_id')); } protected function _saveCache($data, $id, $tags = array(), $lifetime = null) { return false; } protected function _renderBlock() { $blockClass = $this-&gt;_placeholder-&gt;getAttribute('block'); $template = $this-&gt;_placeholder-&gt;getAttribute('template'); $block = new $blockClass; $block-&gt;setTemplate($template); $block-&gt;setLayout(Mage::app()-&gt;getLayout()); return $block-&gt;toHtml(); } </code></pre> <p>I also created cache.xml under Catalog/etc with my placeholder for CONSTANT_CACHE.</p> <p>Is the syntax above incorrect, or is there an easier way to do this?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload