News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Add to Cart button

Started by yan77, April 09, 2022, 21:24:39 PM

Previous topic - Next topic

yan77

Hello, I am not sure if this is a Joomla thing or Virtuemart, but I need to add "add to cart" button on some pages independent from the store, under the product pictures, so when someone clicks on it, basically adds the product to cart without being re-directed to "add to cart" page. Can someone help me how to do this? I have been searching for this on the internet, but could not find something useful to address this issue. Thanks

GJC Web Design

#1
create a button/link with these parameters

yoursite/index.php?option=com_virtuemart&view=cart&task=add&quantity[]=5&virtuemart_product_id[]=22&quantity[]=2&virtuemart_product_id[]=55

example will add 5 x product id 22  & 2 x pid 55

****** edited virtu to virtue
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

pinochico

Or you can use our addtocartlink plugin.
Thanks to it, you can Add to the cart and even on a website where VirtueMart is not installed
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

yan77

Hello, thank a lot for your answer. I could not find this plugin on the site, do you have a link that you can share with me?

yan77

I also tried to create a button & link with the below paths, but none is working, not sure if I am making a mistake somewhere or something is not working on my template;

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

/?index.php&optionvirtumart&view=cart&task=add&quantity[]=5&virtuemart_product_id[]=2021&quantity[]=2&virtuemart_product_id[]=2025

index.php&optionvirtumart&view=cart&task=add&quantity[]=5&virtuemart_product_id[]=2021

http://www.mysite.com/?index.php&optionvirtumart&view=cart&task=add&quantity[]=5&virtuemart_product_id[]=2026&quantity[]=2&virtuemart_product_id[]=2021

www.mysite.com/?index.php&optionvirtumart&view=cart&task=add&quantity[]=1&virtuemart_product_id[]=2021

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

pinochico

#5
This plugin is completely new (we added to customer shop last week) and not in eshop yet (I need create translate and Box and article on there).
I think in next week I will to add shop www.minijoomla.org

But you can try on this domain: https://www.zelenazeme.cz or you can add to your website as button link with example this URL:

https://www.zelenazeme.cz/?product_id=112&option=com_virtuemart&view=cart&quantity=2&addtocartlink=1
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

Studio 42

yan77.
When you want help please give your Virtuemart version.
index.php?page=shop.cart&option=com_virtuemart&Itemid=1&func=cartAdd&product_id=2025&quantity[]=1 is for Vm 1
index.php?option=com_virtuemart&view=cart&task=add&virtuemart_product_id[]=2021&quantity[]=2 is for Vm 2+
If it not work then try using the full link
https://YOURSITE/index.php?option=com_virtuemart&view=cart&task=add&virtuemart_product_id[]=2021&quantity[]=2


yan77

Hi again, thanks again for the info. Can you please notify me when it is available to the shop with its link?

As far as the link, somehow these links do not work on my site, the only thing I need to do is to replace the url with my site and change the product ID, in my case I am trying a product with the ID number of 2021;

https://www.mysite.com/?product_id=2021&option=com_virtuemart&view=cart&quantity=2&addtocartlink=1

This link juts takes to an empty cart page, but not adding the product 2021 when it is clicked. Am I missing anything here or you think my site has some underlying issue that is preventing these links from working?

yan77

Hi Studio 42,
Thank you for the reply, and a good point, I am using Virtue Mart 3.8.8, however neither the full link nor the previous one does work on my side. I checked and tried with multiple different product IDs, the only thing is happening is that this link takes me to a product page to add to cart as supposed to be adding that particular product directly on the cart. Any other idea why these links may not be working on my site?

GJC Web Design

#9
have just tested on a clean VM3.8.8 with  https://yoursite.com/index.php?option=com_virtuemart&view=cart&task=add&quantity[]=1&virtuemart_product_id[]=2070 and the this lands u on the cart page with 1 x product id 2070 added

there was a spelling mistake on my example but this will definitely work on a VM3 site as long as the product exists, is published and has enough stock
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

pinochico

To GJC, Patrick:

Thanks for your info and old basic idea (https://forum.virtuemart.net/index.php?topic=145261.msg515765#msg515765)
We are finished with plugin last week and now is installed and function on 8 shops our customer - he is very lucky :)
https://www.minijoomla.org/extensions/virtuemart-extensions/add-to-cart-link-for-virtuemart

There we need more info about shop for find right solution I think, because in standard installation call URL must be ok.
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

jenkinhill

@GJC should that not be 
https://yoursite.com/index.php?option=com_virtuemart&view=cart&task=add&quantity[]=1&virtuemart_product_id[]=2070

That works for me.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

GJC Web Design

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

Jumbo!

For multiple products use it like this -

https://yoursite.com/index.php?option=com_virtuemart&view=cart&task=add&virtuemart_product_id[0]=2070&quantity[0]=1&virtuemart_product_id[1]=2071&quantity[1]=1

Basically, just define the keys of the array.