1

I am quite new to Drupal and I'm having troubles in some tasks.

I need to show food categories and food products as its contents. In order to do that, To begin with, I created a content type with the field of taxonomy term reference for products and taxonomy vocabulary for categories.

Secondly, I added categories as taxonomy terms and products as content by choosing its related category. Everything is fine up to now.

For the categories page output, I created a view to show categories (taxonomy terms) and set details as below:

Fields Taxonomy term: Name

Filter criteria Taxonomy vocabulary: Machine name (= Food Categories)

path: /categories

This page help me to show categories.

For the other page that needs me show each product(content) for the selected category I created another view and set details as below:

Fields Content: Food Category Content: Title

Filter Criteria Content: Type =(Food Product)

Contextual Fiter Content: Food Category (filed_food_category)

Contextual filter settings are:

When the filter value IS in the URL or a default is provided Option: Override title is checked and value is %1

Specify validation criteria Option: Validator is checked and set taxonomy terms where vocabuary is food categories Filter value type set to Term name converted to term ID

Option: Transform dashes in URL to spaces in term name filter values is checked

path: /categories/%

This view is able to show me each content related category. For example when I tried to type /categories/category-1 I can see output through this view properly.

And I needed category titles from the first taxonomy terms page redirect me second view which shows each product under the related category. To achieve this I set url each alias of taxonomy terms as categories/category-name and checked the option of the filed Taxonomy Term:Name as Link this field to its taxonomy term page.

But here is the problem. When I attempt to click link on each food category (taxonomy term) provided by first view redirect me another page while it is supposed to redirect to second view page. After some research I figured out that links on the first taxonomy terms view redirect me default taxonomy page. And I read that it's possible to override default taxonomy page by using some extra module called Taxonomy Display and Display Suite. After installation modules and I follow the insturctions, I found out the option taxonomy terms page display under the related taxonomy vocabulary. I set Associated content display as views and picked related view(second view I created) but I can't get output of second view. I get all content listed(not filtered).

Please help me, I feel very desperate. Thanks in advance.

  • can you send your content and views using features on dropbox i will surely look into it and then i would be able to understand and help u better. – Ali Nouman Jan 23 '14 at 9:55
2

Open a view you have create

1) set the path: /categories

2) add a CONTEXTUAL FILTERS as

enter image description here

3) OR add a RELATIONSHIPS as

enter image description here

after save a view

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.