开发者

Product Categorization, Viewing and adding to Menu in Drupal 7

I'm searching for ideas to do the following in Drupal-7:

1- Create product categories (Main category, and sub categories, and products itself...)

ex. Cars, Motor Cycles ... are Main categories of products, Audi, Toyota ... are subcategories of a Cars main category, Audi A8 ... is the corresponding product.

2- Dynamically add the Main categories under a menu item.

3- Main category item when clicked view a page of a related Sub-categories.

4- Sub-Category item when clicked view a gallery of images of related products.

I've tried to work with content types and "Node Reference", and view it conditionally using "Views", or working with Taxonomy. But I think I need to integrate those solutions all to reach what I really want.

What steps should I follow using drupal modules, or Will it need a custom module?

Thanks i开发者_C百科n advance!


The use case you have mentioned is imo best suited for Taxonomy. Its in core.

For Point #1: Create a Taxonomy vocabulary called "Product Categories". Then add terms "Cars", "Motor Cycles", etc to it. Now create child terms under Car's term, called Audi, Tayota etc.

After configuring your taxonomy. Add a term reference field to your content type ( say vehicle). Now you can associate your nodes with the taxonomy terms while creating Vehicle contents.

This approach is very flexible cause the relation hierarchy is maintained in a seperate interface and is not hardcoded into each nodes. Also you can have multiple term to which a particular vehicle belongs to. Like a vehicle can be in SUV subterm, as well as Cars.

I suggest using Taxonomy cause, it will handle the hierarchy ( the tree structure ) much better than node references. And you can leverage that while making views.

For Point #2: You can us Taxonomy Menu ( a contributed Module ) to create teh menu item. Otherwise a view with display type Html List can also be used to list the terms ( and display count as well.. like Cars(36), Motor Cycles(22) ... and so on.

For Point #3: Taxonomy automatically provides you pages to display content belonging to certain terms. To show related content you can leverage the help of Views. For example Arguments -> Taxonomy: Term ID (with depth) will help you grab all the nodes belonging to child terms. Now i understand you dont want to show nodes, but Term.. this could be done by configuring field appropriately to show just the term name in views.

You may find the view export given in here very helpful.

For Point #4: You get a default page for taxonomy term where it shows teaser of associated nodes. If that is not enough for your gallery, you can create a view for sub categories yourself, which takes term-id as argument.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜