我正在使用带有扩展名的magmi,它从另一个商店/ magento获取数据并使用magmi导入产品。一切都很顺利。 但我不知道如何传递属性数据,因为我有“属性标题”,“属性值”和“属性代码”。是否有足够的信息来创建属性?
这里的代码是:
$incFile = MAGENTO_ROOT . '/magmi/inc/magmi_defs.php';
$dataPumpFileName = MAGENTO_ROOT . '/magmi/integration/inc/magmi_datapump.php';
// end include PATH's
require_once($incFile);
require_once($dataPumpFileName); // call Datapump
$dp=Magmi_DataPumpFactory::getDataPumpInstance("productimport");
$dp->beginImportSession("default","create");
$newProductData = array(
'name' => $value['Symbol'].','.$value['Producer'].','.$value['Description'],
'sku' => $value['Symbol'], // sku
'price' => $value['PriceList'][0]['PriceValue'], // price
'cost' => $value['PriceList'][0]['PriceValue'],
'related_products' => $relResultProducts,
'store' => 'admin',
'description' => $parameterTable, // full description
'short_description' => $value['Description'], // short description
'qty' => $value['Amount'], // qty
'min_sale_qty' => $value['MinAmount'],
'use_config_min_sale_qty' => '0',
'category_ids' => $category_id.',1466', // ID of categories
'visibility' => '4',
'status' => '1',
'weight' => ($value['Weight']/1000), // weight
'tax_class_id' => '2', // tax class id (check your ids)
'manufacturer' => $value['Producer'], // manufacturer
'meta_title' => $value['Symbol'], // meta title
'meta_description' => $value['Description'], // meta description
'meta_keyword' => $value['Symbol'], // meta keywords
'type' => 'simple',
'fme_rule_enable' => '1',
'custom_stock_status_qty_based' => '1',
'tier_price:all' => $tirePrice,
'image_label' => $value['Symbol'].','.$value['Producer'].','.$value['Description'],
'small_image_label' => $value['Symbol'].','.$value['Producer'].','.$value['Description'],
'thumbnail_label' => $value['Symbol'].','.$value['Producer'].','.$value['Description'],
);
$newProductData['image'] = '+http:'.$value['Photo'];
$newProductData['small_image'] = '+http:'.$value['Photo'];
$newProductData['thumbnail'] = '+http:'.$value['Thumbnail'];
$newProductData['media_gallery'] = '+';
foreach($value['ParameterList'] as $ParameterValue){
$attr_code = strtolower($ParameterValue['ParameterName']);
$attr_code = str_replace(' ', '_', $attr_code);
$newProductData[$attr_code] = $ParameterValue['ParameterValue'];
}
Mage::log($newProductData, true);
$dp->ingest($newProductData);
答案 0 :(得分:0)
属性代码是主列,具体取决于Magmi更新了产品。如果它是类型下拉列表的属性,magmi将自动创建其属性标签。