Author Topic: Get the raw URL code to 'add product to cart' for external use  (Read 3055 times)

invent

  • Beginner
  • *
  • Posts: 1
I want to add a link to one of my products on an external website.  However, I don't want the link to go to the product flypage, I just want it to directly add the item to the cart and go straight to the checkout pages.

It looks like the 'add to cart' button on the flypage is posting data to the index.php but I can't figure out how it is working in order to get a raw URL I can just throw into a browser to do that.

Any suggestions?

koaconsulting

  • Beginner
  • *
  • Posts: 4
    • Website Design, Development, and Internet Marketing Solutions
Re: Get the raw URL code to 'add product to cart' for external use
« Reply #1 on: August 18, 2009, 16:43:56 PM »
It took a little tweaking but I found a way just using a URL if it would still be helpful.  You just need to create the URL variables that are required like so:

http://www.domain.com/index.php?page=shop.cart&option=com_virtuemart&Itemid=1&func=cartAdd&product_id=XXXPRODUCT_IDXXX&FormatXXXPRODUCT_IDXXX=XXXFORMAT_NAMEXXX&quantity[]=1

The only "tricky" parts are to replace the "XXXPRODUCT_IDXXX" part with the actual number of your product for BOTH the product_id variable AND the "Format" variable (you can see what your format is by viewing the source of a product and seeing what the exact code is).

Hope this helps, it seems a few people were looking for this so hopefully they find this too.
KOA Consulting is dedicated to providing high quality, professional website design, development, graphic design, Internet marketing, search engine optimization (SEO), and a variety of cutting edge web technologies to our ever-growing client-base. Our long list of satisfied clients extends across the globe.

We specialize in working with the Joomla Content Management System and custom integration of Virtuemart as well. 

Please contact us for all of your custom web design and development needs: www.koaconsulting.com

pulsr

  • Beginner
  • *
  • Posts: 8
Re: Get the raw URL code to 'add product to cart' for external use
« Reply #2 on: September 09, 2009, 18:45:13 PM »
i have a flex app that the customer can customize their product then they can  click the add to cart button to take them to the cart (using the variable posted by koaconsulting) the flex app also uploads a pdf snapshot of there file to the server is there away to add the filename of the pdf to a field in virtuemart?



VC22

  • Beginner
  • *
  • Posts: 8
Re: Get the raw URL code to 'add product to cart' for external use
« Reply #4 on: February 20, 2012, 23:40:11 PM »
Hi,

I can make this work if there are no attributes, let's say:

http://www.domain.com/index.php?page=shop.cart&option=com_virtuemart&Itemid=1&func=cartAdd&product_id=77&quantity[]=1
(for product with id=77 and no attributes). But with attributes i just can't make it work?!
Let's say I have an atribute named "Size" with "S", "M" and "L" values, what would the URL be to chose product with ID 77 in size M ?

I'm not understanding what to place instead of "FormatXXXPRODUCT_IDXXX=XXXFORMAT_NAMEXXX"

Hope you can help as this will really make a diference to me (and yes, you'll get 50% discount at my online store for an item of your choice ;)

VirtueMart Forum

Re: Get the raw URL code to 'add product to cart' for external use
« Reply #4 on: February 20, 2012, 23:40:11 PM »