VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: Ferran on November 18, 2020, 08:41:01 AM

Title: Can't add to cart child variants in category view
Post by: Ferran on November 18, 2020, 08:41:01 AM

Good morning, I'm trying to make it possible to select a child variant from the category view and add it to the cart without redirecting to the product page. At first I thought it was a problem with my template but with VMBeez3, which is the one used in demo.virtuemart, it still doesn't work. Any ideas?

I would also need it to work on any template.

Demo link : https://www.fitorequip.cat/prova-llista.html

I'm using Virtuemart 3.8.6 and Joomla 3.9.22

Thanks in advance!
Title: Re: Can't add to cart child variants in category view
Post by: Ferran on November 18, 2020, 11:36:46 AM
UPDATE : Now it don't redirect, but no changes in product and no add to cart button....
Title: Re: Can't add to cart child variants in category view
Post by: Jörgen on November 18, 2020, 13:01:26 PM
Strange update, You do not tell us what You have done...

Turn off cache and cache plugins perhaps, check for JS errors in console ?

Jörgen @ Kreativ Fotografi
Title: Re: Can't add to cart child variants in category view
Post by: jenkinhill on November 18, 2020, 15:35:02 PM
I seem to remember that you cannot select a child variant from the category page as in order to add the variant to the cart it has first to be loaded to replace the parent - that cannot be done. The child is therefore loaded in its product details page.
Title: Re: Can't add to cart child variants in category view
Post by: GJC Web Design on November 18, 2020, 17:45:14 PM
correct Jenks, it is a separate product so the dropdown is as u say simply loading the "different" product -- then it can be added.
I have been asked for this functionality a few times  ( load to cart on selecting the variant )  but I think it would only confuse users...
You can add to cart via a link so it may be possible to change the links called by the select but still don't think its a good idea from a functional point of view
Title: Re: Can't add to cart child variants in category view
Post by: pinochico on November 18, 2020, 18:47:12 PM
Yes, this is wrong idea - put child product from parent product to cart on category list.
If you really need then you must find solution self, not from me, sorry bro
Title: Re: Can't add to cart child variants in category view
Post by: Ferran on November 19, 2020, 09:58:58 AM
Sorry, I was out for a few hours after fixing it. What I was looking for was to avoid that when selecting a variant from the category view, I was redirected to the product page, I wanted ajax to load the variant in the category view itself and with the possibility of being added to the cart without changing the URL. As is done at http://demo.virtuemart.net/.

Finally I discovered that it was a problem with the template that shows the products, product_slim and product_horizon, I don't know why but it works with one and not with the other.
Title: Re: Can't add to cart child variants in category view
Post by: GJC Web Design on November 19, 2020, 11:02:57 AM
do u mean this setting?

vmadmin-config->template->Use ajax for category content
Title: Re: Can't add to cart child variants in category view
Post by: Ferran on November 19, 2020, 18:18:51 PM
Quote from: GJC Web Design on November 19, 2020, 11:02:57 AM
do u mean this setting?

vmadmin-config->template->Use ajax for category content

I know this setting, i activated then at first attempt, but with product_slim template it doesn't work for me... With product_horizon yes.