Api For Shopping Cart

Hi.

Googling isn't returning much.

I am developing a vue.js frontend for our website and I am starting to think that I should be leveraging the API a little more, rather than passing data through from my controllers into the TPL files and then onto my vue.js components.

The only entity that I can't see in the API docs is the shopping cart. It would be beneficial to be able to retrieve this via the API.

By retrieving the shopping cart, I am talking about the shopping cart for the current session, rather than retrieving abandoned or specific user carts.

I noticed in the CS-CART code they they are effectively locking this off from the API. Would there be any reason for this? I am not sure I really see the issue with being able to retrieve your own cart attached to the current session.

Has anyone looked at this already?

Cheers.

Hmm, not sure this is going to work.

Not sure I am going to have access to the cart from the api.php file (easily - without duplicating core code).

Happy to take hints here if anyone has done this :)

We have a simple website (products are not complicated), so I don't need a great deal of API access. But if I can get API access to retrieve and modify users shopping cart, then I will be able to have my vue.js frontend deal with CS-CART via AJAX... I will still soldier on and see how it goes

Turns out the "NO_SESSION" in api.php gets in the way of this being possible.

And I guess that makes sense when you are considering it is a REST API.

Its a bummer though, as I think something like this would be handy to retrieve via an AJAX call.

Hi Nate, did you have any luck getting API access to the cart? We're working on a similar integration at the moment - using a web app for a front-end vendor store which then connects with the main CS-Cart store for checkout. Were you able to find a solution?

Thank you

Joel.

Hi,

I didn't get any further than this and ended up just building my own theme, which was an interesting experience too! But this gave me complete control over how our site looks and could tailor a checkout experience specific to our business.

Wow, can't believe its almost 18 months since I last posted this. Upon re-reading it, I think there would be a bit of work involved by CS-CART team to allow session based carts via the API... and based on my understanding, I don't think it would be possible without modifying core code OR extending the API and adding your own schemas... just spit balling here...

The other issue I see with this is that your web app would be at the mercy of the API and that might not be good for future support in your application if a part of the API was no longer accessible... which again would suggest that you would need to write some code to make sure it was supported...

Leave it with you - let me know how you go...