How about creating links on this format?
http://host/store/product_info/c2-vinyl/p4-led-zep
Again, if this is of any help. In init_ssu.php:
- Change what is inside the loop:
function parse_url($debug=false){
global $request_type;
// attempt to check current protocol being used
// This check is not perfect, but should work most of the time
if ($request_type == 'SSL')
$catalog_dir = DIR_WS_CATALOG;
else
$catalog_dir = DIR_WS_HTTPS_CATALOG;
$extension = trim(SSU_FILE_EXTENSION);
// we want to remove $catalog_dir and
$mr_parts = explode('/', trim(current(explode('?', ($catalog_dir=='/' && empty($extension)) ? getenv('REQUEST_URI') : preg_replace(array($catalog_dir,'/\.'.$extension.'/'),'',getenv('REQUEST_URI'), 1))), '/'));
$mr_parts_count = count($mr_parts);
// first element is always main_page
// even if this is a "static" page, assigning first element to
$_GET['main_page'] = $mr_parts[0];
for($i= 1; $i < $mr_parts_count; $i++){
> $file_name = current(explode(SSU_ID_DELIMITER, $mr_parts[$i],2));
// TODO: an more efficient way to do this?
> if($file_name[0] == 'c') {
> if(file_get_contents($this->cache_folder.$file_name) !== false)
> $_GET['cPath'] = substr($file_name,1);
}
> elseif($file_name[0] == 'p') {
> if(file_get_contents($this->cache_folder.$file_name) !== false)
> $_GET['products_id'] = substr($file_name,1);
}
elseif(isset($mr_parts[($i + 1)])){
$_GET[$mr_parts[$i]] = $mr_parts[($i + 1)];
$i++;
}
else{
$_GET[$mr_parts[$i]] = '';
$i++;
}
}
unset($mr_parts, $mr_parts_count);
if($debug)
print_r($_GET);
}
And two lines here
// Appending category name and product name into the link
if(strstr($parameters,'cPath')!==false || strstr($parameters,'products_id')!==false || $page ==''){
$parameters = explode('/',$parameters);
for($i=0; $i < count($parameters); $i++){
if($parameters[$i]=='cPath'){
> $parameters[$i] = 'c'.$this->get_category_name($parameters[$i+1]);
unset($parameters[$i+1]);
}
elseif($parameters[$i]=='products_id'){
> $parameters[$i] = 'p'.$this->get_product_name($parameters[$i+1]);
unset($parameters[$i+1]);
}
elseif($parameters[$i]=='main_page'){
$page = $parameters[$i+1];
unset($parameters[$i]);
unset($parameters[$i+1]);
}
}
//print_r($parameters);
$this->array_clean_up($parameters);
$parameters = implode('/',$parameters);
}
And one line here:
function _get_name($file_name, $sql_query, $field_name, $original_value){
global $db;
$result = $original_value;
$sql_result = $db->Execute($sql_query);
if($sql_result->RecordCount() > 0){
// remove non alphanumeric
$result = preg_replace("/[^a-zA-Z0-9s]/", SSU_NAME_DELIMITER, $sql_result->fields[$field_name]);
// remove excess underscore
$result = preg_replace('/'.SSU_NAME_DELIMITER.SSU_NAME_DELIMITER.'+/', SSU_NAME_DELIMITER, $result);
// remove trailing _
$result = strtolower(trim($result, SSU_NAME_DELIMITER));
// now prepend the id
> $result = $original_value.SSU_ID_DELIMITER.$result;
// write into file. Cant use file_put_contents since it's not in php4
if($handle = @fopen($this->cache_folder.$file_name, "w")){
if (fwrite($handle, $result) === FALSE) {
// TODO: sound the alarm
}
fclose($handle);
}
else{
// TODO: sound the alarm here
}
}
return $result;
}