View Single Post
  #1  
Old 10-10-2017, 02:14 PM
 
ogrimany ogrimany is offline
    
Join Date: Aug 2017
Posts: 1
 

Default Add 2 Cart Product Variants Error

Hello everyone,

Working with x-cart 4.7.7.

I've been having trouble implementing a solution that allows the customer to add product variants to their cart from the product list page without the page reloading. I've enabled the Buy Now buttons in the admin. The problem I'm running into is that I've placed the {include_cache file="customer/main/buy_now.tpl" in a smarty foreach loop so that a button gets created for each variant there is. And it works, but only on the first variant you add to the cart, after that the variables from the foreach loop like the classid and the optionid disappear so when you attempt to add more variants to the cart it causes an error and it redirects you to the product page. The $products variable is still available though, and when I reload the page the foreach loop variables come back.

Can anyone tell me what is happening and how I can fix it?

Thanks.
__________________
Orlando Grimany
Web Developer
ogrimany@gmail.com
Reply With Quote