Magento SOAP API和PHP:一项产品没有标识符或sku

Good Day, need help on this scenario. We have a client who has a Magento ver 1.9 system which I don't have access. They have asked us to create a mobile app and we are using as PHP Laravel 5.1 as a proxy rest api to call Magento's SOAP API V2. One of the services was to add a product to the cart. I've used this reference http://www.magentocommerce.com/api/soap/checkout/cartProduct/cart_product.add.html but unfortunately when I call the service I'm getting this error

"One item of products do not have identifier or sku"

Here is the snippet of the php code:

$data = array_add($data, 'product_id', $request->json('product_id'));
$data = array_add($data, 'sku', $request->json('sku'));
$data = array_add($data, 'qty', $request->json('qty'));
$data = array_add($data, 'options', $request->json('options'));
$data = array_add($data, 'bundleOption', $request->json('bundleOption'));
$data = array_add($data, 'bundleOptionQty', $request->json('bundleOptionQty'));
$data = array_add($data, 'links', $request->json('links'));

try {
    $result = $client->shoppingCartProductAdd($sessionId,$cartId,$data);

    if ($result) {
        return $this->respond([
            'message' => 'Product Successfully added to Cart.'
        ]);
    }

} catch (SoapFault $e) {
    $message = $e->getMessage();
    return $this->respondInternalError($message);
}

Here is the Json request

{"product_id":"13","sku":"Warm-Welcome-Coat","qty":"5","options":"","bundleOption":"","bundleOptionQty":"","links":""}

I'm sure that the product is existing as I used the api to call the product list. I've tried this solution -> Magento SOAP API v2 shoppingCartProductAdd error “One item of products do not have identifier or sku” but it is not working for me.

查看全部
dongnunai3125
dongnunai3125
2015/11/28 05:44
  • php
  • api
  • soap
  • magento
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

1个回复