【发布时间】:2017-09-13 00:02:23
【问题描述】:
以下代码成功创建订单。 id 为“3889”的项目具有三种尺寸:“7”、“8”、“9”。 但是添加到订单中的这个项目没有通过的尺寸“7”。 结果大小未指定。 Bigcommerce 没有错误。
问题:如何将产品的尺寸传递给订单?
<?php
require 'C:\wamp64\www\bigcommerceDemo\vendor\autoload.php';
require 'C:\wamp64\www\bigcommerceDemo\bg_api_connection\scripting.php';
use Bigcommerce\Api\Client as Bigcommerce;
Bigcommerce::verifyPeer(false);
$first_name = "example";
$last_name = "example";
$company = "";
$street_1 = "example";
$street_2 = "";
$city = "example";
$state = "example";
$zip = "example";
$country = "United States";
$country_iso2 = "";
$phone = "example";
$email = "example";
$object = array(
"customer_id" => "12610",
"status_id" => "7",
"date_created" => "Mon, 11 Sep 2017 19:26:23 +0000",
"billing_address" => array(
"first_name" => $first_name,
"last_name" => $last_name,
"company" => $company,
"street_1" => $street_1,
"street_2" => $street_2,
"city" => $city,
"state" => $state,
"zip" => $zip,
"country" => $country,
"phone" => $phone,
"email" => $email),
"products" => array(
0 => array(
"product_id" => 3889,
"quantity" => 1,
"product_options" => array(
0 => array(
"id" => 1267,
"value" => 7
)
)
),
1 => array(
"product_id" => 15805,
"quantity" => 1,
)
)
);
【问题讨论】:
-
您确定您的产品选项具有正确的
id值吗? -
@ProEvilz 我就是这样做的:我使用管理面板手动将 ID 为“3889”的项目添加到订单中。然后我从这个订单中请求产品选项信息。我得到了所有 id 的数组: [id] => 7178 [option_id] => 1240 [order_product_id] => 9939 [product_option_id] => 1267 [display_name] => Size [display_value] => Silver [value] => 7 .我尝试了其他ID。出现 BG 错误。
标签: php bigcommerce