Closed (fixed)
Project:
Ubercart
Version:
5.x-1.7
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
29 Jan 2009 at 13:02 UTC
Updated:
15 Feb 2009 at 14:10 UTC
Jump to comment: Most recent file
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;
}
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | shorten_path-d6.patch | 1.81 KB | Island Usurper |
| #4 | shorten_path-d5.patch | 1.81 KB | Island Usurper |
| #3 | shorten_path-d6.patch | 1.8 KB | Island Usurper |
| #3 | shorten_path-d5.patch | 1.8 KB | Island Usurper |
Comments
Comment #1
psynaptic commentedJust 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
Comment #2
thill_ commentedI 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.
Comment #3
Island Usurper commentedThere 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.
Comment #4
Island Usurper commentedcha0s 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.
Comment #5
psynaptic commentedThanks Lyle!