and these are:
- Set up how the visitor would select product website ( and we will talk more about this shortly).
- The "Add to Cart" button for your product.
Case 1 : A simple product with ONE selection parameter
Let us say we want to sell Caps on our Drupal Commerce store. Also assume that the caps have the same size and style but only have different colors. Let us assume a BLUE and a BLACK cap. Let us say that the prices of these caps are also different, say $9 and $11 respectively. So basically one product ( the Cap), one variable parameter (the color) and the related variable field (the Price).
Now we have two ways of displaying a cap that is available in two colors and has a different price tag on it. One way, is show two different products; the Second way is to have one display of the Cap and with some way of selecting the color option to the customer on the website. This second approach is definitely more savvy. This is also how most modern day stores look like on Walmart, LandsEnd of Kohl's etc.
In this case, when you select a BLUE cap, the image of the BLUE cap would show up and it's price. These are the fields of the BLUE Cap product that are tied to the variable field. These are updated with the values ( of the image and price fields) associated with the variable field. We will soon see how this is configured and will park this thought here for a moment.
Case 2 : A simple product with two selection parameters
A good example of this would be to sell a T-Shirts on your website that vary in COLOR and SIZES on your website. So we have two variables or parameters by which the product is defined. There may be any number of fields associate with the product. The underlying logic is that every size and color combination is a separate product. And so it may have it's own price and stock levels.
To elaborate, let us consider that :
- we have 2 colors (say, red and blue) and 3 sizes (Small , Medium, Large) of t-shirts; and,
- they all have the same style and just vary from each other by the color and the size.
Likewise, we could have more than two parameters as well... as in computer parts where you have a motherboard and then various possibilities of RAMs or Processors or Power Supply units that would go with one another in certain combinations. There is no limit to the number of parameters one can set up.
And just as in Case 1 above, you would have a select list to make your selection and the associated field values will update themselves based on the selection. Only there would be two drop-downs (or select lists) for the two variable / parameters here and these would be, one select list for the SIZES and the other would be for the COLOR.
It is also interesting to note that the two variable fields are dependent on the other. The options visible in the second field are based on the first field. For example,
- if we had only S-blue, M-blue, L-blue and the L-red caps (and no S- or M- red caps).
- And we placed the Size field before the COLOR field. then the red cap option would only show up if the L- size was selected and not with other size selections.
- Alternatively, if we had the COLOR field placed before the SIZE field and we selected the RED color, then only the RED color would appear in the COLOR select list.
- As always, the associated fields (image and price) of the referenced product would update themselves automatically.
There are also some key points that need to be noted when thinking of Product Displays (read more about it in the blog,"the Drupal Entities and References") :, these are
- The Drupal Commerce, by design, is separated into the front end piece (such as the Product Display) and the back-end piece (such as the Product and the Product Type).
- The Product Display is a Drupal Commerce Entity. This basically means that the Product Display can have it's own fields, can refer to other Product Displays and also can be referred to by other Drupal 7 References such as the Term Reference and the Commerce' Product Reference. And you will see the Product Reference field that is provided by the Commerce module when we go to create the Product Display.
- The Product Reference is used by the Product Display to tie it to the various products this Display is referenced by. A Product Reference is also one of the Drupal Commerce-isms and is a feature provided by the Commerce Module. You basically tie the various product options to THIS Product Display through the Product Reference.
- The Product Display can be referenced by ONE or MORE or even MULTIPLE PRODUCTS at the same time. You will need to set the reference count to UNLIMITED for multiple references.
- A PRODUCT is also an ENTITY provided by the Commerce Module. We will talk about the Commerce Products in another blog post.
- There are also some pre-requisites before you can set up a Product Display, these are :
- The Products are required before creating PRODUCT DISPLAYS.
- The Product Types are required for creating Products.
- Navigate to Admin > Content > Add Content (node/add/product-display).
- Give the Product Display a Title and a Description.
- Add the Products that refer to this Product Display.
- Now, by default, there is an AUTOCOMPLETE TEXT FIELD that is provided for typing in the products referred to.
- Separate each product reference by a comma.
- One can change the autocomplete text field to either a Select List or Check-boxes and Radio Buttons. For this, navigate to Administration » Structure » Content types » Product display » Manage fields » Product and change the WIDGET from autocomplete text field to the one you wish to have.
- Configuration of the Product Display content type is again more of a Drupal 7 thing rather than the Drupal Commerce thing. So one can add / manage fields, manage the display of fields, change the reference widgets and so on. Feel free to try your hand on it.
- Settings of the Product Display (admin/structure/types/manage/product-display/fields/field_product) :
- Make sure the "Number of Values" for the product references is set to "UNLIMITED".
- Settings of the Product Type (admin/commerce/products/types/(your_prodt_type_here)/fields):
- Make sure that the variable fields are MANDATORY.
- Make sure the the "Number of Values" is 1 for the variable field to function as an attribute selection field on Add to Cart forms.
No comments:
Post a Comment