I'm using the Webservice API Version 2 of Magento via Soap. I've used gSoap to generate Wrapper/Proxy-Classes for the Soap-Calls and so far, everything works fine. I can
- retrieve products in shop
- retrieve customer by ID
- do login/logout
and I'm able to get all the information I need in my Desktop-Application.
What I want to do now is: I have a shopping site in my Desktop-Application, where the user can select products (which means, add them to the shopping-cart) and confirm his selection by clicking on a button, e.g. 'buy'. By clicking on this button, he will be redirected to the Webshop in the Browser and now there should be (probably after authentification) his shopping cart with all the products in it he selected in the Desktop Application.
So, what I tried to do is
(don't be concerned with the ugly class -and method-names ;o) )
Generate a new Shopping Cart:
void SoapManager::createShoppingCart()
{
ns1__shoppingCartCreateResponse shoppingCartCreation;
int x = m_pProxy->shoppingCartCreate(m_stLoginID, "1", shoppingCartCreation);
if(x!=0)
printFaultDetails(m_pProxy->fault);
m_currentShoppingCart = shoppingCartCreation;
}
Set an existing customer to the created shopping cart:
void SoapManager::setCustomerToCart(ns1__shoppingCartCustomerEntity *customer)
{
ns1__shoppingCartCustomerSetResponse customerResponse;
int x = m_pProxy->shoppingCartCustomerSet(m_stLoginID, m_currentShoppingCart.quoteId, customer, "1", customerResponse);
if(x!=0 || !customerResponse.result)
printFaultDetails(m_pProxy->fault);
}
Add a simple (example) product to the cart:
void SoapManager::addProductToCurrentCart(shoppingCartProductEntityArray *productsToAdd)
{
ns1__shoppingCartProductAddResponse productAdded;
int x = m_pProxy->shoppingCartProductAdd(m_stLoginID, m_currentShoppingCart.quoteId, productsToAdd, "1", productAdded);
if(x!=0 || !productAdded.result)
printFaultDetails(m_pProxy->fault);
}
In general, that's all. What i would expect is that the product is attached to shopping cart of the customer, which was set to the cart. But after Redirection to the Webshop there is no product in the Cart, neither a shopping Cart in the admin panel.
When I retrieve the shopping cart programmatically by using the quote ID, there are all added products in it so I think, it's probably an understanding mistake of mine.
Any suggestions, what I'm doing wrong?
Or is adding a product to the (webshop-)shopping cart only possible using the query string? (And if so: How to add several products?)
Best regards and thanks in advance!
Jan