Quantcast
Channel: Magento Coder » Admin
Viewing all articles
Browse latest Browse all 2

Automated quick simple product creation in Magento

$
0
0

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.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images