Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用magento api中的产品id在购物车中添加可配置产品_Magento - Fatal编程技术网

如何使用magento api中的产品id在购物车中添加可配置产品

如何使用magento api中的产品id在购物车中添加可配置产品,magento,Magento,我已经为我的应用程序创建了Web服务,但问题id我无法在购物车中添加可配置的产品。请查找我的代码。如有任何帮助,将不胜感激 $customer_id='id_of_customer' $cart_id = 'cart_id'; $quantity = 'quantity'; $store_id = 1; if ($cart_id != '' AND $customer_id != '') { $arrProducts = array(array(

我已经为我的应用程序创建了Web服务,但问题id我无法在购物车中添加可配置的产品。请查找我的代码。如有任何帮助,将不胜感激

$customer_id='id_of_customer'

$cart_id = 'cart_id';        
$quantity = 'quantity';
$store_id = 1;
if ($cart_id != '' AND $customer_id != '') {        

    $arrProducts = array(array(
            "product_id" => '1887',
            "sku" => 'sku_of_product',
            "super_attribute" => array(151 => 3),
            "qty" => 2,
    ));

    $result = $proxy->shoppingCartProductAdd($sessionId, $cart_id, $arrProducts);
但我收到错误,请指定产品选项。

请使用以下代码:

$product = array(
            'product_id' => 19,   // config product id
            'sku' => 'H001',
            'qty' => '1',

           'super_attribute' => array(
                0 => array(
                'key' => 92,        //attribute id
                'value' => 10       //value
                ),
                1 => array(
                'key' => 134,
                'value' => 3
                )
            )
        );  

$result = $proxy->shoppingCartProductAdd($session,$cartId, array($product));