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
Ahhhh was just missing this part: &quantity[]=1
:-)
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
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
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
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
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)
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.
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
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.
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
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.
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......
Hi, this seems to work in VM1.X and Vm2.0, is it possible to add multiple products at once via url?
Hi to everybody and special thanks to solwinfotech for the form. It works fine and the product is added to the cart.
Do you know how to set a custom field value via this form? I tried to analyze original vm add-to-cart form and i get something like this:
<input class="vmcustom-textinput" type="text" name="customPlugin[19][textinput][comment]" size="64" value="">
I've tried to put the same field into my form but it simply doesn't work... As you can see this is a simple text input field where the customer should write his name. It should be easy to set but the cart function just ignore it.
Thanks in advance!
This is a great code. Thanks for posting it.
I'd like to have the 'Add to Cart' button open a lightbox rather than go to the cart page in full. Any suggestions how I could tweak the code to do this?
Thanks,
-Andy
I was directed to this thread, which solved my problem with the first 2 posts.
I have another question similar to these.
How can I incorporate a quantity selector and use a homemade "Buy now" link to add 1, 5, 20, 2043943, etc... items to the cart? (not those specific numbers, any quantity)
Quote from: Andyfoo on November 01, 2012, 17:28:09 PM
This is a great code. Thanks for posting it.
I'd like to have the 'Add to Cart' button open a lightbox rather than go to the cart page in full. Any suggestions how I could tweak the code to do this?
Thanks,
-Andy
I also would like to echo this, as I find this to be more user friendly
Hi, i found this post very helpful, however, i also need a text link to remove a product from the cart. Does anyone know if this is possible?
Thanks,
Sean
Quote from: idlepress on November 15, 2012, 21:00:47 PM
Quote from: Andyfoo on November 01, 2012, 17:28:09 PM
This is a great code. Thanks for posting it.
I'd like to have the 'Add to Cart' button open a lightbox rather than go to the cart page in full. Any suggestions how I could tweak the code to do this?
Thanks,
-Andy
I also would like to echo this, as I find this to be more user friendly
Yes this is possible by using facebox jquery in your code. You need make little hack in core code. Make a caal of the cart url on click event of "Add to Cart" button.
IN product detail page you can make the change like this.
$document->addScriptDeclaration("
jQuery(document).ready(function($) {
$('addtocart-button').click( function(){
$.facebox({
iframe: 'index.php?option=com_virtuemart&view=cart',
rev: 'iframe|550|550'
});
return false ;
});
});
");
Try this code
http://shoeg.in (http://shoeg.in), http://maxartkiller.in (http://maxartkiller.in)
This may be of interest for people wanting to add with dropdowns and text input fields.
http://forum.virtuemart.net/index.php?topic=110001.msg368586#msg368586
Quote from: solwininfotech on April 26, 2012, 08:09:36 AM
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
AMAZING. MANY MANY Thanks
If you want a custom field to also get added, then add this:
<input type="hidden" name="customPrice[0][27]" value="784" />
You'll need to look at the source to see the custom field name (I used one I had in the example) and change the value to each of your fields.
It's super cool to be able to add products this way! I'm using it for offering gift wrapping and shipping insurance on the checkout-page... Really nice but I wonder how I properly can echo the price of this product? Let's say I'm adding this code to default_pricelist.php :
<a href="index.php?option=com_virtuemart&view=cart&task=add&virtuemart_product_id[]=1799&virtuemart_category_id[]=136&quantity[]=1">
Would you like to add gift wrapping to your order?
</A>
I want to add the price after the string of text, like this :
Would you like to add gift wrapping to your order? Fee: <?php echo "the base price of product ID 1799 here" ?>
I hope you understand what I mean hehe. I'm using so many currencies and sell internationally so just putting the price as raw html wouldn't be so elegant...
Truly grateful if anyone with more php-knowledge than me wanted to help out, hopefully other newbies can be helped as well :)
Thanks!
Best wishes
Peter