简体   繁体   English

Magento Soap API在购物车中添加具有自定义选项值的产品

[英]Magento soap api add product with custom options value in shopping cart

I am using soap custom api for create and add product in cart. 我正在使用肥皂定制api来创建和添加购物车中的产品。 I have some custom options associated with the product. 我有一些与产品相关的自定义选项。 I have to add a product in cart with custom options. 我必须在购物车中添加带有自定义选项的产品。 I have tried it but it always gives me Error: Please specify the product required option(s). 我已经尝试过,但是它总是给我错误:请指定所需的产品选项。 I have implemented below mentioned two codes for this but both are not working. 我为此在下面实现了两个代码,但是两个代码都不起作用。 在此处输入图片说明

$arrProducts = array( array( "product_id" => "26", "qty" => 2, "sku" => "CHEERCARDS-HAPPY BIRTHDAY-MEOW", "quantity" => 2, "bundle_option" => array( "111" => "toemailid@test.com", "112" => "fromemailid@test.com", "110" => "QR Code", "109" => "Simple message", ), ), ) $ arrProducts = array(array(“ product_id” =>“ 26”,“ qty” => 2,“ sku” =>“ CHEERCARDS-HAPPY BIRTHDAY-MEOW”,“ quantity” => 2,“ bundle_option” => array (“ 111” =>“ toemailid@test.com”,“ 112” =>“ fromemailid@test.com”,“ 110” =>“ QR Code”,“ 109” =>“简单消息”,),) ,)

and

$arrProducts = array( array( "product_id" => "26", "qty" => 1, "sku" => "CHEERCARDS-HAPPY BIRTHDAY-MEOW", "quantity" => 1, 'options' => array ( 0 => array( 'key' => 111, 'value' => '1001' ), 1 => array( 'key' => 112, 'value' => '1001' ), 2 => array( 'key' => 110, 'value' => '1001' ), 3 => array( 'key' => 109, 'value' => '1001' ), ), ), ) $ arrProducts = array(array(“ product_id” =>“ 26”,“ qty” => 1,“ sku” =>“ CHEERCARDS-HAPPY BIRTHDAY-MEOW”,“ quantity” => 1,'options'=>数组(0 => array('key'=> 111,'value'=>'1001'),1 => array('key'=> 112,'value'=>'1001'),2 => array( 'key'=> 110,'value'=>'1001'),3 => array('key'=> 109,'value'=>'1001'),),)

you don't need to to give product id and sku with quantity and qty. 您无需提供带有数量和数量的产品ID和SKU。 just try this code. 只需尝试此代码。

$arrProducts = array( array( "product_id" => "26", "qty" => 2, "bundle_option" => array( "111" => "toemailid@test.com", "112" => "fromemailid@test.com", "110" => "QR Code", "109" => "Simple message" ) ) );

This works for me. 这对我有用。 I hope it 'll work for you also. 我希望它也对您有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM