Magento SOAP API v2 - 将可配置产品添加到购物车

时间:2014-12-08 06:26:39

标签: magento soap configurable-product

将可配置产品添加到购物车时遇到问题。我将以下数组设置为函数

$productList_final = 
Array
(
    [0] => Array
    (
        [product_id] => 3
        [sku] => Wallpaper
        [name] => Wallpaper
        [set] => 4
        [type] => configurable
        [category_ids] => Array
            (
                [0] => 3
            )

        [website_ids] => Array
            (
                [0] => 1
            )

        [qty] => 1.0000
        [options] => Array
            (
                [info_buyRequest] => Array
                    (
                        [uenc] => aHR0cDovL2xvY2FsaG9zdC9zeW5jaHJvbml6ZS1vcmRlci9pbmRleC5waHAvY2VsbC1waG9uZXMvd2FsbHBhcGVyLmh0bWw,
                        [product] => 2
                        [form_key] => rYNDd47kaYLWGl4a
                        [related_product] => 
                        [super_attribute] => Array
                            (
                                [0] => Array
                                    (
                                        [key] => 92
                                        [value] => 5
                                    )

                            )

                        [qty] => 1
                    )

                [attributes_info] => Array
                    (
                        [0] => Array
                            (
                                [label] => Color
                                [value] => Green
                            )

                    )

                [simple_name] => Wallpaper-Green
                [simple_sku] => Wallpaper-Green
                [product_calculations] => 1
                [shipment_type] => 0
            )

    )

)

但它会产生错误," SOAP-ERROR:编码:对象没有'键'属性"当调用以下函数

$apiClient->shoppingCartProductAdd($sessionId, $cartId, $productList_final);

任何线索我应该如何准备上面的数组 - 选项(supper_attributes)??

1 个答案:

答案 0 :(得分:0)

在这个问题上,Magento Stack Exchange已经有了一个主题 - https://magento.stackexchange.com/questions/18027/configurable-products-with-soap-api