Jul
27
2009

Automated quick simple product creation in Magento

Creating the Associated Products for the configurable products in Magento is very easy, the way it can be in Admin panel.

You just need to fill the values in ‘Quick simple product creation’ box & press ‘Quick create’ button.

However, if you want to create big amount of simple products, its painful to fill the form every time.

In my case, I had to create simple product for the T-shirt. I have to choose the Style from the drop down, then color from the drop down & the size from the drop down. There were about 280 combinations. So I had to create 280 simple products.

Then I decided to create a script which can make the process of creating simple products very fast.

I took the inner HTML of ‘Quick simple product creation’ box, did some modifications.


Quick simple product creation

[STORE VIEW]  
[GLOBAL]  
[WEBSITE]  
[STORE VIEW]  
 
 
 
 
 
 

If you want to use the above script, follow the steps below:
Set the array with the id of the size labels.

var style = new Array();
style['size'] = new Array(100,99,98,136,135,134);
style['sizename'] = new Array('small','medium','large','xl','xxl','xxxl');

Create the colors array, here the key will be the label id of the attribute & the value can be anything which will used in the name of the simple product you are going to create

var colors = new Array();
colors[24] = "black";
colors[150] = "creme";
.
.
.

.

Example:

I want to create simple product having the attributes as per below:
Style: Men
Color: Black
Size: Small

So I can set the colorkey with value 24 (on line 44).

colorkey = 24;

Set the style on line 48.

frmObj.elements['simple_product[style]'].value = 125;

Save the file & run it in browser. You will see the screen as below.

Quick simple product creation

Press the Quick create button. This will submit the form to your host. Make sure that you are logged in as Admin in your Magento setup.

In this case the form will submitted six times, each time with different value of shirt size. As a result six products will be inserted with Black color, in Man style with size different sizes.

The mechanism above is bit tricky & awkward. Let me know your doubts in comments.

Related Posts

About the Author: Jignesh Patel

Jignesh Patel is a geek, an engineer & a web developer, who focus on developing web sites which look great, work great and can still work on older web browsers. Expertise in PHP, MySQL, JS, Magento & Wordpress.

  • http://www.domainsdaemon.com/ Bodyc

    Super post, Need to mark it on Digg
    Thanks
    Bodyc

  • http://sanjaypatil.wordpress.com sanjay

    very nice post. u really make the effort of adding product.

  • steve

    Hi, Would this create configurable products? I have a project that has 5000 products and i have to convert them into configurable products.

    Let me know your thoughts

  • Anonymous

    Hello Steve

    Sorry but this is just for making simple products only. In your case, may you can import all the configurable products via CSV. Then use this script to add associated products under them.

  • http://www.gowebbaby.com/ecommerce Ecommerce Developer

    Useful information shared..I am very happy to read this article..Thanks for giving us nice info. Fantastic walk-through. I appreciate this post.

blog comments powered by Disqus