Effective Method of Bulk Import in Magento

Payal January 16, 2019

Effective Method of Bulk Import in Magento

I have a multiple languages store where we add products from different companies. We have more than 10 companies that provide their products in CSV/XML. It is very difficult to add products manually or with Magento default import functionality. I use MAGMI for Bulk import as it is easy and fast. In this blog, I am sharing steps to use MAGMI for Bulk import of configurable and simple products.

1) Download Magmi: You can download Magmi from “https://github.com/dweeves/magmi-git

2) Installation: Extract the downloaded folder and copy it in your Magento root directory.
You can check the list of folders in the Magmi folder.



3) Database connection: Now you have to connect the database Magmi, and for that, you have to open
http://www.yourdomain.com/magmi/web/magmi.php” in the browser. Add your Host and
Database details.

4) Creating profile: Here you can add a profile name and make a copy of the default profile or create a copy of the selected profile.

5) Configure plugins: After creating the profile, you have to select plugins that you want to add. I am sharing the selected plugins that I used for my profile. You can read the documentation for a better understanding.

 

In ‘Column Mapper’, you can add column names that are provided by your XML/CSV provider. You have to map all the titles in the ‘Column Mapper’ with Magento attributes code.

 
 

You can add some Default values which are the same for all the products.

Configurable child product settings:

 

6) XML Example :

<?xml version=”1.0″ encoding=”UTF-8″?>
<products>
<product>
<name>Product Name</name>
<image>http://www.domain.com/KC23J.jpg</image>
<price>14.6</price>
<description>Evening sequence party wear</description>
<category>Evening Dresses</category>
<options>
<option promo_price=’9.9′>
<option_name><![CDATA[ S ]]></option_name>
<STOCK>1</STOCK>
<avaible_in>1</avaible_in>
</option>
<option promo_price=’9.9′>
<option_name><![CDATA[ M ]]></option_name>
<STOCK>1</STOCK>
<avaible_in>1</avaible_in>
</option>
<options>
</product>
<product>
<name>Product Name</name>
<image>http://www.domain.com/KC23J.jpg</image>
<price>14.6</price>
<description>Evening sequence party wear</description>
<category>Short Dresses</category>
<options>
<option promo_price=’9.9′>
<option_name><![CDATA[ S ]]></option_name>
<STOCK>1</STOCK>
<avaible_in>1</avaible_in>
</option>
<option promo_price=’9.9′>
<option_name><![CDATA[ M ]]></option_name>
<STOCK>1</STOCK>
<avaible_in>1</avaible_in>
</option>
</options>
</product>
</products>

7) Create a Script:
Now you have to create a PHP script under the Magmi/integration/scripts folder. Write your code to read
XML/CSV and save data in the database. You have to configure database connection first in your script
and then write your code. You can add configurable & simple products as well.

Example :
<?php
require_once(“../../inc/magmi_defs.php”);
require_once(“../inc/magmi_datapump.php”);
require_once(“config.php”); // your database connection file
// create a Product import Datapump using Magmi_DatapumpFactory
$dp=Magmi_DataPumpFactory::getDataPumpInstance(“productimport”);
// you can replace “default” with your magmi profile name & running mode is “create”
$dp->beginImportSession(“default”,”create”);

for($j=0;$j<500;$j++)
{
// Your can add your code here. Below is just an example to write your script.
// Define product attibutes name,sku,price,attribute_set,store,description
$item=array(“name”=>”item name $j”,”sku”=>”SKU”,”price”=>”10.00″,
“attribute_set”=>”Default”,”description”=>”item description $j”);

$dp->ingest($item);// Now insert product into magento
}
// End import Session
$dp->endImportSession();
?>

You can mapp your categories too in your script with your site categories. It automatically adds
products to their mapped categories. Here is a
category mapping example:

 

Above ‘XML category’ refers to the categories in your XML feed. In the above XML, we are mapping
Evening dresses & Short dresses with our site categories. Check the example below:

Evening Dresses Women’ clothing/Dresses/Party dresses
Short Dresses Women’ clothing/Dresses/Short Dresses

It will automatically create new categories, if you don’t have a category in your store. Run your script in the browser. You can add your script in ‘cron’ to run on a particular time and products will auto-update.

The above-mentioned process can import products far quicker than a manual approach.

Do share the article with your friends to make their life comfortable!

If you have any queries or doubts about this topic please feel free to contact us. We are here to help you!

Lets’s Talk

About your ideas and concept