VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: cygan89 on July 28, 2017, 09:17:19 AM

Title: Add to cart from search list - first item not working
Post by: cygan89 on July 28, 2017, 09:17:19 AM
Jooomla: 3.5.1
VM: 3.0.16
Example of problem: https://ccy.pl/pl/sobd2/search?keyword=lpg&x=0&y=0&limitstart=0&option=com_virtuemart&view=category&virtuemart_category_id=0

Description:
For first item firm list when i press add to cart website just going to the cart but not adding any item.
For 2nd and next items everything is ok...

I checked updates joomla and vm on the clone website and nothing.
Title: Re: Add to cart from search list - first item not working
Post by: Studio 42 on July 28, 2017, 16:38:35 PM
Your <form> need ot have class="product js-recalculate" but the firs item have no class set.
Probably it comes from a module ?
Eg. valid <form method="post" class="product js-recalculate" action="#"></form>
Title: Re: Add to cart from search list - first item not working
Post by: cygan89 on August 02, 2017, 09:18:30 AM
Hello,
Thanks for answer, probably you are right but i found file addtocart.php in components/com-virtuemart/sublayouts/addtocart.php and look like correct:
https://pastebin.com/uQnvKcRV

I have no idea why first item dont have this class, any ideas?
Title: Re: Add to cart from search list - first item not working
Post by: Studio 42 on August 03, 2017, 12:15:36 PM
I checked today and it work now.
Title: Re: Add to cart from search list - first item not working
Post by: cygan89 on August 09, 2017, 14:46:18 PM
Yes but i dont know reason... my solution is:

templates/ZZZZZ/html/com_virtuemart/sublayouts/products.php

echo "<div style='display: none;'>" . shopFunctionsF::renderVmSubLayout('addtocart',array('product'=>$product,'row'=>0))."</div>";   
echo shopFunctionsF::renderVmSubLayout('addtocart',array('product'=>$product,'row'=>0));   

its very stupid solution but o cant find better