Question

I am trying to display Minicart in header but FPC (Magento Enterprise default FPC) is caching it and Minicart is not updated when I am navigating to category or CMS pages.

        <reference name="header">
            <block type="checkout/cart_minicart" name="custom_minicart_header" template="checkout/cart/minicartHeader.phtml" />
        </reference>

Then I am calling this block in my header.phtml

echo $this->getChildHtml('custom_minicart_header');

I am using EE header minicart only as I have some design changes so I have created a custom template for minicart. rest all the things are same.
Even when I am switch my store to default rwd theme which has the built in minicart, then also I am getting the same issue and minicart in header is getting cached.

How can I make this block not to being cached by FPC?

Was it helpful?

Solution

If Enterprise Edition's built-in header minicart is not an option (caching is already taken care of there), then you'll have to handle it yourself. Excluding a block from full-page cache is called 'hole punching'. The page is cached with placeholders (holes) for certain pieces, and then those pieces are generated and injected into those holes. Any part of pages that is time-sensitive or session-specific will typically be hole punched to avoid caching.

Hole punching with EE's FPC involves some block methods, and module config. You will have to create a custom module if you don't already have one, and a custom block extending your existing checkout/cart_minicart.

For specifics, you'll find a good writeup on the steps and code involved here: https://magento.stackexchange.com/a/35493/1905

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top