0

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?

6
  • Please update your question and be specific about what FPC that you are using
    – MatthijsIJ
    Commented Aug 17, 2015 at 13:37
  • @ForMat I am using default Magento Enterprise Full Page Cache Commented Aug 17, 2015 at 13:42
  • Magento EE has a header minicart built in. Why not use that?
    – Ryan Hoerr
    Commented Aug 18, 2015 at 3:20
  • @RyanH. 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. Commented Aug 18, 2015 at 3:49
  • @AnshuMishra Okay. Are you using (or extending) the rwd/enterprise theme, rather than rwd/default? That theme definitely supports EE FPC out-of-box, so if that's not working, you're probably missing something.
    – Ryan Hoerr
    Commented Aug 18, 2015 at 3:58

1 Answer 1

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.