首页 > 解决方案 > 创建订单时如何更新商店软件的自由文本字段中的值

问题描述

我正在使用 1 个第三方 API 将订单导入我的购物软件,并且正在使用以下方法。

$client_shopware->post('orders', ["customerId"         => $customer_id,
                    "paymentId"          => $paymentId,
                    "dispatchId"         => $dispatchId,
                    "partnerId"          => "",
                    "shopId"             => $shopId,
                    "invoiceAmount"      => 0,
                    "invoiceAmountNet"   => 0,
                    "invoiceShipping"    => 0,
                    "invoiceShippingNet" => 0,
                    "orderTime"          => $order_time,
                    "net"                => $TotalOrderAmount,
                    "taxFree"            => 0,
                    "languageIso"        => "1",
                    "currency"           => "EUR",
                    "currencyFactor"     => 1,
                    "referer"            => "Channel advisor",
                    "remoteAddress"      => "155.155.155.155",
                    "details"            => $JsonArray,
                    "documents"          => $documents,
                    "billing"            => $billing,
                    "shipping"           => $shipping,
                    "paymentStatusId"    => $paymentStatusId,
                    "orderStatusId"      => $orderStatusId,
                ]);

商店软件自由文本字段

创建自由文本字段

但我担心的是,在创建订单后,我想为该订单更新“自由文本字段”的值。那么有人可以帮我解决这个问题吗?​​​</p>

标签: shopware

解决方案


我将有关相同的问题发布到支持论坛,并得到如下答复:

'attribute' => ['attribute1' => 'some value']

您需要一个关键属性,它是一个包含属性数据的数组。所以我以下面的方式使用它,它起作用了。

 $client_shopware->post('orders', [
                        "customerId"                   => $customer_id,
                        "paymentId"                    => $paymentId,
                        "dispatchId"                   => $dispatchId,
                        "partnerId"                    => "",
                        "shopId"                       => $shopId,
                        "invoiceAmount"                => 0,
                        "invoiceAmountNet"             => 0,
                        "invoiceShipping"              => 0,
                        "invoiceShippingNet"           => 0,
                        "orderTime"                    => $order_time,
                        "net"                          => $TotalOrderAmount,
                        "taxFree"                      => 0,
                        "languageIso"                  => "1",
                        "currency"                     => "EUR",
                        "currencyFactor"               => 1,
                        "referer"                      => "Channel advisor",
                        "remoteAddress"                => "155.155.155.155",
                        "orders.attributes.attribute1" => "test",
                        "details"                      => $JsonArray,
                        "documents"                    => $documents,
                        "billing"                      => $billing,
                        "shipping"                     => $shipping,
                        "paymentStatusId"              => $paymentStatusId,
                        "orderStatusId"                => $orderStatusId,

                        'attribute'                    => [
                            'attribute1' => '12345test',
                        ],
                    ]);


推荐阅读