2

Hi i really would like some advise on best practices on setting up some data for my Craft APP.

Most of my documents will be linked to vehicle make/model/trim/year. EG Audi A5 Sport 2009-2016 and/Or Audi A5 Sportback 2017+ .

What would be the best way to do this? Would it be to create a new field type or use something like a table?

My First Idea was to do the following:

A Structure

  • Level 1 : Vehicle Make
    • Level 2 : Vehicle Model
      • Level 3 : Vehicle Trim

Then create a field (table) where i select either the trim or model, then select a date range.

But what i want to do is in the front end select documents by everything under Make and/or Model and/or Trim and/or Year

But i am not sure this is the best solution.

Can anyone recommend?

2

Goal: Filter documents by related vehicle characteristics.

My first idea would be to create it as such:

  • Create an assets volume where all your documents will be uploaded to.
  • Create a vehicle category group for your vehicles such as you already defined (the structure you mentioned)
  • Add 2 fields to the assets volume:
    • Vehicle (category field)
    • Year (date field)

This will allow you to add the relevant data to each document. You can than display the documents on your frontend and search/filter them by category and/or date. How you do that is up to you, either with Twig serverside or with VueJS for example client side.

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.