Modeling product detail table (arbitrary key)

Hi guys, loving Contentful so far.

I’m currently facing a roadblock. My client carries a lot of products in their inventory, a lot of which have different sets of product detail (specifications) than the other.

For example, these two items have different sets of specifications:

How do I best model this? Thank you!

Hey @ryandi.tjia,

In Contentful, you have content types to make up your fields and denote the type of data that will be included in items that will be created for it.

In the end of the day, the question on whether to create a single or multiple content models depends on how many specifications/fields will be shared among your items.

In the first case, if you were to have completely different specifications across your items, it would make sense to create separate content models, and subsequently create entries on top of each of them.

However, if you were to share many, or at least some fields, you could create a single content model (e.g. product) and leave some fields empty, so that both item1 and item2 belong to it.

Let me know if that makes sense or if you have any other questions :smile:

You also might have a Product content type which holds all the fields common to both products (name, description, SKU, etc.) and a reference field called specifications which can accept an entry of 2 other content types: tool specifications or generic specifications (Obviously, give them names which fit your situation; I’m guessing based on your examples). Those 2 other content types would then have fields specific to each type of item (tool or generic item in this example).

image

Hi Gabriel & Charlie. From your answers, as well as from reading this blog post, I now have a few alternatives to modelling this content. Going to try out what works best for my client.

Thanks for your insights. Cheers.

1 Like