Aminesrine
Aminesrine

Reputation: 2140

Prestashop: Add products to a new cart

This is not a general problem, but I hope someone has encountered this issue!!

I have a prestashop website, and now I'm creating a mobile version of this site, using phonegap.

I connect to the site data base via the prestashop webservice.

I can add a new cart, but this cart is empty and It doesn't belong to the customer who have added a product to his cart.

I have expected to use an url like this:

http://monsite/Create_carts.php?id_product=..&quantity=..&id_customer=..

but there is not an id_product or an id_customer attribute in the cart object.

My question is how to add products to a cart and make it belong to the logged customer?

Upvotes: 11

Views: 3835

Answers (1)

Erik Johansson
Erik Johansson

Reputation: 9

You have an order object which links to a cart object and a customer object. There is also a cart_product object which links to a product and a cart.
Database structure:

customer -> order -> cart -> cart_object.

That is how it is in the database, I have no idea how to use the API to do that as I'm searching for that myself...
It usually seems to be that you get a blank schema, populate it with the correct data and then send it in to add it to the database. You can get the blank schema with something like:

$xml = $webService->get(array('url' => 'http://my_prestashop_shop/api/carts?schema=blank'));

But as I have stated. I cant seem to do this myself. I will come back if I find the answer.

Upvotes: -1

Related Questions