Magento Upgrade 1.7 > 1.9 DB Issue

2019-08-02 21:11发布

问题:

I upgraded Magento 1.7 to 1.9 and after upgrade the add-to-cart doesn't work anymore. It is not connected to the form_key! Why i think it is a database issue:

I used clean magento 1.9 with clean database and created one product, add-to-cart works fine. I connected this magento with the database i upgraded and add-to-cart didn't work.

So clean Magento with "old" database doesn't work on add-to-cart. Has anyone an idea how to solve this? I don't really want to use a clean database and move data to this, because it is ~500k products and a lot of customers and orders.

Update:

I hooked into controller_action_postdispatch where the full action name is checkout_cart_add and checked what is in quote. There is one item in quote. I also hooked into controller_action_predispatch_checkout_cart_index and checked the quote, and the quote is empty. So somewhere inbetween the issue occures. The events inbetween are only model_saves or some resource_ events.

Update 1:

I logged all the executed SQL queries on this add-to-cart and checked if the quote is actually saved in database. The entry is correct in the sales_flat_quote. So my next idea is that somehow the connection of session and quote is missing, because i figured out that on cart_index the quote object is not set. I still think it is connected to DB because if i switch to some "originally installed" 1.9 db it works fine.

回答1:

After a lot of debugging i found the reason why ... frontend cookie was missing. And the reason why frontend cookie was missing was, in Magento backend -> Sytem -> Configuration -> Web -> Session Management there was a cookie domain set in storeview context. And because the configured url didn't match the actual url the frontend cookie was never set, so the session was not existing and of course the quote was empty all the time.

Thanks for spending time to find the solution with me!