Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Add 2 Cart Product Variants Error

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #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
  #2  
Old 10-10-2017, 02:22 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'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.
__________________
Orlando Grimany
Web Developer
ogrimany@gmail.com
Reply With Quote
  #3  
Old 10-15-2017, 09:45 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default 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.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 04:12 PM.

   

 
X-Cart forums © 2001-2020