1

Sorry for the probably simple question, but I am new to both Magento and Fast Simple Import.

The plugin works great for single products with single properties and single images. But I ofcoarse want more colors, more images, etc. etc. What is the best way to do this? I searched the trough the docs and Google, but couldn't find a working example (or answer).

This is what I have right now:

$data[] = array(
    // Main product
    'sku' => $randomString,
    '_type' => 'simple',
    '_attribute_set' => 'Default',
    '_product_websites' => 'base',
    '_category' => array(1, 3),

    // Product per row
    'name' => "Wikitest",
    'price' => 0.99,
    'special_price' => 0.90,
    'cost' => 0.50,
    'description' => 'Default',
    'short_description' => 'Default',
    'meta_title' => 'Default',
    'meta_description' => 'Default',
    'meta_keyword' => 'Default',
    'weight' => 11,
    'status' => 1,
    'visibility' => 4,
    'tax_class_id' => 2,
    'qty' => 0,
    'is_in_stock' => 0,
    'enable_googlecheckout' => '1',
    'gift_message_available' => '0',
    'url_key' => strtolower($randomString),

// Images

    // Image 1
    array('_media_image' => 'http://upload.wikimedia.org/wikipedia/meta/6/6d/Wikipedia_wordmark_1x.png',
    '_media_target_filename' => 'wikipedia.jpg',
    'image' => 'wikipedia.jpg',
    'small_image' => 'wikipedia.jpg',
    'thumbnail' => 'wikipedia.jpg')

    // Image 2
    '_media_image' => 'http://upload.wikimedia.org/wikipedia/meta/6/6d/Wikipedia_wordmark_1x.png',
    '_media_target_filename' => 'wikipedia2.jpg',
    'image' => 'wikipedia2.jpg',
    'small_image' => 'wikipedia2.jpg',
    'thumbnail' => 'wikipedia2.jpg',


);

What happens in above example is that I only upload / attach one image to the product. Also, when i add extra colors qty etc it will create multiple products or crash on duplicate SKU.

Second question, I am importing from an XML and CSV feed. Is there some best practise to turn an XML / CSV into an array? I can write something myself, but I guess something is already available. If not, tips are welcome as well.

Thanks all!

3

Option 1: Use AvS_FastSimpleImport directly; http://avstudnitz.github.io/AvS_FastSimpleImport/options.html

Set the option 'Support Nested Arrays for Import' to Yes and use the nested arrays. Example:

$data = array(
    array(
        'sku' => '1234567',
        '_type' => 'simple',
        '_attribute_set' => 'Default',
        '_product_websites' => array('de', 'en', 'fr'),
        'name' => 'Default',
        'price' => 0.99,
        'description' => 'Default',
        'short_description' => 'Default',
        'colors' => array('green', 'silver')
        'weight' => 0,
        'status' => 1,
        'visibility' => 4,
        'tax_class_id' => 2,
        'qty' => 76,
    ),
);

Option 2:

To transform files to a different format, I personally use https://github.com/ho-nl/Ho_Import, others use https://github.com/AOEmedia/Aoe_Import. Where Ho_Import offers download options etc, Aoe_Import is multi threaded and has better logic for parsing XML.

7
  • Thanks Paul! Works like a charm. Also thank Andreas for his presentation of this plugin on MeetMagento NL.
    – matt
    Jun 3 '14 at 9:40
  • One more question if I may. I have 3 colors and 3 qty. How should I handle this? e.g. 'qty' => array(10,11,12), 'colors' => array("Red","Blue","Pink") Is this correct?
    – matt
    Jun 3 '14 at 9:47
  • Yeah, that's the idea! Jun 3 '14 at 11:40
  • If you try to run the importer, it will throw errors if it encounters them. Jun 3 '14 at 11:40
  • Paul, can you give me an example how to do this with ho_import? <multiselect_attr value="green , red" /> doesn't seem to work.
    – remklov
    Oct 14 '15 at 16:14

This site is temporarily in read only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .