Magento – Magento and Varnish (Turpentime) Mini Cart is being cached

cachefull-page-cachemini-cartturpentinevarnish

I've just configured correctly the Varnish cache, finally, but now I ran into some issues…

I've notices, at the moment one important error and can't get to fix it.

The thing is that the Mini Cart (in my header) is beeing cached and displayes wrong information when accessed by another visitor.

How can I disable the mini cart caching??

I tryed modyfing the checkout.xml like this:

<!-- Mage_Checkout -->
<reference name="top.links">
    <block type="checkout/links" name="checkout_cart_link">
        <action method="addCartLink"></action>
        <action method="addCheckoutLink"></action>
        <action method="setEsiOptions">
            <params>
                <method>ajax</method>
                <access>private</access>
            </params>
        </action>
    </block>
</reference>

<reference name="header">
    <block type="checkout/cart_minicart" name="minicart_head" template="checkout/cart/minicart.phtml" before="-">
        <block type="checkout/cart_sidebar" name="minicart_content" template="checkout/cart/minicart/items.phtml">
            <action method="addItemRender"><type>default</type><block>checkout/cart_item_renderer</block><template>checkout/cart/minicart/default.phtml</template></action>
            <action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>checkout/cart/minicart/default.phtml</template></action>
            <action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/cart/minicart/default.phtml</template></action>
            <action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/cart/minicart/default.phtml</template></action>
            <action method="setEsiOptions">
                <params>
                    <method>ajax</method>
                    <access>private</access>
                </params>
            </action>
            <block type="core/text_list" name="cart_sidebar.cart_promotion" as="cart_promotion" translate="label" module="checkout">
                <label>Mini-cart promotion block</label>
            </block>
            <block type="core/text_list" name="cart_sidebar.extra_actions" as="extra_actions" translate="label" module="checkout">
                <label>Shopping Cart Sidebar Extra Actions</label>
            </block>
        </block>
    </block>
</reference>

By setting the ESI Options, but it didn't help,

Any ideas?

UPDATE

I've managed to retrieve the cart items, by adding this to the local.xml:

<default>
        <reference name="minicart_head">
            <action method="setEsiOptions">
                <params>
                    <access>private</access>
                    <ttl>0</ttl>
                    <method>ajax</method>
                </params>
            </action>
        </reference>
    </default>

But still having an issue with the counter, it's not beeing updated, any help, please?

Best Answer

I would try it without the <method>ajax</method> And add a flush event.

I copied this from a working customer's .../layout/local.xml:

    <reference name="cart_sidebar">
        <action method="setEsiOptions">
            <params>
                <access>private</access>
                <flush_events>
                    <sales_quote_save_after/>
                </flush_events>
            </params>
        </action>
    </reference>

Hope this helps.

Related Topic