Monday, 2 January 2012

installing products on Drupal Commerce Bulk Product Installer

Vimeo.com/34385004 - video -


Hi this is Pedro Cambria from Commerce Guys in another commerce module video. This week I'm going to show you how to use Commerce Bulk Product Creation Module. This was the first contrib[uted] module created for Commerce, and allows you to bulk-create products. Basically if you [...?...] of your SKU, or you can generate your SKU easily by tokens, this module is going to be ideal for you. It manages the creation of the product, but also, when the product variations are created, this module has also [got] options to manage the displays associated with these variations. What this module doesn't manage, as yet, is to edit or modify the products once created. [1']

OK. For this demo I have Commerce Kickstart installed, with these modules already installed: you need:
  • Commerce Bulk Product Creation commerce_bpc, and we see also the
  • [included but to be enabled - "Just to be sure: Did you enable the "Enable this field to function as an attribute field on Add to Cart forms." under "Attribute Settings" in the field settings of the taxonomy fields? This is currently required."] Taxonomy Reference Integration bpc_taxonomy
OK. I have also a couple of product types. If I go to Store>View Products>Product Types tab, I have a
  • Product with a single attribute, and a
  • Product with taxonomy attributes to demonstrate how this module works.[So how do I get one?]
OK. The first thing you need once you have installed these modules is to have a
Field (Store>View Products>Click on product created with a single attribute>manage fields) [2']
or some fields of list type . Also boolian. And if you have the taxonomy_bpc module installed you can do this with taxonomy fields as well. So I have this Genre field created here. It's a list of texts. And here [further down the page in a box] you will see Bulk Product Creation options. We are going to use this field for bulk product creation operations. And we have that field that's an attribute in the cart. So. We have three allowed values [in the allowed values box]

For Bulk Product Creation you have to go to
Store>Products and in the Product listing you will find [just before "add a product"] a link [3']
"Bulk Add Products".]
If you click here you are prompted to select one of the product types you have more than one that are eligible to be created by this massive operation. If you have a product type without any field that is eligible for this, it won't display and you won't be able to use this module. So if you don't have a list field, a boolean field, or taxonomy fields, you won't see the options here.

Let's select a simple one. You'll see the interface of the module. [headed "Bulk add Product with a single attribute" in white, and "Bulk Product Creation Form" in black] Let's go step by step.
  • First you have the Product Information. You can field [used as a verb meaning to fill-in the box or field] the SKU. This uses tokens to generate the values. Let's call it "PRODUCT". On the right side you will see ["example variant SKU PRODUCT --Action"] an example cocaffeinated [?] as an example. It gets these examples [Genres: Action, Comedy and Drama appear] from the combinations. You need to set a price - a fixed price - for each variation. And a Title. That works the same way as the SKU [in being a form field to fill-in]. So you can see an example of how a product is created. You can configure this and we will see that in a moment. 
  • Then you have the combinations. [headed COMBINATIONS in blue]. The combinations you can select. For example if you don't want to get Comedy generated you just fill this out and it won't generate it. Or you can select everything. [all options shown highighted in white on black]. 
  • You also have "STATIC VALUES" [a blue heading to a box at the bottom of the screen]. You have combinations, and if you have fields that you generate as static; it won't generate any combinations for that.
We have create products; we have create products and create product display. So let's create product display in a minute. If you click - this has actually generated three new products. There are the three products that are a combination of our fields.

You can configure how the bulk product creation module behaves. If you go to store>configuration>bulk product creation, you have some options here [on a page headed "PATTERNS" in black under "Bulk product creation" in white]
  • You can define the SKU pattern, [6] with whatever separator you want, or whatever.
  • The Title as well.
  • And you have Tokens support for this. Some of the tokens you can use - title; a combination of values, and also you have the  
  • display node settings.These are very interesting because here is where you decide if you want to create a display associated with the product. You can have the [radio] button "save and create display" [selected], and you will get into a pre-populated display form with the product generated. 
  • You can avoid [destracting attention] from the user with this. You can [as it says on the screen] silently create a display node automatically, so the user won't notice. An excellant way to start hiding the user's display if you don't want the user to see that.
  • You can also create a display for every product. [it says "create a display node automatically for every product created] These [top two radio buttons if either is selected] will create a display for all the products created in a work operation, but this one will create a node for each product; it will associate 1:1.
  • And you can hide the display node fortunately. [this is the last of the 4 radio button options]
Let's use this first option [of the 4]. [Going down the screen to settings for created display nodes] You can also select a content type for the node created.

[Going down the screen past Tokens to "after successful bulk creation, send the user to -"
There's you're redirection. By default you get redirected to the list of products [first radio button] but you can also select a custom location and set the path here. So let's select this and let's...
[8]
...take a look at our other product type. We have a second product type with taxonomy attributes. I created a couple of taxonomies - one for colour and one for size. Size and colour and associated term reference here. So they are exposed to the bulk product creation, and also exposed as attributes in the cart form. OK. So if I go to products>bulk add product with taxonomoy attributes , I will have the same product information here for the fields SKU, Price, Title. Here [appearing to the left of these fields on the form] are the examples of what it will look like. So you have the combination. And here [on two new drop-down select menus below] we have all the combinations we want. If we select all of them we are ending with nine products created, but you could also avoid to create a combination for a small size, or just create it for a small size. If you have many fields, all of the values are going to be displayed here, so you can safely select whatever you want.
[10]
So after the field creation settings, let's create the product and create the display.
I'm going to end. This is the Node form. It created [states "successfully created nine new products"] nine new products. We are in the product display creation form. When you are here you can fill all these fields for the display. And here in the product selection you will have [in a separated list] all the nine products that we have just created. So we save this [presses save; goes to the front page]. We have the product, we have the size, and we have the attribute form created.

So check the whole [node] page [on Drupal.org] for the latest changes because this module is in active development. [11] There is a 1.0 branch that is stable, and all the new features are committed to the 2.0 branch. Bug fixes are of course committed to both branches. Thank you to Sven Laeur for maintaining this module and keeping-up to the active development. And also, if you are using entity reference with Commerce, you may want to check this entity extension; this entitiy reference integration ... which allows you to create values based on the values of the entity reference field.

I hope you enjoyed this commerce sworay and see you in the next one.[answers on a postcard please]