How to pass content type filter to taxonomy I created a classified ad website with different content type like vehicle, clothing, mobile phone, computers, etc. Within this content type has a field called location. A location field is an address of the item posted on my website like cities.

My question is on how can I filter location plus the content type. Currently, when I click the location, all of the content type article shows.

Here's an example of what I want:

Select article about vehicle, within the vehicle article is a field called location. When I click the location of the item, the result should include only items related to the previous content type, that is, vehicle content type. Location field is connected to Location taxonomy I created.

BTW, I already installed views and it is working fine.
I think you need to edit the location links to include a second "parameter" so it could look like:

yoursite.com/yourview?location=yourLocation&amp;articletype=yourArticle


For this you would need to implement some hooks. Maybe you can start with hook_preprocess_node. 

What I would do is to:


Use the said hook
Get the location terms available for the current viewed node
Construct the URL based on the term data and content type the way I want it to look.


Then in your view, you need to add just two contextual filters that would be those fields. The location term reference field and the content type.

EDITED

Node view and term link update


Created a new content type name Article 2 (Machine name: article_2) to follow your structure of content types having Vehicle, Clothing and etc. So mine is just Article and Article 2. My content types have the Term reference field of the Tags vocabulary w/c in your setup is the Location.
Added terms into the Tags vocabulary: Term 1 and Term 2.
Created a simple custom module using hook_preprocess_node() w/c looks like:




function yourmodulename_preprocess_node(&amp;$vars) {
  // Check if your term field is being rendered in the node view
  if (isset($vars['content']['field_tags']['#items'])) {
    // Loop through all terms present in the node
    foreach ($vars['content']['field_tags']['#items'] as $index =&gt; $info) {
      $node_type = '/' . $vars['type'];
      // We append the node type to the URL of a term so that 
      // it can be used as a contextual filter in the term view.
      $vars['content']['field_tags'][$index]['#href'] .= $node_type;
    }
  }
}


Remember to do a Flush Cache since were adding a new hook function into the system. Now when you view a node, check the term link(s) listed and you will see that the URL structure is not like http://yoursite.com/taxonomy/term/2/article

Term View


Clone the Taxonomy Term view (So that we wont be changing the original)
Add a second wild card argument in the Path w/c looked like taxonomy/term/% to taxonomy/term/%/%. The second argument would be for the content type.
Under contextual filter add the Content: Type field following the settings in the image.





And then place the Content: Type contextual filter at the second row to match the URL structure w/c would look like:




And that's it. A simple sample result based on this URL http://localhost/drupal/taxonomy/term/2/article would look like:



So it's filtering the right node that has Term 2 as its Tag(my setup)/Location(your setup) and only the Article content type.

My test data are:


Article content type: Article 1, Term 1
Article content type: Article 2, Term 2 (This is the result in the latest screenshot)
Article 2 content type: Article 3, Term 1
Article 2 content type: Article 4, Term 2


Issue

So far I haven't figured out how to use this style with Pathauto so the URL would look better for example, www.mysite.com/illinois/chicago/article.