Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/25.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
Php 通过BigCommerce api编程创建订单时设置发货方法_Php_Api_Bigcommerce - Fatal编程技术网

Php 通过BigCommerce api编程创建订单时设置发货方法

Php 通过BigCommerce api编程创建订单时设置发货方法,php,api,bigcommerce,Php,Api,Bigcommerce,在使用BigCommerce api PHP库以编程方式创建新订单时,如何设置订单的发货方式: 以下是我用于创建订单的代码: $createFields = array( "customer_id"=>0, "status_id"=> 1, "date_created"=> $o_date, "subt

在使用BigCommerce api PHP库以编程方式创建新订单时,如何设置订单的发货方式: 以下是我用于创建订单的代码:

$createFields = array(

                      "customer_id"=>0,
                      "status_id"=> 1,
                      "date_created"=> $o_date,
                      "subtotal_ex_tax"=> strip_tags($xmlObj1->itemsTotal->asXML()),
                      "subtotal_inc_tax"=> floatval(strip_tags($xmlObj1->itemsTotal->asXML())) + floatval(strip_tags($xmlObj1->dutyTaxesTotal->asXML())),
                      "base_shipping_cost"=> strip_tags($xmlObj1->shippingTotal->asXML()),
                      "shipping_cost_ex_tax"=> strip_tags($xmlObj1->shippingTotal->asXML()),
                      "shipping_cost_inc_tax"=> strip_tags($xmlObj1->shippingTotal->asXML()),
                      //"base_handling_cost"=> 0,
                      //"handling_cost_ex_tax"=> 0,
                      //"handling_cost_inc_tax"=> 0,
                      //"base_wrapping_cost"=> 0,
                      //"wrapping_cost_ex_tax"=> 0,
                      //"wrapping_cost_inc_tax"=> 0,
                      "total_ex_tax"=> floatval(strip_tags($xmlObj1->grandTotal->asXML())) - floatval(strip_tags($xmlObj1->dutyTaxesTotal->asXML())),
                      "total_inc_tax"=> strip_tags($xmlObj1->grandTotal->asXML()),
                      //"refunded_amount"=> 0,
                      //"order_is_digital"=> false,
                      "staff_notes"=> strip_tags($xmlObj1->shippingCarrierServiceLevel->asXML()),
                      //"customer_message"=> "",
                      //"discount_amount"=> 10,
                      "billing_address"=> array(
                                            "first_name"=> $billing_name[0],
                                            "last_name"=> $billing_name[1],
                                            "company"=> strip_tags($xmlObj1->company->asXML()),
                                            "street_1"=> strip_tags($xmlObj1->billingAddress1->asXML()),
                                            "street_2"=> strip_tags($xmlObj1->billingAddress2->asXML()),
                                            "city"=> strip_tags($xmlObj1->billingCity->asXML()),
                                            "state"=> strip_tags($xmlObj1->billingState->asXML()),
                                            "zip"=> strip_tags($xmlObj1->billingZip->asXML()),
                                            "country"=> strip_tags($xmlObj1->billingCountryName->asXML()),
                                            "country_iso2"=> strip_tags($xmlObj1->billingCountryCode->asXML()),
                                            "phone"=> strip_tags($xmlObj1->billingPhone->asXML()),
                                            "email"=> strip_tags($xmlObj1->email->asXML())
                                          ),
                      "shipping_addresses"=> array(
                                                array(
                                                  "first_name"=> $name[0],
                                                  "last_name"=> $name[1],
                                                  "company"=> strip_tags($xmlObj1->company->asXML()),
                                                  "street_1"=> strip_tags($xmlObj1->address1->asXML()),
                                                  "street_2"=> strip_tags($xmlObj1->address2->asXML()),
                                                  "city"=> strip_tags($xmlObj1->city->asXML()),
                                                  "state"=> strip_tags($xmlObj1->state->asXML()),
                                                  "zip"=> strip_tags($xmlObj1->zip->asXML()),
                                                  "country"=> strip_tags($xmlObj1->countryName->asXML()),
                                                  "country_iso2"=> strip_tags($xmlObj1->countryCode->asXML()),
                                                  "phone"=> strip_tags($xmlObj1->phone->asXML()),
                                                  "email"=> strip_tags($xmlObj1->email->asXML())
                                                )
                                              ),
                      "products"=> $products,


                      "external_source"=> "iGlobal",
                    );

$bc_order_created = Bigcommerce::createOrder($createFields);

是否存在将设置shipping method的字段,或者是否应使用其他api调用?

shipping method不是Orders资源的一部分属性。您希望将其分配为装运的一部分

为什么发货方式不是创建订单的一部分?我正在从另一个系统导入订单,我如何告诉我的BC系统该订单将使用特定的方法发货。我不知道为什么。我推测这是因为在发货之前,装运方式尚未完全确定。在这里,您可以找到有关装运API的更多信息。