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:
$session = Mage::getSingleton('core/session');
Get the customer session:
$session = Mage::getSingleton('customer/session');
Get the checkout session:
$session = Mage::getSingleton('checkout/session');
Set customers session to checkout session:
Mage::getSingleton('checkout/session')
->setCustomer(Mage::getSingleton('customer/session')->getCustomer());
Whatever you do: Be careful with setting, storing,... the session-id via URL and cookies.
This can be a potentical security issue.
You need to add the form key to the cart add link:
<?php
$formKey = Mage::getSingleton('core/session')->getFormKey();?>
<form action="/checkout/cart/add/product/<?php echo $productid; ?>" method="post">
<input type="hidden" name="form_key" value="<?php echo $formKey; ?>" />
<input type="text" name="qty"> QTY
<input type="submit" value="Add to basket" />
</form>
Resource:
https://stackoverflow.com/a/19999360/582138
Best Answer
You are seeing cart sharing because your stores are under the same domain. You need to set
system->config->web->session validation settings->use sid on frontend
tono
if you have a store switcher and then have your store running under different domains/subdomains. Thefrontend
cookie contains the session id for the current session and as this and the session data are not accessible in domains other than that which they were created the session id will be unique to each store and so you will not have cart sharing anymore. Bear in mind however that a cookie set for domaintestsite.com
will be accessible in all subdomains i.e.store1.testsite.com
andstore2.testsite.com
.