Bigcommerce API PHP 库不会创建具有自定义 form_fields 的客户
Bigcommerce API PHP library will not create a customer with custom form_fields
我正在使用 Bigcommerce php 库通过 API 创建客户,效果很好,但是当我尝试添加 form_fields
对象数组来调用。是否可以将这些包含在 createCustomer 调用中?
这基本上是我正在尝试做的事情:
$customer_object = array(
"email" => $email,
"first_name" => $first_name,
"last_name" => $last_name,
"_authentication" => array(
"password" => $password
)
);
$form_fields = array();
if(!empty($occupation)) {
$obj = (object) array("name" => "Occupation", "value" => $occupation);
array_push($form_fields, $obj);
}
$customer_object["form_fields"] = $form_fields;
$response = Bigcommerce::createCustomer(json_encode($customer_object));
此外,这是 Bigcommerce 客户记录的样子:
Bigcommerce\Api\Resources\Customer Object
(
[ignoreOnCreate:protected] => Array
(
[0] => id
)
[ignoreOnUpdate:protected] => Array
(
[0] => id
)
[fields:protected] => stdClass Object
(
[id] => 34
[company] => Company Name
[first_name] => John
[last_name] => doe
[email] => email@example.com
[phone] => 123-456-7890
[date_created] => Tue, 19 Jul 2016 23:40:14 +0000
[date_modified] => Wed, 10 Aug 2016 17:39:28 +0000
[store_credit] => 0.0000
[registration_ip_address] =>
[customer_group_id] => 6
[notes] =>
[tax_exempt_category] =>
[reset_pass_on_login] =>
[accepts_marketing] =>
[addresses] => stdClass Object
(
[url] => https://example.com/api/v2/customers/34/addresses.json
[resource] => /customers/34/addresses
)
[form_fields] => Array
(
[0] => stdClass Object
(
[name] => Occupation
[value] => Developer
)
)
)
[id:protected] => 34
[ignoreIfZero:protected] => Array
(
)
[fieldMap:protected] => Array
(
)
)
Form_fields 目前仅可获取,并且仅在打开特定 "store experiment" 的商店中可用。这已从我们的文档中省略,因此我们将努力更新它以提供更好的清晰度。
您可以通过 alyss@bigcommerce.com 给我发电子邮件,以便为您的商店启用 GET 支持。
我正在使用 Bigcommerce php 库通过 API 创建客户,效果很好,但是当我尝试添加 form_fields
对象数组来调用。是否可以将这些包含在 createCustomer 调用中?
这基本上是我正在尝试做的事情:
$customer_object = array(
"email" => $email,
"first_name" => $first_name,
"last_name" => $last_name,
"_authentication" => array(
"password" => $password
)
);
$form_fields = array();
if(!empty($occupation)) {
$obj = (object) array("name" => "Occupation", "value" => $occupation);
array_push($form_fields, $obj);
}
$customer_object["form_fields"] = $form_fields;
$response = Bigcommerce::createCustomer(json_encode($customer_object));
此外,这是 Bigcommerce 客户记录的样子:
Bigcommerce\Api\Resources\Customer Object
(
[ignoreOnCreate:protected] => Array
(
[0] => id
)
[ignoreOnUpdate:protected] => Array
(
[0] => id
)
[fields:protected] => stdClass Object
(
[id] => 34
[company] => Company Name
[first_name] => John
[last_name] => doe
[email] => email@example.com
[phone] => 123-456-7890
[date_created] => Tue, 19 Jul 2016 23:40:14 +0000
[date_modified] => Wed, 10 Aug 2016 17:39:28 +0000
[store_credit] => 0.0000
[registration_ip_address] =>
[customer_group_id] => 6
[notes] =>
[tax_exempt_category] =>
[reset_pass_on_login] =>
[accepts_marketing] =>
[addresses] => stdClass Object
(
[url] => https://example.com/api/v2/customers/34/addresses.json
[resource] => /customers/34/addresses
)
[form_fields] => Array
(
[0] => stdClass Object
(
[name] => Occupation
[value] => Developer
)
)
)
[id:protected] => 34
[ignoreIfZero:protected] => Array
(
)
[fieldMap:protected] => Array
(
)
)
Form_fields 目前仅可获取,并且仅在打开特定 "store experiment" 的商店中可用。这已从我们的文档中省略,因此我们将努力更新它以提供更好的清晰度。
您可以通过 alyss@bigcommerce.com 给我发电子邮件,以便为您的商店启用 GET 支持。