Drupal 7: Pathauto hierarchical taxonomy terms pattern - drupal-7

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.

Related

SuiteCommerce Advanced - Show a custom record on the PDP

I am looking to create a feature whereby a User can download any available documents related to the item from a tab on the PDP.
So far I have created a custom record called Documentation (customrecord_documentation) containing the following fields:
Related item : custrecord_documentation_related_item
Type : custrecord_documentation_type
Document : custrecord_documentation_document
Description : custrecord_documentation_description
Related Item ID : custrecord_documentation_related_item_id
The functionality works fine on the backend of NetSuite where I can assign documents to an Inventory item. The stumbling block is trying to fetch the data to the front end of the SCA webstore.
Any help on the above would be much appreciated.
I've come at this a number of ways.
One way is to create a Suitelet that returns JSON of the document names and urls. The urls can be the real Netsuite urls or they can be the urls of your suitelet where you set up the suitelet to return the doc when accessed with action=doc&id=_docid_ query params.
Add a target <div id="relatedDocs"></div> to the item_details.tpl
In your ItemDetailsView's init_Plugins add
$.getJSON('app/site/hosting/scriptlet.nl...?action=availabledoc').
then(function(data){
var asHtml = format(data); //however you like
$("#relatedDocs").html(asHtml);
});
You can also go the whole module route. If you created a third party module DocsView then you would add DocsView as a child view to ItemDetailsView.
That's a little more involved so try the option above first to see if it fits your needs. The nice thing is you can just about ignore Backbone with this approach. You can make this a little more portable by using a service.ss instead of the suitelet. You can create your own ssp app for the function so you don't have to deal with SCAs url structure.
It's been a while, but you should be able to access the JSON data from within the related Backbone View class. From there, within the return context, output the value you're wanting to the PDP. Hopefully you're extending the original class and not overwriting / altering the core code :P.
The model associated with the PDP should hold all the JSON data you're looking for. Model.get('...') sort of syntax.
I'd recommend against Suitelets for this, as that's extra execution time, and is a bit slower.
I'm sure you know, but you need to set the documents to be available as public as well.
Hope this helps, thanks.

Drupal 7 : bind two or more taxonomies

I'm using drupal 7 to make a kind of humanities collaborative portal.
Let's say I have 3 taxonomies : authors, concepts, dissertation and the corresponding content-types.
I would like to bind the terms in these taxonomies together.
If I write a dissertation, I would like to be able to choose at least one couple of author-concept as though it was one new tag.
For example, I wrote a dissertation about "What is the self ?", and used Husserl's cogito on one hand and Hume's self on the other hand.
I'm coding my own search engine to fetch these couples so that if I search "Hume cogito" my dissertation won't be in the results.
My problem is that I don't know how to bind taxonomies in that way nor linking those taxonomies when the user creates a content.
I thought about hierachical taxonomy but it doesn't seem to make sense.
Any idea welcome !
In our Project we were using a similar functionality for glossary search.
There are 2 methods one is
Create a content-type for Items.
1)Any term can be mapped to multiple other terms by creating two fields of term reference and making the second field with add many(1 term -may terms relationship) .
2)There was a module in drupal 6 called "Term Relations" which i believe has dev version for drupal 7

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 - How do I use pathauto taxonomy terms in views arguments

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.

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