Jump to content
Sign in to follow this  
Romey-Rome

YASU

Recommended Posts

I've arrived at a solution to the bug: :D

 

When clicking on a product in the new products box the links are:

 

http://www.domain.com/catalog/Speed

 

instead of

 

http://www.domain.com/catalog/DVD+Movies/Action/Speed

 

This fix was borrowed from Seach Engine Friendly URL at:

http://www.oscommerce.com/community/contri...engine+friendly

 

I'm using YASU instead of Seach Engine Friendly URL because YASU doesn't require cache or force cookies. Cache and force cookies are not compatible with other contributions I'm using in my shop.

 

And now for the fix!

 

Edit: /catalog/includes/functions/html_output.php

in the tep_href_link function.

 

After this code:

case 'products_id':
 $product_name_query = tep_db_query("select products_name from products_description where products_id='" . (int)$pair_array[1] . "' and language_id='" . (int)$languages_id . "'");
 if ($product_name_array = tep_db_fetch_array($product_name_query)) {
$product_name = $product_name_array['products_name'];
 }

 

Add this code:

//ADD CATEGORY NAME MODIFICATION - BB 2005-11-08
//If cPath isn't in the URL, category names aren't added to the URL
//This fixes that
if (strpos($parameters, 'cPath') === false) {
 $cat_array = array();
 $cat_query = tep_db_query("SELECT cd.categories_name as name, c.parent_id FROM categories c LEFT JOIN categories_description cd ON (c.categories_id = cd.categories_id) LEFT JOIN products_to_categories p2c ON (p2c.categories_id = c.categories_id) WHERE p2c.products_id = '" . (int)$pair_array[1] . "' AND p2c.categories_id = c.categories_id AND cd.language_id = '" . (int)$languages_id . "'");
 $cat_val = tep_db_fetch_array($cat_query);

 $cat_array[] = $cat_val['name'];

 //If this category has a parent, get the name
 if (is_numeric($cat_val['parent_id']) && $cat_val['parent_id'] != '0') {
$parent_id = $cat_val['parent_id'];
while ($parent_id != '0') {
  $cat_query = tep_db_query("SELECT cd.categories_name as name, c.parent_id FROM categories c LEFT JOIN categories_description cd ON (c.categories_id = cd.categories_id) WHERE cd.categories_id = '" . (int)$parent_id . "' AND cd.language_id = '" . (int)$languages_id . "'");
  $cat_val = tep_db_fetch_array($cat_query);

  $cat_array[] = $cat_val['name'];
  $parent_id = $cat_val['parent_id'];
}
 }

 //Reverse array order
 $cat_array = array_reverse($cat_array);

 for ($x = 0; $x <= sizeof($cat_array) - 1; $x++) {
$cPath_list[]=urlencode($cat_array[$x]);
 }
}
//END MODIFICATION - BB

 

Cheers,

Ryan

Share this post


Link to post
Share on other sites
To fix this, change the require('includes/application_top.php'); at the top of the index.php and product_info.php files to say
require_once('includes/application_top.php');

Until you get the rewrite working, I would not make the includes/functions/html_output.php changes. The site should still work otherwise with just the mod_rewrite rules and rewrite.php installed. Changing require to require_once should not affect site functionality (when not using the rewrite). That way, you should be able to get both types of URLs ( www.romeysblades.com/knives/ and http://www.romeysblades.com/index.php/cPath/24 ) working simultaneously. Once you do that, you can make the html_output changes (which make osCommerce display with the new URLs).

 

I find the regular SEF URLs goofy and would not use them. I see no advantages to writing product_info.php/products_id/24 rather than product_info.php?products_id=24. I don't think that they would hurt anything at this point though.

 

Hth,

Matt

 

 

Hi there, i have this problem and i tried your solution above but it did not work

 

do you know anything else i might do to fix this error?

 

thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×