我有一个自定义字段的产物,根据这个。我知道我可以用
$cp = commerce_product_new('product');
$cp->is_new = TRUE;
$cp->revision_id = NULL;
$cp->uid = 1;
$cp->status = 1;
$cp->created = $cp->changed = time();
$cp->sku = $product[sku];
$cp->title = $product[name];
$cp->language = LANGUAGE_NONE;
$cp->commerce_price = array(LANGUAGE_NONE => array( 0 => array(
'amount' => $product[sale_price] ? $product[sale_price] : $product[retail_price],
'currency_code' => 'USD',
)));$product[retail_price];
commerce_product_save($cp);
但我有一些自定义字段。
如何以编程方式创建具有完整自定义字段的Drupal Commerce产品?
是否 $cp->myfield1='22';
足够?