I have recently taken on a new web project which is to move an e-commerce website from a custom 3rd party solution over to Magento and before I even got started I hit a road block (you have got to love Magento for that!). I found that I had to import around 200 product attributes (colours, sizes, etc) from the old online shop to the magento installation and obviously I did not want to enter all these by hand, but where to begin?!
Luckily I came across a post on the Magento forums which details a method for bulk importing product attributes into Magento and although it did not allow me to automate the whole process, it was sufficient for my purposes.
The sample code provided in the post allows you to import multiple attributes into Magento but you have to create the attribute in Magento manually before you can import the values as the import does not create non-existing attibutes. The other problem for me was that the sample code only allowed you to import one attribute at a time and then you had to edit files and id’s to do the next one.
As I had multiple attributes to import I tweaked the example code (you can download the tweaked code here) to allow me to import values for multiple attributes at one time. I still had to create the attributes manually within Magento first but the tweaked code allowed me to import all my attributes values for multiple attributes at once.
In order to import the product attribute values you need to create files in your magento installation within the folder
The files need to be in the format of [attribute_id]_[attribute_name].csv i.e. 80_color.csv, 122_size.csv, techically the _[attribute_name] is not necessary but it helps to make identifying which attribute the file is for a whole lot easier.
Each value for the product attribute need to be in a separate line and the first line needs to contain the word “admin”. For example, 80_color.csv contains:-
admin Red Blue Green Purple Black
Once you have created the attribute files and copied to other files to their relevant locations you can then open ImpAttributes.php for your Magento installation in your browser i.e. http://www.mysite.com/ImpAttributes.php and all being good, your product attributes should be imported.
I have made the adapted product attributes import for Magento sample code available for download via the link below:-
This also contains a sample colours and sizes file
Bulk Import Attributes – Original solution provided by Srinigenie