Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seach Engine Friendly URL Support


BlueYon

Recommended Posts

  • Replies 968
  • Created
  • Last Reply

Top Posters In This Topic

make sure you replace the url_rewrite.php...

 

you must have the one with the following line in the transform_uri() function:

$uriparts = parse_url($param);

 

i think that line was the bug in the 1.0 version

Link to comment
Share on other sites

I originally thought this contribution worked flawlessly until I realized that nothing gets added to my shopping cart when anyone clicks the ADD TO CART buttons. I just get /action/buy_now/ at the end of my URL's. I don't know if its just my site or what but if the customer can't add anything to their cart this contrib won't work out ;(

 

Anybody else having this problem or is just my sites?

 

Any feedback would be greatly appreciated!

 

MLHmptn

Link to comment
Share on other sites

I originally thought this contribution worked flawlessly until I realized that nothing gets added to my shopping cart when anyone clicks the ADD TO CART buttons.  I just get /action/buy_now/ at the end of my URL's.  I don't know if its just my site or what but if the customer can't add anything to their cart this contrib won't work out ;(

 

Anybody else having this problem or is just my sites?

 

Any feedback would be greatly appreciated!

 

MLHmptn

 

sorting the prblems out now!

Link to comment
Share on other sites

I figured it out BlueYon....It had to do with httpd.conf....I had to add the AcceptPathInfo directive to httpd.conf.

 

I have to figure out how to address the bullet symbol though with its ISO 8859-1 character set value :(

 

The strip array also works flawlessly now on my page with the following :

 

$strip_array = array("","","`","","•",chr(174),chr(169),chr(33),chr(34),chr(35),chr(36),chr(37),chr(38),chr(39),chr(40),chr(41),chr(42),chr(43),chr(44),chr(47),chr(60),chr(91),chr(92),chr(93),chr(94),chr(95),chr(96),chr(123),chr(124),chr(125),chr(126),chr(146),chr(147),chr(148),chr(151),chr(153),chr(B7),chr(176) );

 

Thanks for your great contribution!

Edited by MLHmptn
Link to comment
Share on other sites

Ok added the update! please bug test it for me!

Still has a small problem with the click continue button!

 

Ok tested it, and it works quite good... except it won't go further than 1 category.

so it goes to /Hardware but not to /Hardware/Logical-Access, it will show the /Hardware page.

 

It also still doesn't check if a product is in the right category.

 

I have a product x in category y. so the link should be Y/X

but when i enter /X or ABDC/X it all shows the product_info page.

 

When i got time i will take a look and try to fix it ;)

Link to comment
Share on other sites

Everything seems to working great on my site with the new update. I haven't found any bugs on my site yet. I did have another contribution for sef but I really like this one so much better, now to change some similar names on products and that should do it. Thanks so much. Will let you know if I find any bugs.

Mair :D

Link to comment
Share on other sites

Everything seems to working great on my site with the new update.  I haven't found any bugs on my site yet.  I did have another contribution for sef but I really like this one so much better, now to change some similar names on products and that should do it.  Thanks so much. Will let you know if I find any bugs.

Mair  :D

 

Do you have nested categories in your site? And are the links working when you add a url to your product?

Link to comment
Share on other sites

Do you have nested categories in your site? And are the links working when you add a url to your product?

 

No I don't have nested categories, but when I moved a couple of categories under a main category for subcategories, when clicking on the subcategory it would redirect to the main category so that part does not work for me. My links work on the product info pages. Links work on the product listing pages and the buy now links work on the new product pages. Manufacturers drop down still shows mysite.com/?manufacturers_id=17 mysite.com/?manufacturers_id=17 instead of mysite.com/manufacturersname/ So for the most part it is working pretty good for me.

Mair

Edited by MaryAnn
Link to comment
Share on other sites

ok i had some spare time and fixed some problems!

 

The get_vars() function was getting all language categories and product_ids. So when a 2 languages had the same word for an category it would add them both to the cPath resulting in a cPath of 1_1 which should be just 1.

 

So the $languages_id variable had to be added to the queries. In order to do this the include url_rewrite.php code must be beneath the language classes.

 

so do this:

 

in application_top.php find:

// sef urls
 require(DIR_WS_CLASSES . 'url_rewrite.php'); 
 
$url_rewrite = new url_rewrite;
 
 $url = str_replace($PHP_SELF, '', getenv('REQUEST_URI'));
$url = str_replace('?', '/', $url);
$url = str_replace('=', '/', $url);
$url = str_replace('&', '/', $url);
 $url = trim($url, '/');
 if(!empty($url)) $url_array = explode('/', $url);
 
 if((trim($PHP_SELF, '/') == FILENAME_DEFAULT)and(sizeof($url_array) > 0)){
   $vars_array = $url_rewrite->get_vars($url_array);

  for ($i=0, $n=sizeof($vars_array); $i<$n; $i++) {
    $HTTP_GET_VARS[$vars_array[$i]['key']] = $vars_array[$i]['value'];
  }
 }

 

and move it beneath:

 require(DIR_WS_LANGUAGES . $language . '.php');

 

now in url_rewrite.php find:

function get_vars($url_array){    

and beneath it add:

global $languages_id;

 

find:

$categories_query = tep_db_query("select categories_id, categories_name from " . TABLE_CATEGORIES_DESCRIPTION);

 

and replace with:

$categories_query = tep_db_query("select categories_id, categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " WHERE language_id = '" . $languages_id . "'");

 

as last find:

$products_query = tep_db_query("select products_id, products_name from " . TABLE_PRODUCTS_DESCRIPTION);

 

and replace with:

$products_query = tep_db_query("select products_id, products_name from " . TABLE_PRODUCTS_DESCRIPTION . " WHERE language_id = '" . $languages_id . "'");

 

Now the nested categories work also :)

Link to comment
Share on other sites

also fixed the dropdown-list not showing the name!!!

 

do following:

 

in includes/boxes/manufactuers.php find:

        $manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'],

 

replace with:

        $manufacturers_name_rewrite = $url_rewrite->strip($manufacturers['manufacturers_name']);
       $manufacturers_array[] = array('id' => $manufacturers_name_rewrite,

 

find:

      $info_box_contents = array();

 

add above:

   if(isset($HTTP_GET_VARS['manufacturers_id'])){
   $man_query = tep_db_query("SELECT manufacturers_name FROM " . TABLE_MANUFACTURERS . " WHERE manufacturers_id = '" . $HTTP_GET_VARS['manufacturers_id'] . "'");
   $man = tep_db_fetch_array($man_query);
   $man_rewrite = $url_rewrite->strip($man['manufacturers_name']);
  }

 

find:

                                   'text' => tep_draw_pull_down_menu('manufacturers_id', $manufacturers_array, (isset($HTTP_GET_VARS['manufacturers_id']) ? $HTTP_GET_VARS['manufacturers_id'] : ''), 'onChange="this.form.submit();" size="' . MAX_MANUFACTURERS_LIST . '" style="width: 100%"') . tep_hide_session_id());

 

replace with:

                                   'text' => tep_draw_pull_down_menu('manufacturers_id', $manufacturers_array, (isset($HTTP_GET_VARS['manufacturers_id']) ? $man_rewrite : ''), 'onChange="location=document.manufacturers.manufacturers_id.options[document.manufacturers.manufacturers_id.selectedIndex].value;" size="' . MAX_MANUFACTURERS_LIST . '" style="width: 100%"') . tep_hide_session_id());

 

 

and your done!!

Link to comment
Share on other sites

minor update on the above, if your shop isn't located in the root:

 

find:

$manufacturers_array[] = array('id' => $manufacturers_name_rewrite,

 

replace with:

$manufacturers_array[] = array('id' => DIR_WS_HTTP_CATALOG . $manufacturers_name_rewrite,

 

now it works also when your shop isn't in the root!

Link to comment
Share on other sites

in adition to the post where i describe howto make the get_vars() function language specific.

I've been thinking about it and i think it isn't good to do it, because when a search engine links to a other language than your browser language the page won't show.

I will recode the get_vars() function so it will search for the variables (categories, product_id) in sql rather than get the full list, this way you won't get double categories and i think i will be able to get the variables such as language, action, currency also.

Link to comment
Share on other sites

I'm trying to get this contribution so you don't have to alter very little.

 

You should not need to alter any manufaturer boxes for this to work.

 

I'm still working on fiing the bugs but matching the lanuage ids is not good.

 

You can just put a break command in so once its found it wont add anthor cpath.

Link to comment
Share on other sites

ok cool...

 

i was thinking, maybe it's an idea to add an extra database fiels with the stripped name in the categories_description, manufacturers and products_description tables?

This way the searching for the var's will be much faster....

 

also i think it's better to put that all in 1 while statement, because now you are searching the same vars 3 times.

and you are putting all the vars in an array so when you have an uneven number of them the array isn't filled right....

 

i have made a update and will pm you the file if you like....

just to make my thoughts clear ;)

Link to comment
Share on other sites

ok cool...

 

i was thinking, maybe it's an idea to add an extra database fiels with the stripped name in the categories_description, manufacturers and products_description tables?

This way the searching for the var's will be much faster....

 

also i think it's better to put that all in 1 while statement, because now you are searching the same vars 3 times.

and you are putting all the vars in an array so when you have an uneven number of them the array isn't filled right....

 

i have made a update and will pm you the file if you like....

just to make my thoughts clear ;)

 

The striped database fields is a good idea!

 

not sure what you mean about the uneven number of vars.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...