0

Currently I am building two content types, and I would like to consolidate them into one. Here is the scenario. I have two content types - Restaurants and Shops. These two have exactly identical fields except for 'Category' which is a taxonomy list. For restaurants, the taxonomy list contains restaurant food categories (asian, italian, etc) and 'shop type' for shops (fashion, electronics, etc). The only reason I have two content types is so that I can enforce the category field which is required.

However, in my mind it seems like it would be better to just have one content type. What I would like to do is create a 'Business' content type where you then select what type of business. In this case, Shop or Restaurant, for example. When the appropriate Business type is selected, the corresponding taxonomy to describe that particular selection will become apparent, and be able to be enforced. So, if I choose 'restaurants' then the restaurant types list will become visible where as selecting shops will display the shop type list.

Any thoughts on the best way to handle this architecture?

0

I personally prefer to set up more content types than less. So in this case, if it was up to me I'd have the Restaurants and Shops as two separate content types. The reason for this is scalability - in the future if you need to add more specific data to either Shops or Restaurants it's much easier to do if they are separate content types from now.

As separate content types it's a little harder to share template files, but this can still be achieved by including files via PHP.

Also you won't need to add any additional code to enforce a particular vocabulary selection depending on another field - the taxonomy module is set up so that you can choose which vocabulary is applicable to a certain content type, so even this core functionality lends itself to creating more content types.

  • That's not always the best strategy. Many content types can also make it harder to perform actions on all of those content types, for instance adding fields. In my work I also learned that end users (in case you're not building the site for yourself) often find it confusing if there are too many types to choose from. – marcvangend Mar 21 '12 at 17:21
  • Adding fields in my opinion is at a small cost. Splitting out content into a separate type after implementation is much harder and riskier IMHO. Also, I usually type Description text and run a short training session with clients to explain how their Content Types fit into the site. I agree though that this needs to be considered on a case-by-case basis, but I generally lean towards creating two content types rather than a single type that might change in the future. – dotmike Mar 23 '12 at 6:05
  • I ended up indeed going with two content types rather than one combined. I believe I will test it to see how user friendly it is, and perhaps also test the combined. Thanks everyone for all the great answered! I played with them all and found they are all great approaches to know. – blue928 Jun 3 '12 at 4:56
1

You can use a Taxonomy vocabulary with 2 level heirachy. Something like this:

    • Restaurants
      • Restaurant type 01
      • Restaurant type 02
      • ...
    • Shops
      • Shop type 01
      • Shop type 02
      • ...
0

I know it is not going to be an answer to your question, but I second mbelos's opinion. The gain seems delusive to me as well.

Think the Views way. Having one content type, how would you imagine setting up a view like "show me shops in town X that offer mens jackets", "show me restaurants that serve chinese or italian"... If you think you can address such scenarios having one type, go ahead - you are probably safe. I'm afraid however that over time you are going to be buried in if's and regret that merge.

0

Conditional Fields will let you show/hide a term reference field, depending on the value chosen in the Business Type field.

Reference field option limit may also be a solution. Using 3 vocabularies:

  • Business Type vocab:

    • Restaurant
    • Shop
  • Restaurant food categories vocab (terms reference Business Type > Restaurant)

  • Shop categories vocab (terms reference Business Type > Shop)

With this setup, a Context for the Business Type taxonomy would provide flexibility for theming, breadcrumbs, active trails, etc. Views would be able to differentiate between the two with a taxonomy filter.

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.