Score:0

Best way to handle products with hundreds of different properties

au flag

I've started building a large Drupal Commerce shop for my customer. The customer has about 30000 products: clothes, electronics, decor, candies, etc. That means that in the shop there might be hundreds of different properties along all products. The products will be imported from manufacturers product feeds.

The properties are, for example:

  • Description
  • Country of origin
  • Materials
  • Product care instructions
  • Certificates
  • Composition
  • Paper gramage

It's quite a big job to add a new custom field for every property. Is there any better way to handle those properties?

A requirement is that most of the properties should also be filters in product category pages.

id flag
Taxonomy (tags)?
cn flag
Another option is [JSON Field](https://www.drupal.org/project/json_field). Depending on your database and search backend you may be able to include all the minor (or even major) properties in that field, and then index it with Solr, etc. to get the facets.
au flag
Interesting suggestion Patrick. I'll check it out!
Score:1
it flag

It's already been said in a comment, but yes, if this information is going to be synchronized from a third party and not managed on site, you're free to using something a little less structured like taxonomy terms to import the data. Since one taxonomy term reference can reference terms from a variety of vocabularies, you can still use different vocabularies for the various groups of product attributes but then just add a single, unlimited value reference field on the product type called "Properties" that you use to import all of the properties.

You might just want to check to ensure you can build the search interface your client requires - e.g. that you can show facet blocks by vocabulary. I think you can, just make sure you test it out first before going whole hog.

au flag
Thanks for your answer Ryan! Maybe I was not so clear or then I don't understand that taxonomy solution thinking :D All the properties are in key = value form. There will be maybe 200 different property keys along all products and values differ per product.
it flag
Right, so in that case, I think the idea would be keys = the vocabulary and value = the term. If "Country of origin" is a key and "Mexico" is a value, you'd want to add the "Mexico" term to the product. My proposal would see you use a single "Product properties" term reference field on the product type that includes the "Country of origin" vocabulary in its list of allowed vocabularies. Repeat for all of the other properties.
it flag
This isn't without its display challenges, though ... for example, you may need a custom View or something to format the terms to include the vocabulary in the display, because a typical term display will just list out the terms themselves. You also may want to override the term pages if you don't want the default taxonomy term routes that show all content tagged with the term.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.