我使用Drupal commerce创建了一个电子商务网站,这是一个克隆的Ektron创建的购物网站。现在我的客户要求是,如果他插入一个产品在该网站(这是在Ektron创建),它也将纳入我的网站,当我们运行导入。
所以我需要知道drupal_commerce如何在表中插入他们的产品详细信息。任何关于这方面的帮助都将是非常感激的。如果有人需要进一步的澄清,请告诉我。
我也有一些实体字段。比如作者名,最低价等等如何插入这些值
Thanks in advance
试试这个…
$values = array (
'price' => 9271.00 ,
'currency_code' => 'USD' ,
);
$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 = '#12sku';
$cp->title = 'New Title';
$cp->language = 'und';
$cp->commerce_price = array ( LANGUAGE_NONE => array ( 0 => array (
'amount' => $values[ 'price' ] ,
'currency_code' => $values[ 'currency_code' ],
) ) );
$cp->field_list_price = array ( LANGUAGE_NONE => array ( 0 => array (
'amount' => '300.00' ,
'currency_code' => $values[ 'currency_code' ],
) ) );
$cp->field_isbn = array ( LANGUAGE_NONE => array ( 0 => array (
'value' => '#isbnn' ,
) ) );