1

I have entries called products. Those entries are organized in categories. I'm using fields to save technical data for each product ( ex. Flow rate, Pressure, Voltage, etc. ). Not all fields suit all product categories ( ex. Voltage doesn't make sense for pneumatic pumps ). Is there a way to associate some fields only to products in a specific category?

Thanks

3
  • It seems like this would be a good use case for Structures and Entry Types?
    – Jalen Davenport
    Commented Aug 28, 2017 at 14:27
  • I thought about that but it doesn't seem the right solution to me. Products are not different entry types, they just have different features. Also, it can become tricky to add other layers of categorization to different entry types. Commented Aug 28, 2017 at 15:39
  • @AlessioBreviglieri There is no way to natively do that in Craft (right now). The simplest way on the front end through templates is to check for each field and show only the ones that have a value defined. Otherwise I see a way in matrix fields. Commented Sep 1, 2017 at 9:03

1 Answer 1

1

So I'm going to add this as an answer just in case others find it a useful option to pursue.

I would create your fields; voltage, flow rate, etc. then I would create a Structure called Products with different Entry Types corresponding to the various categories you are using to sort your products. Then you can add your fields to the appropriate Entry Types. Then when you go to add a new product, you'll have a dropdown where you can select what Entry Type this entry should be.

That's how I would setup your site structure if I were in your place 👍

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.