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

  • It seems like this would be a good use case for Structures and Entry Types? – Jalen Davenport Aug 28 '17 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. – Alessio Breviglieri Aug 28 '17 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. – Dom Krulak Sep 1 '17 at 9:03
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, privacy policy and cookie policy

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