X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing and adding new features (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Add 2 Cart Product Variants Error (https://forum.x-cart.com/showthread.php?t=75712)

ogrimany 10-10-2017 02:14 PM

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.

ogrimany 10-10-2017 02:22 PM

Add 2 Cart Product Variants Error
 
Hello everyone,

Working with X-Cart 4.7.7.

I'm trying to implement a solution that allows customers to add product variants directly from the product list page. I've enabled Buy Now in the product list page and I put the {include_cache file="customer/main/buy_now.tpl" line in a smarty foreach loop so that it creates a buy now button for each product variant. When ajax finishes it's like the variables in the foreach loop disappear and I get an error when I try to add more of that variant to the cart. Can anyone tell me what's happening and what I can do to fix it?

Thanks.

qualiteam 10-15-2017 09:45 PM

Re: Add 2 Cart Product Variants Error
 
It's hard to guess without more details. From what you describe it sounds as X-Cart loads a different template file when doing the ajax request, that's why your custom code is replaced with something else.


All times are GMT -8. The time now is 12:48 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.