VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Coding Central => Topic started by: Genius WebDesign on December 17, 2014, 16:57:47 PM

Title: Plugin that executes when "add to cart"
Post by: Genius WebDesign on December 17, 2014, 16:57:47 PM
Hi,

I need to program a plugin for Virtuemart 2.6 that executes a code whenever a product is added to cart.
Specifically I need to update the cart session data so that "paymentCurrency" is set to current front-end chosen currency.

What class do I need to tap into in order to update cart session when product is added to cart?
Title: Re: Plugin that executes when "add to cart"
Post by: Genius WebDesign on December 17, 2014, 17:02:41 PM
Maybe a better solution would be to program the plugin to trigger whenever currency is changed, if that is possible?
Basically so cart session is updated with current currency data at all times.
Title: Re: Plugin that executes when "add to cart"
Post by: Genius WebDesign on December 17, 2014, 17:17:02 PM
Hi again,

After some considerations I have found out that a plugin is not needed for this.
I simply need to apply PHP script to update cart session with custom HTML/PHP module and assign it to check out page.
Title: Re: Plugin that executes when "add to cart"
Post by: Milbo on December 18, 2014, 09:38:26 AM
in vm3, the trigger is

plgVmPrepareCartProduct

Your method wont work in vm3, cause it would be recognised as manipulation and deleted.