0
votes

i am using magmi with an extension, that takes the data from another store/magento and import the products by using magmi. all is going very well. But i do not know how to pass attributes data, as i do have "Attribute Title", "Attribute Value" and "Attribute code". is it enough information to create attribute ?

Here the code is :

$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);
1

1 Answers

0
votes

Attribute code is the main column depending on which Magmi updated the product. If it is a attribute of type dropdown, magmi will automatically create its attribute labels.