I took on the challenging task to make a UI to bulk create product variations, a big chunk of my time was spend evaluating other systems. I noticed they where really hard to use, they often relied on creating either just one/two attributes on which you make variations through difficult set configurations (Magento, Amazon) or even asked people to build out a full excel sheet.

I designed something that hopefully captures all that is needed, the prototype can be found :

Prototype

The flow I propose is:

  1. You click to add a bulk variations from the product creation screen.
  2. You fill in the SKU-pattern, this could be prefilled.
  3. You select which attribute you wish, this uses the Chosen interaction (term filtering on product listings) so you can select multiple (not represented in the prototype).
  4. You select Black, Yellow, and all the sizes. Then click "add".
  5. The options are added to the table, and you can finalize by clicking create variations.

The chosen interaction allows us to scale to an large amount of attribute options, and scales to at least 5/6 attributes with few UX problems. This doesn't have to be a model, instead we should probably place it inline.

I have marked this critical, because many participants mentioned this as a important missing piece.

bulkvariationinterface.jpg

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Bojhan’s picture

FileSize
205.04 KB

Starting point.

Bojhan’s picture

Project: Commerce Kickstart » Inline Entity Form
Issue summary: View changes

Updated issue summary.

bojanz’s picture

Version: 7.x-2.x-dev » 7.x-1.x-dev
Priority: Critical » Major

Moving this to the IEF issue queue, it's more logical there. We can open a Kickstart issue that points to it.

The mockup seems okay, keeping in mind the fact that we wont be using a modal (it will be an inline form just like the "add product" one).

jalves’s picture

Any prevision when this will be released? I need this very much... :/

bojanz’s picture

It's not on the todo list for the initial 2.0 release, so anything between weeks and months.

If you start coding it yourself, feel free to ping me on IRC with questions.

marktheshark’s picture

In the mean time, can this be emulated via the Bulk Product Creation module?

Also being able to reuse the same images per e.g. a color category would be most useful.

The same images may not make sense for all variations, but they might for all variations of the same color.

Workflow for this would be, e.g.:

  1. Set up common fields for a group of variations to be generated (e.g. same images for the same color)
  2. Select the variable attributes that will generate the different combinations
  3. Generate
  4. Repeat for another color

Having written this, I guess BPC can do this if you do it once per color.

killua99’s picture

OMG, this is sooo needed! You have some code that I can keep working and make the correct patch? I need this feature ASAP.

killua99’s picture

Need help! With some memory leak.

I'm trying to make the patch to handle the bulk implementation. But in the final step I'm getting a memory leak with the entity object. The result is ALL the variants get the same result.

Need some help with this.

bojanz’s picture

Status: Active » Needs review
killua99’s picture

Was just adding this line

'entity' => clone $bulk_entity_form['#entity'],

And I'm avoided the object recursion.

To activate the bulk process you have to go to the field UI and edit the ief field and select this options i.e.
Screen Shot 2013-08-09 at 15.56.09.png

Then in the edition you will see the bulk button in the node creation / product creation.

killua99’s picture

Updating with the attribute hack, that alter the form.

The field has to be setup like normal attribute field (1 limit) the patch alter the form to make it unlimit select.

killua99’s picture

Issue summary: View changes

Updated issue summary.

sharif.tanveer’s picture

Hey guys,
I'm a geneal user of Drupal & no idea about coding. But may be this is possible?

Workflow:

1>Select Color+Images
2>Select multiple Size (instead of 1 size, allow unlimited from field setting)
3> It will generate auto SKU for very size.

I think this make sense. In real store, they produce one color, take image of it, but various size. & most of the time(99%) size doesn't effect pricing.

** So, we need just one thing, is to make a way to select unlimited size (I found)+ 98)+ auto generation combining those color+size+image (someone need to do!)

discipolo’s picture

adding related issue

mdobossy’s picture

I had been using the patch in #10 for a while, but it broke when I updated to IEF 1.5. With the significant change that took place in the IEF code, I found it easier to start from scratch.

Like the old patch, has a setting to enable bulk creation. However, unlike the old patch, this version adds a button with a bulk creation specific form (see screenshots). While some changes were made to the generic inline entity form code, the majority of the changes were specific to the commerce product inline form. It is properly generating bulk products for me, and hopefully will be a good start for anyone else needing this functionality.

mdobossy’s picture

FileSize
23.42 KB
58.67 KB
discipolo’s picture

works fine for me so far! thanks

petergus’s picture

This is a great feature, works great!
One possible bug or needed enhancement, SKU generation is not working. Is there a step I am missing to set this?

EDIT: Just read in the patch code this on the TODO list. maybe i can go with Auto SKU.

discipolo’s picture

Auto SKU works fine

mglaman’s picture

Status: Needs review » Reviewed & tested by the community

Since it seems to be working, marking RTBC.

discipolo’s picture

for some reason bulk generation doesnt work for term references anymore. its telling me the attribute field can only hold one value.

am still investigating this.

sharif.tanveer’s picture

Hi,

The Workflow Can be like this:

>>Prototype

The flow I propose is:

>>You click to add a bulk variations from the product creation screen.
>>You select which attribute you wish, this uses the Chosen interaction (term filtering on product listings) so you can select multiple (not represented in the prototype).
>>You select Black, Yellow, and all the sizes. Then click "add".
>>The options are added to the table, and you can finalize by clicking create variations.
>>Before you finally, Save the Product, you have option to add image to each variation .

This way, we can have different images for different variations.

Just trying to help,, but without coding :(

shabana.navas’s picture

Hey guys, any update on this? Really want to use the patch but am a bit hesitant in light of #19. @discipolo, so basically even with the patch, we can't select the variants using a term reference field? Turn up anything from your investigation?

discipolo’s picture

i just ran a clean test:

  1. created vocabulary:sizes
  2. added terms: small,medium,large
  3. added termreference field with select widget to product entity allowing 1 value and configured as attribute rendered as select
  4. added product reference field on a node with with bulk generation enabled
  5. set autosku for product type to include sizes
  6. added product display node and bulk generated products

looks like something else got into my way earlier.
this is working!

shabana.navas’s picture

Great to hear! In that case, this patch should be committed as we've got lots of reviews that have confirmed it works.

LGLC’s picture

Just adding my support to this patch being committed - incredible work!

Stron’s picture

Implementing patch #13
and have the same problem as #19
"attribute field can only hold one value"

Stron’s picture

Tested the problem. If select multiple values for the bulk creation, you get an error "this field cannot hold more than 1 values". AND Notice:

Notice: Undefined index: field_product in CommerceProductInlineEntityFormController->entityFormValidate() (line 270 of /home/xxxxxx/sites/all/modules/inline_entity_form/includes/commerce_product.inline_entity_form.inc).

errors with single attribute bulk creation

If select a single value attribute and press button "Bulk create", then do not create anything, and the error list is supplemented:

Notice: Undefined index: field_product in CommerceProductInlineEntityFormController->entityFormValidate() (line 270 of /home/xxxxxx/sites/all/modules/inline_entity_form/includes/commerce_product.inline_entity_form.inc).
Notice: Undefined index: field_product in CommerceProductInlineEntityFormController->entityFormSubmit() (line 317 of /home/xxxxxxx/sites/all/modules/inline_entity_form/includes/commerce_product.inline_entity_form.inc).
Warning: Invalid argument supplied for foreach() in CommerceProductInlineEntityFormController->permutations() (line 466 of /home/xxxxxxx/sites/all/modules/inline_entity_form/includes/commerce_product.inline_entity_form.inc).

this field cannot hold more than 1 values

SocialNicheGuru’s picture

Status: Reviewed & tested by the community » Needs work

because of the last two comments, I set it to 'Needs work'.

NaderIkladious’s picture

Category: Feature request » Support request
Priority: Major » Normal

Hey,

How do I get this work ?

I've downloaded the patch and placed it into the project folder "sites/all/modules/inline_entity_form" and then i ran patch -p1 < inline_entity_form-implementation-1777254-13.patch through the terminal after cd into the project folder...

I flushed all the cache and I don't see any changes ...? Am I missing something here ?

Please help, It's appreciated.

mglaman’s picture

Category: Support request » Feature request
Priority: Normal » Major

Hi NaderIkladious, please don't change some of the metadata to meet the needs of your comment.

To apply patch, try something like

cd sites/all/modules/inline_entity_form
curl https://www.drupal.org/files/issues/inline_entity_form-implementation-1777254-13.patch | patch -p1

That'll get the patch data and patch for you. You need to be in the project folder.

NaderIkladious’s picture

Hello,

Is it possible to have the bulk creation form as a default form when page load first time ?

If possible please let me know how..

And sorry for changing the metadata, I'm kinda new here.

Thanks,

discipolo’s picture

looks like products created with this are missing the bundle property sometimes for me. still investigating

sharif.tanveer’s picture

Hi,
Anyone working on this feature? It seems to me a very very desired feature without what eCommerce site can't be functional. If you have 100 products, its ok to add them manually, but what if one big store wants to go with drupal with may be 2000+ products? I think this feature might get some more love !

So, What if we add variations from the inside of "adding Product" menu.

Workflow could be:

>Add Product
>Fill 'Title', 'Body'
>Click "Add Variation"
>Fill 'SKU' field with tokens. for example: [product nid]-[color]-[Size]
>Select one/multiple value from "1st attributes" & mix with One/multiple value of "2nd attributes".

>>If he wants to add different images for '1st attributes' then he need to select one value. If one image fit all variation then he can use multiple value at once.

FiNeX’s picture

Hi, this feature would be useful in 8.x too :-)

OFF’s picture

+1 for 8.x version