Hi,

I have searched issues and read through the documentation more than once and I must be missing something. I want to setup a custom view, which I thought I could use custom path with, however when I do this method, I'm able to configure the views and everything works great, but the paths aren't using the path alias.

Therefore what I'm getting is:
category/tid/tid

rather than:
category/fashion/women

Am I missing something, or is this not supported in the latest dev version? I know path alias works properly with default views, however as I said I wanted to setup a custom view that is different then other vocabularies.

Thank you.

Comments

indytechcook’s picture

Category: support » feature

You are not missing anything. Path Auto is only setup to use the standard taxonomy path aliases so anything custom is not available at this time. This is a feature that I have been wanting to add but haven't gotten it on a official list yet. So I'm changing the issue to a feature request for custom path auto support.

indytechcook’s picture

Status: Active » Postponed
indytechcook’s picture

Title: Custom View & Pathauto » Better PathAuto Inegration

Changing the title to better reflect the request.

indytechcook’s picture

Status: Postponed » Active

Setting to Active.

zarudnyi’s picture

Hi,
I'm not sure that is right place for post my issue, so please forgive me if I did something wrong ;)

That module is very helpfull but I can't start it work in way that I need.
I have some hierarchy in my taxonomy vocabulary like that:

Cars (term aliase catalog/cars)
-- BMW (term aliase catalog/cars/bmw)
-- Mercedes Benz (term aliase catalog/cars/mercedes-benz)

I create view with path catalog/% and an argument Term ID with the option Allow multiple terms per argument.
After setup views i create taxonomy menu and enable the option Use term name.
Taxonomy menu was generated and all looks fine but path for second level terms is wrong and don't reflects hierarchy, please look:

Cars (term aliase catalog/cars)
-- BMW (term aliase catalog/bmw)
-- Mercedes Benz (term aliase catalog/mercedes-benz)

Based on the foregoing, I have two questions:
1. What i missing?
2. Why menu items for second level has wrong aliase?

I'll be glad of any assistance.
Thank You.

undersound3’s picture

I am not an expert on this but I think you either have to:

change your custom path to catalog/cars in admin/content/taxonomy/edit/vocabulary/yourvid

or try changing the path in Pathauto.

./admin/build/path/pathauto -> Catalog path settings
set path to catalog/cars/[catpath-raw]

zarudnyi’s picture

Thanks for reply
Main thing is what cars that term too...

@indytechcook any progress here? Default and Vocabulary menu path types works fine and return right path for menu item, but I need custom views for different vocabularies and now I can't get it with right hierarchy path.

indytechcook’s picture

Version: 6.x-2.x-dev » 6.x-3.x-dev

Moving to version 3. This really isn't that hard, I just didn't have time to put it against version 2.

zarudnyi’s picture

Thank you for your attention to this issue.

undersound3’s picture

Title: Better PathAuto Inegration » Better PathAuto Integration
Andrew Gorokhovets’s picture

It would be remarkable!

devkinetic’s picture

I'm using the the "Vocabulary path" and wanted to clean the term name of special characters. This is a slightly different take on pathauto integration.

I merged in the "use term name" option from custom path fapi, as well as as the foreach that was replacing spaces with dashes:

  foreach($tids as $tid) {
    $term = taxonomy_get_term($tid);
    $names[] = strtolower(str_replace(' ','-',$term->name));
  }

Then using the available module hooks in a custom module I added the code below. You can use this yourself by just doing a find/replace on "mw_site" which was the name of my custom module. You can see where I've replaced the strtolower(str_replace()) with pathauto_cleanstring(). I feel this is an overall better solution, as it allows you to use a custom path as well as implement pathauto functionality

/**
* Implementation of hook_taxonomy_menu_options.
*/
function mw_site_taxonomy_menu_options() {
  $options['mw_site_url_encoded_path'] = array(
    '#title' => t('Custom path for URL Encoded'),
    '#description' => t('Enter the path you would like to use for this vocabulary. Only used if menu path type is "URL Encoded path".'),
    'default' => 'category',
    '#type' => 'textfield',
    '#weight' => -15,
  );
  $options['mw_site_url_encoded_use_custom_path_for_term_menu_path'] = array(
    '#title' => t('Use vocab path as base path'),
    '#weight' => -14,
    '#type' => 'checkbox',
    'default' => '',
    '#description' => t('Use the custom path for vocabulary as base path for term menu items. Only used if Menu path type is "URL Encoded path".'),
  );
  $options['mw_site_url_encoded_use_term_name'] = array(
    '#title' => t('Use term name'),
    '#weight' => -13,
    '#type' => 'checkbox',
    'default' => '',
    '#description' => t("If checked, use term name instead of term ID."),
  );
 
  return $options;
}

/**
* Implementation of hook_taxonomy_menu_path.
*/
function mw_site_taxonomy_menu_path() {
  $output = array('mw_site_path_url_encoded' => t('URL Encoded'));

  return $output;
}

/**
* Callback for hook_taxonomy_menu_path
*/
function mw_site_path_url_encoded($vid, $tid) {
  $vocab_path = variable_get('taxonomy_menu_mw_site_url_encoded_path_'. $vid, 'category');
  
  //if tid = 0 then we are creating the vocab menu item format will be /vocabname
  if ($tid == 0) {
	$path = $vocab_path;
  }
  else {
    if(variable_get('taxonomy_menu_mw_site_url_encoded_use_custom_path_for_term_menu_path_'. $vid, FALSE)){
      $path = $vocab_path . '/' . taxonomy_get_term($tid)->name;
    }
    else{
      $path = taxonomy_term_path(taxonomy_get_term($tid));
    }
    if (variable_get('taxonomy_menu_display_descendants_'. $vid, FALSE)) {
      //we wait to run this instead of durning the if above
      //because we only wan to run it once.
      $terms = taxonomy_get_tree($vid, $tid);
      foreach ($terms as $term) {
        $tids[] = $term->tid;
      }
      if ($tids) {
        $end = implode(' ', $tids);
        $path .= ' '. $end;
      }
    }
    if(variable_get('taxonomy_menu_mw_site_url_encoded_use_term_name_'. $vid, false)) {
      $tids = ($tids) ? $tids : array($tid);
      _pathauto_include();
      foreach($tids as $tid) {
        $term = taxonomy_get_term($tid);
        $names[] = pathauto_cleanstring($term->name);
      }
      $path = $vocab_path .'/'. implode(' ',$names);
    }
  }
  return $path;
}

In my use case, these urls point to a view using taxonomy redirect. In order for the view to be able to understand these urls (views won't without the spaces and special characters), set the arg to term id and write a hook_views_pre_build to convert the term names to tid and vid respectively.

If you did it right, you will see your new type in the dropdown on a taxonomy edit screen.

mazz’s picture

Please read my replies here: http://drupal.org/node/903774#comment-3475058 they deal with the issue and how I handled it when integrating with ubercart. To solve my issue I created a module to automatically populate pathauto catalog aliases.

Please note that even with this the beginning of your path still needs to be "catalog/" from within pathauto. Read the above posts to see why this is.

/**
* Implementation of hook_taxonomy_menu_path.
*
* @return array
*  function name => Display Title
*  a list of the path options.
*/
function taxonomy_menu_catalog_path_taxonomy_menu_path() {
  $output = array('taxonomy_menu_catalog_path' => t('UC_Catalog path'));

  return $output;
}

/**
* Callback for hook_taxonomy_menu_path
*/
function taxonomy_menu_catalog_path($vid, $tid) {
  $path = drupal_get_path_alias('catalog/' . $tid);
  return $path;
}
NickWebman’s picture

i'm hosed without this! Need something like whatever/[term]/[term2]

jonaswouters’s picture

subscribing

dstol’s picture

Status: Active » Postponed

Postponing for the time being.

undersound3’s picture

subscribing

dstol’s picture

Status: Postponed » Closed (won't fix)

There will be no more work on the 6.x-3.x-dev branch for the foreseeable future.