【发布时间】:2012-10-13 11:47:45
【问题描述】:
我想使用 bigcommerce Api PHP 在 bigcommerce 商店中添加产品。
我的代码如下:
$fields = array( "name" => "Apple" );
BigCommerce_Api::createBrand($fields);
商店已成功连接,但未创建产品。请帮助...
【问题讨论】:
标签: php doctrine bigcommerce
我想使用 bigcommerce Api PHP 在 bigcommerce 商店中添加产品。
我的代码如下:
$fields = array( "name" => "Apple" );
BigCommerce_Api::createBrand($fields);
商店已成功连接,但未创建产品。请帮助...
【问题讨论】:
标签: php doctrine bigcommerce
看起来您是在创建品牌而不是产品。如果您想创建产品,可以执行以下操作 -
$filter = array('name' => 'iPhone sticker', 'price' => '12.99', 'categories' => array(2), 'type' => 'physical', 'availability' => 'available', 'weight' => 0);
$product = Bigcommerce_Api::createProduct($filter);
【讨论】:
$new_product = new Bigcommerce_Api_Product();
$new_product->name = $_POST['name'];
$new_product->type= "type";
$product = $new_product->create();
【讨论】:
您可以使用xml创建品牌,请查看以下代码:
BigCommerce_Api::useXml();
$xml = '<brand>
<name>'.$product[brand_name].'</name>
</brand>';
$brand_exe = BigCommerce_Api::createBrand($xml);
【讨论】: