I have turned off the option to redirect to the cart after a product has been added. Instead, it just redirects back to the page it was originally on.
Is there a way to tell if something was just added? I would love to learn that there is a pretty simple if statement for this!
Best Answer
It's not a single call statement, but here is how you can do it:
Setup an observer to listen to the
checkout_cart_add_product_complete
and set a flag on thecore/session
object:When you are redirected back to the product page, you'll now have a flag set on the session object. You can retrieve this flag like so:
Passing
true
to the getter method here (as shown above) clears the flag so it will no longer exist on the session, meaning it is only present on the first request immediately following the add to cart action was fired.