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

Custom add to cart with ajax

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 09-05-2018, 11:26 AM
 
lakin1 lakin1 is offline
 

Member
  
Join Date: Feb 2018
Posts: 12
 

Default Custom add to cart with ajax

Hi ,
I want to know how to add a custom add to cart button with ajax form submission inside xcart custom odule development.
Please let me know.

Thanks.
xcart - 5.3.5.5
__________________
xcart 4.7
Reply With Quote
  #2  
Old 09-05-2018, 12:52 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

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

Default Re: Custom add to cart with ajax

You should try looking for examples in the existing code of X-Cart, I'm sure it has some. Then just copypaste the examples.
Also, this might help.

* https://devs.x-cart.com/
__________________
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
  #3  
Old 09-05-2018, 10:15 PM
 
lakin1 lakin1 is offline
 

Member
  
Join Date: Feb 2018
Posts: 12
 

Default Re: Custom add to cart with ajax

Quote:
Originally Posted by qualiteam
You should try looking for examples in the existing code of X-Cart, I'm sure it has some. Then just copypaste the examples.
Also, this might help.

* https://devs.x-cart.com/

Hi ,
I am following this tutorial. https://devs.x-cart.com/customization_examples/inserting_an_x-cart_'add_to_cart'_button_in_a_new_page.html
I placed a form and js.
But it seems like some default xcart js is conflicting due to which form is submitted twice.

please advise.
__________________
xcart 4.7
Reply With Quote
  #4  
Old 09-07-2018, 03:03 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: Custom add to cart with ajax

Hi @lakin1,

Could you please let me know what page you are putting this 'Add to cart' button on?

Thank you.

Tony

Quote:
Originally Posted by lakin1
Hi ,
I am following this tutorial. https://devs.x-cart.com/customization_examples/inserting_an_x-cart_'add_to_cart'_button_in_a_new_page.html
I placed a form and js.
But it seems like some default xcart js is conflicting due to which form is submitted twice.

please advise.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #5  
Old 09-07-2018, 03:46 AM
 
lakin1 lakin1 is offline
 

Member
  
Join Date: Feb 2018
Posts: 12
 

Default Re: Custom add to cart with ajax

Quote:
Originally Posted by tony_sologubov
Hi @lakin1,

Could you please let me know what page you are putting this 'Add to cart' button on?

Thank you.

Tony

Hi Tony,
I am trying to show product variants in product details page in tabular format.
And each table row will contain one add to cart button with its own quantity.
Also we have our own stock management system etc.

Hope it helps.
__________________
xcart 4.7
Reply With Quote
  #6  
Old 09-14-2018, 05:53 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: Custom add to cart with ajax

Hi @lakin1,

I assume you use the 2nd method described here:
https://devs.x-cart.com/customization_examples/inserting_an_x-cart_'add_to_cart'_button_in_a_new_page.html

If so, the problem might be that the submit event is triggered for each the 'form.custom-add2cart' form.

Code:
$('form.custom-add2cart').each(function () { ... }

You may need to adjust this JS code and submit only particular form instead of all of them.

Let me know if it helps.

Tony

Quote:
Originally Posted by lakin1
Hi Tony,
I am trying to show product variants in product details page in tabular format.
And each table row will contain one add to cart button with its own quantity.
Also we have our own stock management system etc.

Hope it helps.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may 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 10:03 PM.

   

 
X-Cart forums © 2001-2020