1

I have an extension which saves some data into session when user makes any of the following action:

-adds/remove product to cart or change qty
-apply coupon code
-login

For this I created different observers, this is just one of them:

        <checkout_cart_product_add_after>
            <observers>
                <save_data_into_session>
                    <type>singleton</type>
                    <class>company_modulname/observer</class>
                    <method>saveData</method>
                </save_data_into_session>                    
            </observers>
        </checkout_cart_product_add_after>  

I don't need anything else, I just need to store value to session or cookie.

Problem:

The problem is about cache. I created observer for each action (checkout_cart_product_add_after,checkout_cart_save_after, ...). Some cache extensions caches also logged in user. It will cache everything except block that is required to display user cart. But this means Magento still needs to go through some models I guess.

My question is: Let's say I define observer inside config.xml and cache module caches my block, but it goes through Magento core models required to display cart inside header. Will Magento go through my observer model or not?

2

Since storing data in the session can't be done it will. Customer (user) specific data and page calls will never be cached so you should be good

| improve this answer | |
  • Why storing data in the session can't be done? I am not sure if I understand what you mean. – JohnyFree Sep 7 '15 at 16:46
  • Ah, no it can be done. But it'll never be cached :) so your observer should just work fine – Sander Mangel Sep 7 '15 at 16:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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