【问题标题】:BigCommerce API - Can't create a new customerBigCommerce API - 无法创建新客户
【发布时间】:2014-04-11 00:46:27
【问题描述】:

在 Stackoverflow 上查看了类似的问题,但作为 BC 的新手,这个问题仍然存在真正的问题。尝试使用 Bigcommerce API (PHP) 创建新客户。

我已经能够使用 API (PHP) 连接到我的 Bigcommerce 商店并获取数据,例如客户列表。我使用的代码(暂时只是测试)如下:

require_once "bigcommerce-api/bigcommerce.php";

use Bigcommerce\Api\Client as Bigcommerce;

Bigcommerce::configure(array(
    'store_url' => 'https://store-xxxxxxxx.mybigcommerce.com/',
'username'  => 'admin',
    'api_key'   => 'xxxxxxxxxxxxxxxxxxxx'
));

Bigcommerce::setCipher('RC4-SHA');
Bigcommerce::verifyPeer(false);

$customers = Bigcommerce::getCustomers();

foreach($customers as $customer) {
    echo $customer->first_name;
echo $customer->last_name;
echo "<br/>";
}

我的问题是,如何编写 PHP 代码以在我的 Bigcommerce 商店中创建新客户?

谢谢,

湄公河

【问题讨论】:

    标签: php bigcommerce


    【解决方案1】:

    没关系,伙计们,我已经解决了。只是我粗略的测试代码,但它可以工作(万岁!):

    $first_name = "Willy";
    $last_name = "Wonka";
    $email = "willy@wonkaville.com";
    $company = "Wonka Pty Ltd";
    $phone = "03 9699 1234";
    $store_credit = "0";
    $customer_group_id = "2";
    $authentication = "harry1";
    
    $createFields = array('first_name'=>$first_name,'last_name'=>$last_name,
    'email'=>$email, 'company'=>$company,'phone'=>$phone,
    'store_credit'=>$store_credit,'customer_group_id'=>$customer_group_id,
    '_authentication'=>$authentication);
    
    $customers = Bigcommerce::createCustomer($createFields);
    

    【讨论】:

    • 但是,我在为新客户创建密码时仍然遇到问题。关于身份验证/密码,代码(上图)不太正确。有什么想法……有人吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多