VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: stoddsie on October 12, 2012, 14:38:23 PM

Title: HELP:Manually Add to Cart using standalone PHP code in Joomla
Post by: stoddsie on October 12, 2012, 14:38:23 PM
I have some standalone (non virtuemart pages) which I wish to add a "Add to cart" button for a given product.

I know what the id of the product is, along with Qty, Category price etc.

Is there anyway I can create my own button that does the same as the normal "add to cart" buttons. I managed to achieve this in VM 1.1.9 by manually adding my own values to the Session 'cart'. However, this same code does not work any longer as the session structure is much different. I could try and recreate the session but there are lots of values, and I cannot determine what the bare mininium is.

Ideally I would like to be able to call an existing "Add to cart" method from the Virtuemart classes, but am unsure how to do this. Presumably I would need to include a series of Joomla and Virtuemart core files in my standalone code, and then pass a series of values to the add to cart method.

I would be really grateful if anyone could help here - perhaps you have already achieved this and know what code to use.

I look forward to your replies.

Regards

James
Title: Re: HELP:Manually Add to Cart using standalone PHP code in Joomla
Post by: jenkinhill on October 12, 2012, 18:05:32 PM
In a Joomla article you can use this: http://forum.virtuemart.net/index.php?topic=94539.msg337937#msg337937

or this:  http://forum.virtuemart.net/index.php?topic=108108.0
Title: Re: HELP:Manually Add to Cart using standalone PHP code in Joomla
Post by: MarianneBC on November 27, 2012, 00:30:46 AM
Thank you both!
Title: Re: HELP:Manually Add to Cart using standalone PHP code in Joomla
Post by: bytelord on November 27, 2012, 00:47:42 AM
or this: http://forum.virtuemart.net/index.php?topic=110368.0