What would be the easiest way to create a FPC hole punch for static block (cms block)?
Let's say I have a static block that calls another block inside that has behaviour I want to be dynamic on every page load.
cachefull-page-cache
What would be the easiest way to create a FPC hole punch for static block (cms block)?
Let's say I have a static block that calls another block inside that has behaviour I want to be dynamic on every page load.
Best Answer
The easiest way I've found to holepunch CMS blocks in Magento Enterprise's Full Page Caching module has a few steps:
First, let's look at the directory structure required:
With that top-down understanding in mind here's how to fill those files out.
Create your own block class that extends the built in Magento CMS block. You'll need to override the "getCacheKeyInfo" function as follows too:
Set up the placeholder model that is responsible for rendering out our CMS block without applying the cache.
Set up cache.xml to target our newly created CMS block and render using our newly created placeholder.
In the CMS, replace the block types for the blocks you're trying render outside the cache with our newly minted CMS-proof block:
{{block type="cachebuster/cms" block_id="cacheproof"}}