I have a simple content type set up with a required HS taxonomy field on it.
I have set the automated alias settings in pathauto for the node type to be - [save-lineage-termpath-raw].

I have also set the HS select configuration to 'save the term lineage'.
When i create the node the [save-lineage-termpath-raw] token is empty and the node just gets the URL alias of node/[nid] instead.

I have attached the cck_export + the HS export if you need it.
In the general taxonomy settings for the chosen vocabulary i have the following -
- Use HS for this vocab
- Save term lineage
- Allow from any level
- content type ticked

Comments

tayzlor’s picture

I found a way around this, if you use [save-lineage-termpath:vid] and replace the vid with the vocabulary ID you are using to replace the term paths. The bug still persists with the originally problem, this is just a workaround, However the workaround poses a second problem...

my path gets output term1-term2 instead of term1/term2. I noticed in the documentation it says -

However, by default it uses the separator
you've configured Pathauto to use (if you aren't using Pathauto then it will
default to a dash). You can override this by setting the hs_taxonomy_separator
variable. Also, when you're using Pathauto and it seems to be stripping the
separator you've configured, then you may want to configure that character in
Pathauto's Punctuation settings to "No action (do not replace)".

I set the variable doing -

  variable_set('hs_taxonomy_separator', '/');

now i get the following - term1term2 (note NO separator). It's stripping the forward slash character out.
In the punctuation settings for Pathauto there is no option to configure that specific character to be 'No Action'.
Any ideas how i can achieve term1/term2 URL path with this module?

wim leers’s picture

Title: [save-lineage-termpath-raw] does not work? » HS' [save-lineage-termpath-raw] does not work — how to generate a "multi-level path addition" token?
Project: Hierarchical Select » Pathauto
Version: 6.x-3.x-dev » 7.x-1.x-dev
Category: bug » support

I've noticed this too. Pathauto changed this behavior: it now always strips the forward slash. I now have no idea how to generate a token that results in a "multi-level path addition" (not sure what the right term is). Let's ask in the Pathauto issue queue.

greggles’s picture

If you look at pathauto_clean_token_values in pathauto.inc you should see the code that will either strip, or not, based on the type of token (path-raw or alias being the key ending words for tokens that should contain forward slashes). If that got broken somehow we definitely need to fix it. Is the problem also in 6.x-1.x dev?

tayzlor’s picture

i think this is a HS problem rather than a Pathauto one.
just done a bit of investigation there and found the following -

The token name we are trying to convert is actually 'save-lineage-termpath-raw:3' , since its from vocabulary 3. It therefore catches the else statement inside pathauto_clean_token_values() because the token string does not end in -raw ?
This in turn means that the '/' slash in the token does not get respected and gets converted to a '-' dash instead.

As the 'save-lineage-termpath-raw' token also does not work properly it is not possible to use that.

so we need to patch 'save-lineage-termpath-raw' token to work, and also change how the vocab tokens work, perhaps to include the [vid] in the middle of the string rather than the end, something like - save-lineage-termpath-2-raw, which would work?

tayzlor’s picture

StatusFileSize
new2 KB

attaching a patch which should cover the vocabulary case above.

tayzlor’s picture

Project: Pathauto » Hierarchical Select
Version: 7.x-1.x-dev » 6.x-3.x-dev
Category: support » bug
Status: Active » Needs review

moving back to HS module, setting patch to needs review.

wim leers’s picture

Makes sense, patch looks good (I didn't look at the pathauto code though). Does it work for you? Thanks for looking into this!

tayzlor’s picture

patch works for me, i'm using it successfully in my dev environment, but ideally would be good if someone else but me confirmed it worked! =)

wim leers’s picture

I've marked #420548: Problems with URL alias with pathauto and HS' [save-lineage-termpath] token as a duplicate of this issue. Hopefully he will test your patch and report back :)

Bilmar’s picture

subscribing

wim leers’s picture

@trupal218: please test the patch!

Bilmar’s picture

hello Wim Leers, sorry I couldnt test it last yesterday but I will be testing it tonight (asia time) and will post with feedback. Thanks for the great work tayzlor

Bilmar’s picture

patch worked great on test environment and vanilla install! thanks again for the great work

wim leers’s picture

Status: Needs review » Needs work

Excellent! Thanks, trupal218!

Before I can commit this patch though, we need an upgrade path … and that won't be easy. There's two ways: continue to support the old tokens, or attempt to replace all instances. The latter is impossible. We can update all pathauto tokens though. Are there other popular modules that use tokens?

flaviovs’s picture

Patch in #5 also worked for me. The hard part was to figure out how to set the hs_taxonomy_separator variable. I managed to do it by changing $conf in settings.php. Maybe this be in the documentation also (or -- preferred -- you implement some GUI to change the variable).

wim leers’s picture

Nobody who wants to contribute an upgrade path?

wim leers’s picture

Category: bug » feature
Status: Needs work » Closed (won't fix)

Closing due to lack of response. Feel free to reopen.

caesarce’s picture

Version: 6.x-3.x-dev » 6.x-3.6
Category: feature » bug
Status: Closed (won't fix) » Active

Having trouble getting this to work correctly. Is the patch still necessary and what are the correct steps for putting the variable_set('hs_taxonomy_separator', '/'); code in place?

wim leers’s picture

Status: Active » Postponed (maintainer needs more info)

Try the latest development snapshot without any other special measures. It contains a fix for these tokens.

caesarce’s picture

Status: Postponed (maintainer needs more info) » Postponed

Works like a champ. Thanks for the great work on this module. I'm delivering a project using taxonomy and your tools to drive structure for a fairly complex SOP model. This should be a good test for your dev version. Let me know if you need any specific features tested to move toward a release candidate.

greggles’s picture

Status: Postponed » Fixed

Great news.

wim leers’s picture

@caesarce: *awesome*! :) Let's see how this initiative works out: #1055536: Help test the development snapshot to get the HS 3.7 release for D6 out! :)

@greggles: yes, indeed! :) HS + Pathauto are merry friends once again. Are you using HS too?

greggles’s picture

I don't have any sites where it's running now, but some previous clients are using it.

wim leers’s picture

Okay, cool :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

OmarQot’s picture

Hi Gents,

I'm not sure if i'm getting this right

when use this for example ([save-lineage-termpath-raw:2])

i get the following error
The Pattern for all xxxxx paths is using the following invalid tokens: [save-lineage-termpath-raw:2]

i'm using version 6.x 3.7

Do I have to do any change to make this work?

Thanks
Omar

sydneyshan’s picture

Getting the same error as in #26 using 6.x 3.7... Is there a fix to this bug available? I've got 1000 nodes to apply pathauto patterns to and the only way that seems to work is to manually save each node (with pattern set to [save-lineage-termpath-raw] )...

halloffame’s picture

Same thing for me as #26 and #27. Help!

rakun’s picture

I am using 3.8. Token [save-lineage-termpath:vid] not working.