1

I have created a Vocabulary (categories) with terms (term1, term2, term3..etc). After that I created a content type (Product) with fields title, description, image. Also, created field called "product type" which is a term reference (categories). Furthermore, I am displaying all terms list in page like term1 term2 term3 with link.

When I click on term1 I want to display related products name, description, image with full details link. I am currently displaying only term related product title with read more link only. [![enter image description here][1]][1] Please Advice.

1

You could install Views module, create a list of products, and filter based on taxonomy (Contextual filter).

  • Thanks for response.Yes i have installed views module but i want to display term name as well image both find screenshot in above,that's why i have displayed statically links then assigned url's too,after that i need to plan overide default taxonomy term display page .Can i have steps for using views to display as well normal overriding process. – Parvateesam Feb 17 '16 at 8:13
  • More than override you could apply two different views, one of terms for the URL: /products/ with no parameters, the other view of the products filtered by taxonomy /products/term1. To switch the views you can use blocks instead of pages, and in the template.php, depending on the URL you use views_embed_view function with the different views. Also you can use specific modules as Context or Rules for this logics. – Cesar Feb 17 '16 at 10:16
  • Great explanation can i have any supported link for that procedure i'm new to drupal – Parvateesam Feb 17 '16 at 10:22
1

Sorry, but I have no tutorial or other pages, you will have to look for each step by yourself in this forum or others. Basically you change the file: /sites/all/themes/YOUR_THEME/template.php, in the function

YOUR_THEME_preprocess_page, you set

if($variables["node"]->nid == ID_OF_PRODUCT_PAGE){
  $variables['theme_hook_suggestion'] = 'page__products';
  if(arg(1) == "") {
    $categories_view = views_embed_view('YOUR_VIEW1', 'block', "");
    $variables["categories_view"] = $categories_view;
  }else{
     $products_view = views_embed_view('YOUR_VIEW2', 'block', arg(1));
     $variables["products_view"] = $products_view;
  } // if
} // if

You must create, previously, a content node which will be a dummy node and where you can inject the blocks. You use the node id in the code. The content of the blocks is printed by using print $product_views or print $categories_view.

You can copy the page.tpl.php in that folder, rename to page--products.tpl.php and clear the cache, and then you are done. I hope it is useful to you, there are dozens of ways of doing the same thing, some better and some worse. Drupal can require 10x effort than PHP alone for complex projects which need a lot of customization.

  • Issue fixed i have override taxonomy page with in views section only.Thanks All – Parvateesam Feb 17 '16 at 13:11
1

Sorry my reputation not high enough to add a comment. Anyway here is the link might able to help you.

Create Views

Views Relationships and Contextual Filters

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.