Vote up!
Vote down!

Quickest way to add something to cart with AJAX call, understanding database

Hi commerce guys!

I am looking for an ajax solution for making simple and fast calls for adding, removing line items and updating user's cart. Now I have everything working, but my ajax callbacks are using fully bootstrapped Drupal + all commerce API stuff, so it's really slow. I can't beat 600ms response time on my localhost (it's a really good notebook). So I started to investigate other ways, but everything I found now, that items in the cart are stored in the commerce_line_items table. I can change that data, and I see the result, but I can't add rows to it (nothing changes).
At the very end of the process I want to have a module with this simple ajax callbacks based on JS module (https://drupal.org/project/js):

  • add item to cart by ID or line item number
  • change item quantity by ID or line item number (already can be done)
  • remove item from cart
  • empty cart

I will be glad to share final solution with others.

I am partly replying to myself. I found changes with mysqldbcompare for adding an item to cart. Not all fields are clean for me, so I am asking for help.


Can someone comment that out? Please, dear developers!

Asked by: whitewind
on November 5, 2013

1 Answer

Vote up!
Vote down!

Did you get the solutions for the same.

Answer by: Rajesh Kumar
Posted: Apr 6, 2015