On a site I've just updated to 5.x-1.7 the catalog paths reverted to catalog/tid/term without underscores for term. All my URL aliases were set up for terms with underscores.

Anyway, I had to modify uc_catalog_path() to fix this issue for the time being.

/**
 * Create paths to the catalog from taxonomy term.
 */
function uc_catalog_path($term) {
  $separator = '_'; //variable_get('pathauto_separator', '-');
  $path = preg_replace(array('/\W[_ ]?/', '/[_ ]/'), array('_', $separator), strtolower($term->name));

  if (function_exists('iconv')) {
    $path = iconv('UTF-8', 'ASCII//TRANSLIT', $path);
  }

  return 'catalog/'. $term->tid .'/'. $path;
}

Comments

psynaptic’s picture

Just to make it extra clear:

Old style URL created by uc_catalog_path():

catalog/368/indoor_lighting

New style URL created by uc_catalog_path():

catalog/368/indoorlighting

thill_’s picture

I can confirm there was a path issue upgrading to 1.7, all i did to correct was to delete all aliases and bulk generate again.

Island Usurper’s picture

Assigned: Unassigned » Island Usurper
Status: Active » Needs review
StatusFileSize
new1.8 KB
new1.8 KB

There was a post on ubercart.org that proposed that the catalog urls shouldn't have the term names in them to begin with. I think I agree, so this patch will change the appropriate lines in the module, and provide an update function for your existing aliases. Dealing with both issues at once seemed like a good idea to me.

I really want someone to check the database update on Postgres. I'm not quite sure if the regexp I use for the substring works like I think it should.

Thankfully, uc_catalog didn't need any Drupal 6 specific updates yet, so I was able to use the same update function for everybody.

Island Usurper’s picture

Status: Needs review » Fixed
StatusFileSize
new1.81 KB
new1.81 KB

cha0s found that the term id needed to be cast as some kind of string for CONCAT() to work in Postgres, because that's how Drupal defines it. Committed these edited patches.

psynaptic’s picture

Thanks Lyle!

Status: Fixed » Closed (fixed)

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