Drupal 7 - How do I use pathauto taxonomy terms in views arguments - drupal-7

I have been banging my head against this problem all day. I'm using Drupal 7, and I'm trying to create a contextual filter that uses the pathauto string for a taxonomy term, not the taxonomy term ID.
So, I can make this work:
http://foobar.com/tags/1
But not:
http://foobar.com/tags/tagname
I have created a contextual filter of 'Content: has taxonomy term ID'. I have turned on the default taxonomy view and modified the path in it to try to create a URL that will work. I have gone into /admin/config/search/path/patterns and modified the taxonomy term path. As a result I can make the numeric ID appear in almost any URL with any prefacing text, but I can't get my view to use the pathauto-generated string for a taxonomy term instead of the taxonomy ID.
Any ideas? Am I missing something? All help is appreciated.
--Marshall

The default view "Taxonomy term," is using a contextual filter very similar to what you are trying to achieve, so possibly this could assist you in how to set something like this up. I would try creating a view of type taxonomy instead of content though.

Related

Changing default "Taxonomy term" view to add a filter and change path in Drupal 7

I am trying to do a seemingly simple thing but unable to come up with anything.
I'll be specific here for what I want to achieve. I want to clone the existing Taxonomy term which has a path of /taxonomy/term/%. After cloning this view, I wanna make the following changes to it:-
Change the name to Document of Taxonomy Term
Add a filter to this view of a field called is_document. It's a checkbox which is when clicked shows that this node of my taxonomy term is a document.
Change path to /taxonomy/term/documents/%, which shows that I am opening all nodes of this term which are marked as document.
Now when I open my site, let's say with the URL www.mysite.com/organisation/company/documents, it doesn't pick the view. The URL www.mysite.com/organisation/company works as it picks the default Drupal View.
Any idea what I can do here?
I hope I was able to explain efficiently.
UPDATE
I used TVI, but it changes all the pages of my taxonomy terms. I don't wanna change my current scenario where normal taxonomy term pages are opened through /taxonomy/term/% (native Drupal view). I just wanna open all taxonomy terms with a document filter when /taxonomy/term/documents/% view is selected.
Thanks.
I suggest you to download and install Pathauto for URL aliases patterns.
In your Views, you set the path at: taxonomy/term/documents/%
In Pathauto settings, you to go "Patterns", then scroll to the taxonomy section where you can set a new URL pattern: [term:vocabulary]/[term:name]/documents
Then, go to Update tab and update all the paths for Taxonomy.
Enjoy your new Views.

Addressing the tab menu in view when using taxonomy

I use taxonomy terms to address my menus(these taxonomy terms show the structure of my site) so when I create a view I should use the taxonomy path (instead of alias) for the page setting (the only way that I can link the view to my taxonomy address path as far as I know :P ). whenever I see the page URL I can see the alias. now I'm trying to set up a page that has 2 tabs. I have set it up but the problem is when I click in the tab I see the taxonomy path instead of alias ? (for example taxonomy/term/6/digital instead of CCTV/digital However default menu tab still work correctly and show the alias CCTV)
Is there any way to show the alias instead of taxonomy term address ?
I assume that you have a view that is filtering your taxonomy terms. If you render the results as fields, each field can have it's formatter. If you need a custom form of the output, you can define your own formatter or generate one via GUI with help of: custom formatters.
In case that you render your output as rendered entity, you need to find the right template file and use the drupal_get_path_alias() function within it.
As last I would hint you a great module that also might help you: taxonomy menu

Drupal 7 expanding fields

I have a field in a cms called 'services' the services is a lsit of checkboxes with the values
1|digital
2|web
3|print
4|apps
The issue is each of the options has a related url. Is there way to link a url to a 'service' or am I looking at taxonomy to solve this issue?
You need to use a taxonomy. A select list is simply a key/value pair with no other additional data. If you build a new taxonomy, you can either use the taxonomy URL for your purpose or you can add a Link field and give each term a specific URL and tie that in somehow, maybe through Views or a custom display.

Drupal 7: Pathauto hierarchical taxonomy terms pattern

I have a Drupal 7.9 taxonomy vocabulary according to the following scheme:
category-1
category-1 > subcategory-1-1
category-1 > subcategory-1-2
category-1 > subcategory-1-3
category-2
category-2 > subcategory-2-1
I want to reflect this taxonomy hierarchy in my page url path like
category-1/subcategory-1-1/page-123
To achieve this I'm using the modul Pathauto version 7.x-1.0. but I don't know
which pattern I have to use.
Currently I'm using [node:%field_taxonomy%]/[node:title] but with this pattern the url path is just subcategory-1-1/page-123, so the complete hierarchy isn't reflected. Is there a taxonomy tree pattern? I can't find any updated information about this and valid patterns seem to change in every version of Pathauto.
After some trial and error I came up with a way which works pretty good for me while creating custom URL paths using taxonomy terms. All you need to do is to install an additional module called Entity API. You can find it here http://drupal.org/project/entity. After installing you should enable both Entity API and Entity tokens modules. Entity tokens provides token replacements for all properties that have no tokens and are known to the entity API.
First, go and create a new taxonomy vocabulary. Let's call it "Category" and add some terms. Then for a content type you want to have a custom URL path you need to create a new term reference field. I don't know why but it's not working with the standart field_tags. So, make sure to create a new one. Let's also call it category and use our previously created vocabulary "Category" as the source. And here's another thing you need to take into account: you have to label this field with a small letter; otherwise it's not working for an unknown to me reason ;). You'll end up with a field_category field.
Go to URL Aliases administration page -> Patterns. Expand replacement patterns for Content paths -> expand Nodes -> you'll see category at the bottom, expand it. Ok, now you're ready to use taxonomy terms tokens.
Use something like [node:field-category:name]/[node:title] where [node:field-category:name] is the name of the taxonomy term and you'll have a path like mysite.com/term/title.
By the way, I use Pathauto 7.x-1.0-beta1, Token 7.x-1.0-beta2 and Entity API 7.x-1.0-beta8.
Good Luck! ))
http://drupal.org/node/1044980#comment-4562844
You can create url with this pattern:
[node:field-category:vocabulary:name]/[node:field-category:parents:join:/]/[node:field-category:name]/[node:title]
In your particular situation you can go away with using following pattern for taxonomy items:
[term:vocabulary:name]/[term:parent:parent]/[term:parent]/[term:name]
And for node pattern:
[node:%field_taxonomy%:url:path]/[node:title]
There is downside tho - term pattern will handle up to three levels in this case. So you can not make it unlimited with this approach. (I believe you can add term:parent:parent:... as many as you want).
Although, it will handle LESS than 3 levels fine (just tested to make sure).
As far as I know, basic Drupal + Token + PathAuto is not able to create paths, like you want them to.
Check my answer here. You can use the taxonomy entity index module for achieving such behaviour.

Drupal 7 views filter by node's taxonomy term

I have a similar question to my previous one (Drupal 7 views filter by dynamic taxonomy term), it's only the other way round.
I have a "partner" content type, each with it's own taxonomy term. The other content type is a regular page with multiple terms from the "partner" vocabulary. In my regular nodes, I want to include a few of the "partners" in a view block.
The view should filter only those relevant partner nodes (those tagged with one of the regular node's tags).
Could it be done this way? The problem is that I can't get the term names from URL via contextual filters...
After googling the whole afternoon (and posting it there), I eventually found the answer.
It's based on a tutorial on scito.ch (thanks), with only a few modifications. On the Content: Has taxonomy term ID (with depth) filter, be sure to check the Allow multiple values checkbox. Also (there's a lot of wrong tuts for that), don't specify anything in the WHEN THE FILTER VALUE IS AVAILABLE OR A DEFAULT IS PROVIDED. It's important you specify all those 3 contextual filters.
Hope this helps someone and saves him a sunny afternoon :)

Resources