9

I am building a website for a client and I thought that Drupal is the best choice due to the plethora of choices that it gives me. However, this vast amount of choices made my job a lot harder. Let me describe the problem to you:

The client is selling a specific product, let's say VCRs. Every VCR is manufactured by a specific brand (e.g. Sony, LG etc). Every brand has also categories of VCRs that are similar to each other. So when we want to describe the product (the VCR) we basically have to provide the following information:

Brand (e.g. Sony) Category (e.g. FGX ; notice that this is not unique. Another company may have the same name of category) Model (e.g. 4523x)

I also want the users to be able to subscribe to specific brands and categories so that if Sony releases a new VCR they will be automatically notified (or if Sony releases a new VCR of a specific category).

When it came to converting all these to Drupal concepts I simply could not do it. The reason is that there are various different paths that I could use and I just don't know which one is the right one. For example:

  • Is the category a content type or a taxonomy term?
  • Is the brand a content type or a taxonomy term?
  • The model is obviously a content type but how do I associate it uniquely with taxonomy terms (if the answer to the questions above was "taxonomy term")?
  • What modules would I need to use in any case? I have checked the "Relation" module and it seems like it may contain some of the functionality that I need (along with the "rules" module, especially for the notification part).

PS: if you have any good suggestions for resources (blog posts, articles, books, videos etc) that explain how to break down every life requirements to drupal concepts I would really love if you could share them.

3 Answers 3

7
+100

I would do it as follows: Create a vocabulary called 'VCR' Add each manufacturer as a term, then each VCR category as a child of the manufacturer. So your taxonomy structure would be like this:

  • LG
    • FGX
    • Other Category
  • Sony
    • FGX
    • Some Other Category

Note that while FGX is the same term in both places, it will have a different Term ID.

You would then add this to your content type on the Edit Fields page. Select 'Term Reference' under the 'Field' column and 'Select List' under the 'Widget' column. There are other widget options but I think select list is correct in this case.

You would then proceed to install Views, its a contrib module. It basically allows you to list content in very customised ways. (There is more to it than that when used with Panels, another module that you may need.) Go to /admin/structure/views and enable the view named 'Taxonomy term'. This will allow you to override Drupals' default taxonomy display.

At this point going to /taxonomy/term/[int] (where int is one of the taxonomy terms' id) will display all content tagged with that term. You would use Pathauto and Token to create 'pretty' URL's, I would also recommend Global Redirect whenever aliasing content.

You may need to customise the View a little, because I cant remember offhand if it will list all content, including content that is a child term of the current term by default.

Views will allow you to make blocks listing content, and you can get a little fancy and use the core Statistics module to list the most viewed product. Panels is definitely worth investigating if you have time, but in my opinion keep it used sparingly.

Views also enables you to easily provide RSS feeds that people can subscribe to. I do believe it is possible to do email updates as well but it was a while ago on Drupal 6 and my memory is shocking. I think Simple News was what we used. In as I recall it requires some configuration but you could then send an automated digest every so often. Not exactly what you requested, but it may be possible to do it with Rules as you mentioned.

If you will be doing online sales I think Drupal Commerce would be your best bet though I haven't used it in production nor played with it for about 6 months or more.

As for the PS, I couldn't find any when I started Drupal, but to me the general rule so far has been: If it isn't an object, may be useful for sorting, or categorises anything in the real world then it belongs in a vocabulary as a term.

1

"Content Types" are containers that accept a variety of types (integer, string, taxonomy, nodes, etc.).

In your case it appears you already have a rigid structure of strings which are related and have a predefined hierarchy which is exactly what taxonomy is efficient in handling. So I would use taxonomy.

To easily manage large taxonomies I would encourage you to install the following modules:

And Hierarchical Select to provide assistance the end user. Please try the demo at the modules site.

1
1

Is the category a content type or a taxonomy term? Is the brand a content type or a taxonomy term?

If you want to display some content regarding the category or brand which is unique to that category or brand, then have a content type for it, so that you can add content for it. Or else make them as taxonomy terms.

Your Answer

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