AnswerBun.com

Taxonomy terms with associated nodes: display page by page navigation in node page?

Drupal Answers Asked by Parvateesam on November 13, 2021

Hi i have a content type called Product and have fields(title,description,code,image) and also have vocabulary categories like below formate

parent term 1 
 -child term 1
    --sub child term 1.1
    --sub child term 1.2
    --sub child term 1.3
    --sub child term 1.4
    --sub child term 1.5
parent term 2
  --child term 2
    --sub child term 2.1
    --sub child term 2.2
    --sub child term 2.3
    --sub child term 2.4
    --sub child term 2.5
.
.
parent term 5
  --child term 5
    --sub child term 5.1
    --sub child term 5.2
    --sub child term 5.3
    --sub child term 5.4
    --sub child term 5.5

so i want to display my product node page first parent terms list when i click parent term 1 then it’s display all related child terms in next page after that when click child term 1 display all related sub child terms list in another page after that when i click sub child term 1.1 need to display related products list with above fields.Please find below flow of screen shots.

Taxonomy Parent Terms list
Step 1
enter image description here

Step 2 when i clk Parent term 1 need to display all related child terms in another page like below
enter image description here

step 3 when i clk child term 1 need to display all related sub child terms in another page like below
enter image description here

step 4 when i clk sub child term 1.1 need to display all related node i.e product items list with above fields info.
enter image description here
Please advice
Thanks.

One Answer

For this you will have to use view module.

Step 1: Create a new view from Administration > Structure > View. Click on + Add new view.

Step 2: Give a name to your new view. From 'Show' select Taxonomy terms and from type select appropriate taxonomy vocabulary (I assume name is 'product' here). Check either page or block and click 'Continue & edit'.

Step 3: In First Page or Block under 'Filter Criteria' click on Add and select Taxonomy Vocabulary and set it to use product. Click on Add again from Filter Criteria and select Taxonomy term and set it to Parent term 1, Parent term 2, ..... Now in preview section you will see the Parent terms.

Step 4: Under FIELDS click on Add and select Taxonomy term: Term ID and click on Apply. In Configure field page check on Exclude from display and click on apply. (I assume Taxonomy term: Name is already there.)

Step 5: Rearrange the order of fields by clicking on drop down icon besides Add under FIELDS. Make user the Term ID appears above Term Name and Apply.

Step 6: Click on Taxonomy term: Term Name and expand REWRITE RESULTS. Click the checkbox Rewrite the output of this field and in text area name Text, type in [name] and Apply.

Step 7: Create a new page in same view +Add > Page or create a different view as in Step 1 & 2.

Step 8: In new view page set the path under PAGE SETTINGS to subchild/tid (here tid refers to parent tid or taxonomy id).

Step 9: Follow the steps 3 to 6. Instead of Parent term 1, select Child term 1.1, Child term 1.2, ... assuming Parent is 1. And set href to child/tid for step 6 here tid refers to child term 1.* tid.

Step 10: Follow the same procedure as in step 8 & 9 for other child terms.

Step 11: Follow the same procedure as in Step 8 to 10. However set path under Page Settings to subchild/tid and href attribute for step 6 would be product/tid, here tid is subchild tid or taxonomy ID.

Step 12: Follow the same procedure as in Step 11 for all subchild terms.

For Displaying Products:

Step 1: Create a new View from Administration > Structure > View. Click on + Add new view.

Step 2: Select Content from Show with appropriate type. Check on page and click on Continue & edit.

Step 3: Set the path in Page Settings to product/tid and from Filter Criteria select the Taxonomy term appropriate to the product to be displayed.

enter image description here enter image description here enter image description here enter image description here

Answered by sarathkm on November 13, 2021

Add your own answers!

Related Questions

How to create and check block revisions?

1  Asked on November 8, 2021 by user3560198

   

Custom module with config exposed in json api

1  Asked on November 8, 2021 by daniel-harper

   

Not able to see < character in front end

2  Asked on November 5, 2021 by jos-l

 

Limit filter operators

1  Asked on November 5, 2021

   

Dynamic filters based on another filter

1  Asked on November 5, 2021 by soundcheese

   

How to add a field to menus?

1  Asked on October 26, 2021

     

Drush cr is responding with Bootstrap Failed

0  Asked on October 26, 2021 by chanel

 

How do I create a table when a module is installed?

1  Asked on October 26, 2021 by david-montera

     

Approaches for multi-field values

0  Asked on October 26, 2021 by ian-stewart

   

Pager not being rebuilt after $form_state->setRebuild() is called

0  Asked on October 26, 2021 by kenny83

 

Where are Commerce 2 hooks (or Events) in Commerce 2

1  Asked on October 26, 2021 by wally-kolcz

     

Show own content in Media Library

0  Asked on October 26, 2021 by rafaticarte

   

Ask a Question

Get help from others!

© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP