X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   Custom add to cart with ajax (https://forum.x-cart.com/showthread.php?t=76512)

lakin1 09-05-2018 11:26 AM

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

qualiteam 09-05-2018 12:52 PM

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/

lakin1 09-05-2018 10:15 PM

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.

tony_sologubov 09-07-2018 03:03 AM

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.


lakin1 09-07-2018 03:46 AM

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.

tony_sologubov 09-14-2018 05:53 AM

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.



All times are GMT -8. The time now is 07:24 PM.

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