Info
I'm quite new to Magento and now I've to develop an external service (C# web service), which needs to add a product to a customers cart (using the SOAPv2 call shoppingCartProductAdd
). The only information I got is the encrypted customer session id and the quote id (if the customer has already a cart).
Problem
If I've the qoute id (cart id), everything works just fine. Without the qoute id the product can't be added of course.
Question(s)
Is it possible to create a cart for a session? Yes I've already seen the method shoppingCartCreate
, but this will only create a cart and doesn't connect it with the customer session. Is there a method for connecting the a cart with a session?
Best Answer
The Magento SOAP API is a web-service and is meant for data exchange with external systems such as ERP, accounting, etc. You can create orders via SOAP-API in your shop which you will see afterwards in the customers account as well as in the shop admin-interface.
You are trying to fill a customers shopping cart with products from the SOAP API which is not a standard function.
I've never set it up like this, but what you need to do to achieve your goal is, to create a connection between your visitors/customers session in the browser and the shopping cart.
Depending on your intended usage you'll need to access the visitors', customers' and checkout session:
Get the visitor session:
Get the customer session:
Get the checkout session:
Set customers session to checkout session:
Whatever you do: Be careful with setting, storing,... the session-id via URL and cookies. This can be a potentical security issue.