News:

Support the VirtueMart project and become a member

Main Menu

Add product to cart via homemade link?

Started by Sunburst WebConsult, December 07, 2011, 09:05:48 AM

Previous topic - Next topic

Sunburst WebConsult

Hi

Does anyone know how to do a add product via a link (GET submit)?

I want to have a link like this:
index.php?option=com_virtuemart&view=cart&task=add&virtuemart_product_id[]=9&virtuemart_category_id[]=1

And when people click on it the product is added to the cart. How is this done in the new version 2? I had no problems doing it in version 1.1.

Kind regards,
Jens

Sunburst WebConsult

Ahhhh was just missing this part: &quantity[]=1

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

GuillaumeHullin

#3
Thanks a lot!!!
It's exactly what is needed in order to put a add to cart button inside a Joomla article  :D :D :D
"Stay Hungry, Stay Foolish" — Steve Jobs

VC22

Great :)
I'l have to develop my shop (still in VM 1.1) and this is one of the things I'll need.
To be perfect i just would need to figure out how to specify Attributes as most off my products have Size and/or Color
- I'm talking about a product with simple (sometimes called advanced?!) attributes (no child items etc... though i might use them as well in the future).

If you could give me a simple example for this (preferably both VM1.1 and VM2.0 it would be GREAT!! (let's say for Color=Red and Size=M  ,this already being defined in the produt of course)

It would be really cool if this could work with Custom attributes as well
(those here the customer can enter is own text, like e.g. a name to print in a T-shirt). Avtually it would be perfect because i have to many prints for each kind of item i sell (like 70! it would not be pratical for people to select) and i don't want one product per print. I'm using a Fabrik table to display all prints in the product card (i can easily update it and it's very powerfull - being database driven), and with Custum attributes i could add link for each image (and size available for that print), not even having to have those prints as pre-defined attributes in VM (one less thing to sync or mess up). They would just be writen acording to link information on the free text "print" custom atribute!

This i believe is a good thing for VM (and surely for me and more merchants), and I believe (hope) the functionality is there, it just needs to be documented/shares (it would be great to putit in the Manual).

I Hope Sunburst or Milbo can Help, I guess you both know a couple of things about VM ;)

Thanks

PS I had this thread ( http://forum.virtuemart.net/index.php?topic=98368.0 ) on this in VM1.1 forum, but no replies an I'm sure Sunburst or Milbo can Help ;)
Will update that thread with you solution of course

VC22

#5
Sunburts, Milbo ?

I hope one of you guys (or someone else) get's to read this and share how to - Help!! it must be simple

write a link that adds products with parameters directly to cart.

I'm guessing it's possible, but if not possible it would be good to know that as well!!

thanks

diegotrigo

#6
Yeah...
I really need this as well..
How to add a product dinamically with custom field (size and color) on VM 2.0.

Let me know asap pleeeeease!!!
Short project deadline

John2400

I find your thread hard to follow ,

But I have set up a shop in version 1 and version 2.0.3 that sell stickers - the customer selects the size of the sticker,number of stickers,  colour and then the customer fills in a text box that is sent to the seller.

A sticker arrives about 1000 of them with the child's full name, patterns and colours. There was no special coding in vm 1 or 2.0.3 to do this .

I also have a shop that sells cakes and the same - the customer can choose an age on the cake or writes the child's name in a text box and the cake arrives ( happy birthday)




vrans99

#8
This is exactly what I need. I've been looking for a solution for days. But...

I am using the link like Sunburst suggested it:
index.php?option=com_virtuemart&view=cart&task=add&virtuemart_product_id[]=1&virtuemart_category_id[]=1&quantity[]=1
I did try also:
index.php?option=com_virtuemart&view=cart&task=add&virtuemart_product_id=1&quantity=1

And nothing seen to work. I am getting directed to the cart (which is what I need), but it is not adding the product.
Am I missing something? Do I need to change any setting within VM?

Using VM 2.0.6 and Joomla 2.5.4.

Please, help.


solwininfotech

Quote from: vrans99 on April 25, 2012, 04:46:13 AM
This is exactly what I need. I've been looking for a solution for days. But...

I am using the link like Sunburst suggested it:
index.php?option=com_virtuemart&view=cart&task=add&virtuemart_product_id[]=1&virtuemart_category_id[]=1&quantity[]=1
I did try also:
index.php?option=com_virtuemart&view=cart&task=add&virtuemart_product_id=1&quantity=1

And nothing seen to work. I am getting directed to the cart (which is what I need), but it is not adding the product.
Am I missing something? Do I need to change any setting within VM?

Using VM 2.0.6 and Joomla 2.5.4.

Please, help.



Try sending this value by hidden variables and also send price and tax if any

vrans99

Thank you for that super quick reply, solwininfotech.

Forgive my lack of knowledge. How can I send hidden variables through URL?

I appreciate your help.

solwininfotech

Quote from: vrans99 on April 25, 2012, 13:08:51 PM
Thank you for that super quick reply, solwininfotech.

Forgive my lack of knowledge. How can I send hidden variables through URL?

I appreciate your help.


I am using vm 2.0.2 and joomla 1.7

I had created one article and in that i put some information in Hidden variables.

I put the below code in "Edit HTML Source"

<form method="post"><span class="addtocart-button"> <input class="addtocart-button" title="Add to Cart" type="submit" name="addtocart" value="Add to Cart" /> </span><input type="hidden" name="quantity[]" value="1" /> <input class="pname" type="hidden" value="Hand Shovel" /> <input type="hidden" name="option" value="com_virtuemart" /> <input type="hidden" name="view" value="cart" /><input type="hidden" name="task" value="add" /><input type="hidden" name="virtuemart_product_id[]" value="1" /> <input type="hidden" name="virtuemart_manufacturer_id" value="1" /> <input type="hidden" name="virtuemart_category_id[]" value="1" /></form>


This is work for me ...

Try and check

vrans99

#12
You are absolutely awesome!!!
It works perfect. Exactly what I needed. I am using VM 2.0.6 and Joomla 2.5.4.

I don't know whats going on with the developers and moderators. They couldn't figure this out. And you got it and looks simple.
I been looking for this solution in hundreds of topics for many days, and nobody had an answer that works.

You are amazing.

Thank you a lot.

SCNR addon by Milbo: The question was how to add a product per GET and not per POST. You can use GET or POST in VM, both is accepted. What the devs did? They wrote it so, that you can use it that way. From my point of view, it is like not knowing how to use the handbreak, there is a nice guy answering how to use the handbreak and you "blame" the constructors. lol. The constructors created it.

solwininfotech

Quote from: vrans99 on April 26, 2012, 15:52:08 PM
You are absolutely awesome!!!
It works perfect. Exactly what I needed. I am using VM 2.0.6 and Joomla 2.5.4.

I don't know whats going on with the developers and moderators. They couldn't figure this out. And you got it and looks simple.
I been looking for this solution in hundreds of topics for many days, and nobody had an answer that works.

You are amazing.

Thank you a lot.


Thanks
and Most welcome......

murdok

#14
Hi, this seems to work in VM1.X and Vm2.0, is it possible to add multiple products at once via url?