views:

164

answers:

2

I am trying to upgrade an old-school PHP site (http://cordair.com/) to work with Drupal running Ubercart. One of the key things is making sure URLs that people have bookmarked stay the same.

My taxonomy looks something like this

Catalog
 + Artists
    + Pablo Picaso
    + Lenardo DaVinci
 + Medium
    + Sculpture
    + Painting
    + Print

The taxonomy is multi-select. So each has 1 artists and potentially multiple mediums (e.g. something can be both an original painting and also available as a print). I want the site to be able to serve up a page at http://foo.com/picaso that lists all the items at or under Pablo Picaso. I also want to be able to have a page like http://foo.com/paintings that lists all the paintings across all artists.

What's the best way to pull this off? It looks like I need to use Path Auto, but it's really confusing to figure out what the right settings are. I also don't see a way to custom tailor the way the taxonomy term is turned into a URL; right now I just get IDs. It looks like there's a way to use term name, but the URLs I am trying to build just use last name and not first.

Forgive my Drupal noob-ness, as I am sure this is all possible and probably easier than I think it is.

A: 

Path auto is for automatically generating path aliases for content based off attributes for that content.

Seems like you are more talking about having some different content types (cck) and relating those types with the node-reference module. Then your picaso and paintings URLs are simple views that that could take arguments or use exposed filters to further limit the nodes displayed.

Eric M
+2  A: 

Possible, but questionable approach:

In order to extract only the last names, you'd need to implement a custom token for taxonomy terms that will do the necessary string manipulation. (You'd want to create a variation of the default [cat] token. This example for a custom node title token might also help to understand the process.)

However, this approach has some serious downsides:

Recommended alternative approach:

To avoid dealing with the above ambiguity problems, and given that the site you want to replace has a pretty small set of target names so far, I'd just use the standard [cat] token, using the full names for the URLs (Pathauto allows you to specify default replacements for special characters, e.g. spaces to underscores or dashes). Then you can add redirect rules for all the old, 'last name only' URLs to the sites .htaccess files to keep them functional while promoting the new versions:

# http://example.com/picasso  => http://example.com/pablo_picasso
RewriteRule ^picasso $ http://example.com/pablo_picasso [L,R=301]
# ... and so on for all old urls that changed

(You might also check the Path redirect module as a 'Drupal internal' alternative to the .htaccess manipulation).


Additionally, I would recommend splitting the 'Catalog' hierarchy in two separate vocabularies, e.g. 'artists' and 'medium'. While this would result in two separate taxonomy fields on the node entry form, it fits the semantic difference and would give more flexibility for filtering, sorting and grouping the nodes down the road.

Henrik Opel

related questions