Discussions

Dealing with multiple product and content types presentation/ Inheritance

I understand good practices with Drupal Commerce demand that you create a product type/content type pair for each kind of product (determined by the attributes related to each product, like size, colour, volume, etc.) like demonstrated in Kickstart. This is fine as long as you do not have too many product types and view modes, but let's say you have N product/node display pairs, each of which has M view modes (and possibly you are using Display Suite for these view modes), then you will have to repeat 2NM times the same kind of operations: first you will have to share the same fields across all these entities, then copy the exact same settings under «manage display».

From a software engineering point of view, this could be solved by introducing the concept of inheritance, as in object oriented programming, so that a bundle could inherit fields and display settings from a main object. Unfortunately, we are not there yet. There is a module called Bundle Inherit, but it does not seem to be maintained that much; moreover, there seems to be no consensus on this topic, as demonstrated by these conversations: Inheriting fields from a base content type and Bundle inheritance.

How would you handle this kind of situation in Drupal Commerce?

Posted: Dec 7, 2012

Comments

jessicakoh on January 1, 2013

Why is it a good practice to have such pairing? Could someone please explain?

This seem to be pretty good. You still need to create a type, but you can duplicate the fields of another type.

ronald on January 2, 2013

if the structure of the given information is different to others.

If you have the same structure, it makes no sense.

For grouping, you have categories listed in taxonomies.

For all product types, you have a basic set of fields, which is reusable for others.