Question

I've been using turpentine as varnish cache on a startup e-commerce site and I am very satisfied with the performance. I am using magento 1.7.0.2 with turpentine 0.5.4.

However, I have a problem with the sidebar cart. It gets cached and if I add products to my cart, when I come back to a cached page it still says 0 products.

I have "cart_sidebar" on private in my turpentine_esi.xml, and I have block type="checkout/cart_sidebar" name="cart_sidebar" as="cart_sidebar" template="checkout/cart/sidebar.phtml" in my checkout.xml (although it's in my theme, not in the base folder). I have saved and applied varnish config multiple times. I have read the similar issues, with no success in resolving this so far. You can test the problem here: http://www.easyfarm.ro

Any help would be really, really much appreciated since I have been struggling with this for some time. At first I thought it was from my em_ajaxcart module, but I disabled it and the problem is still there.

Was it helpful?

Solution

In order to stop caching the cart sidebar , I added the following code to my theme's checkout.xml

<block type="checkout/cart_sidebar" name="cart_sidebar" as="cart_sidebar" template="checkout/cart/sidebar.phtml">
    <action method="setEsiOptions">
        <params>
            <method>ajax</method>
            <access>private</access>
        </params>
    </action>
</block>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top