News:

Support the VirtueMart project and become a member

Main Menu

Add to Cart Linking

Started by sortlarz, July 18, 2017, 23:47:03 PM

Previous topic - Next topic

sortlarz

Hello !

I am currently using v3.2.2 on Joomla 3.7.3.

I am using VM only for check out as i've got a different way of displaying products. I need to use a custom add to cart link.

I found and used this

/index.php?option=com_virtuemart&view=cart&task=add&virtuemart_product_id=6&virtuemart_category_id=8&quantity=1

This one , links me to the cart but it wont really add my product.

Please help  ???

K&K media production

product id must be an array:  virtuemart_product_id[]=6

/index.php?option=com_virtuemart&view=cart&task=add&virtuemart_product_id[]=6&virtuemart_category_id=8&quantity=1

Milbo

the quantity also, you can even add more than one product at once.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

loppan

What is the "syntax" for adding more than one products in the same URL? Also, does this work with child products?

Optic

Hey

Maybe someone could please give me advise how I can add some custom fields with predefined values in the URL?
The URL, provided here looks really good and it works, but my article has custom fields, which must be filled as well.
Please tell me how to change the URL, so it will accept custom fields with values

I tried the following:
/index.php?option=com_virtuemart&view=cart&task=add&virtuemart_product_id[]=177&virtuemart_custom_id=39[]-1.0&quantity=1
Where the custom_id=39 is the used custom field and the -1.0 should be the value of this field.
But it isn't working

THX in advance!

sirius

Hi,
the get request for custom field is more like this for example:
&customProductData[2265][6]=7514&customProductData[2265][25]=7515&quantity[]=1&virtuemart_product_id[]=2265

[2265] => product ID
[6] => the ID of the custom option in the #__virtuemart_customs table
7514 => the ID of the customfield stored for this product id in #__virtuemart_product_customfields table

But so the custom field must exist first

Hope it help a little bit
J3.10.12 | PHP 7.4.33 + APC + memcached + Opcode
VM Prod : 3.8.6 | VM Test : 4.0.12.10777

Optic

Hey

Sorry for the late reply!
Your suggestion works almost brilliant, after a couple of tests

One last question:
How to add multiple products in that style? - Do I have to call one url after the other, or is there a way to combine them in one URL?

THX a lot in advance

GJC Web Design

index.php&optionvirtuemart&view=cart&task=add&quantity[]=5&virtuemart_product_id[]=22&quantity[]=2&virtuemart_product_id[]=55
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Optic

Hey
THX - but this I tried and is not working
When I add an article with this url, it works:
index.php?option=com_virtuemart&view=cart&task=add&customProductData[175][44][119]=14.00&customProductData[175][45][118]=8&customProductData[175][43][117]=1&quantity[]=1&virtuemart_product_id[]=175

But when I combine (same article, with different custom product data), it just adds the last article, but not both:
index.php?option=com_virtuemart&view=cart&task=add&customProductData[175][44][119]=14.00&customProductData[175][45][118]=8&customProductData[175][43][117]=1.00&quantity[]=1&virtuemart_product_id[]=175&customProductData[175][44][119]=14.00&customProductData[175][45][118]=8&customProductData[175][43][117]=4.00&quantity[]=1&virtuemart_product_id[]=175

THX