Hi friends,
in my template override for cart/default.php I need to know what has changed when a customer updates cart items (quantity, remove item).
$this->cart is already updated with the news quantities, removed items are removed, $_POST only contains cart position ids ans quantities.
I need to display something like:
- Product #123 Foo's quantity has been updated from 1 to 3
- Product #444 Bar has been removed.
Any hints appreciated!
Every action in cart use trigger (add to cart, remove from cart, change quantity) or equivalent in JS.
You can create system plugin for echo this trigger or custom JS fot the same.
Thank you pinochico,
I cannot use JS for this. It needs to be done in PHP.
But for other tasks JS might be helpful. Mind providing examples how to intercept add/remove/upadte cart events with own JS?
I think the best trigger for you is plgVmOnAddToCartFilter
Milbo, thank you for your reply.
I was suspecting that I would need to go the plugin way...
So basically I will need maintain some sort of "shadow cart" keeping track of every add/remove/update event, and offer a way for the template to get this "cart before update"?
(Note to self: make sure this really is a robust solution even if customers use several tabs updating the cart from either of them.)
In case I write a plugin, I'll post it here.
QuoteSo basically I will need maintain some sort of "shadow cart" keeping track of every add/remove/update event, and offer a way for the template to get this "cart before update"?
Why?
Now existing a lot of plugins with GA Enhanced Ecommerce, which make the same.
But go on :)
Hi pinochico.
what exaclty is GA Enhanced Ecommerce and how does it help getting the required data in my template as described in the inital question?