Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seach Engine Friendly URL Support


BlueYon

Recommended Posts

This is a great contribution - but I would highly suggest that newbies not mess with this one.  It has some flaws such as "ttp" showing up in the URLS (is mentioned quite a bit in the forums, but no actual fix can be found).  Also, if you have a subcategory that has the same name as another subcategory, you will get problems also.  Also, had categories like "Software" show up!  Software?  I don't even sell software - where did that come from???

 

I hope work continues on this contribution, because it will be awesome once completed - but I think I will have to pass on it at this time.

 

I think some of the problems you have are bcause of the cache.

Link to comment
Share on other sites

  • Replies 968
  • Created
  • Last Reply

Top Posters In This Topic

If someone could post intstructions for installing with BTS it would be great. I see Blueyon seems to have managed it and said he'd post instruction but I did not see anything posted throughout the remainder of the thread.

 

Any help appreciated

Link to comment
Share on other sites

If someone could post intstructions for installing with BTS it would be great.  I see Blueyon seems to have managed it and said he'd post instruction but I did not see anything posted throughout the remainder of  the thread. 

 

Any help appreciated

 

 

Try replacing the contents of your index.php with this:

 

<?php
 /* 
     $Id: index.php,v 1.1 2003/06/11 17:37:59 hpdl Exp $
   
     osCommerce, Open Source E-Commerce Solutions
     http://www.oscommerce.com
    
     Copyright (c) 2003 osCommerce
   
     Released under the GNU General Public License
   */

 require ('includes/application_top.php');

 if (isset($HTTP_GET_VARS['products_id'])) {
   require (DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);

   $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
   $product_check = tep_db_fetch_array($product_check_query);

   $content = CONTENT_PRODUCT_INFO;
   
 } else {
   // the following cPath references come from application_top.php
   $category_depth = 'top';

   if (isset($cPath) && tep_not_null($cPath)) {
     $categories_products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");
     $cateqories_products = tep_db_fetch_array($categories_products_query);

     if ($cateqories_products['total'] > 0) {
       $category_depth = 'products'; // display products
     } else {
       $category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'");
       $category_parent = tep_db_fetch_array($category_parent_query);

       if ($category_parent['total'] > 0) {
         $category_depth = 'nested';   // navigate through the categories
       } else {
         $category_depth = 'products'; // category has no products, but display the 'no products' message
       }
     }
   }

   require (DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT);

   if ($category_depth == 'nested') {
     $category_query = tep_db_query("select cd.categories_name, c.categories_image from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int)$current_category_id . "' and cd.categories_id = '" . (int)$current_category_id . "' and cd.language_id = '" . (int)$languages_id . "'");
     $category = tep_db_fetch_array($category_query);

     $content = CONTENT_INDEX_NESTED;
   } elseif ($category_depth == 'products' || isset($HTTP_GET_VARS['manufacturers_id'])) {
     // create column list
     $define_list = array (
       'PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,
       'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,
       'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,
       'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,
       'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,
       'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,
       'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE,
       'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW
     );

     asort ($define_list);

     $column_list = array ();

     reset ($define_list);

     while (list($key, $value) = each($define_list)) {
       if ($value > 0)
         $column_list[] = $key;
     }

     $select_column_list = '';

     for ($i = 0, $n = sizeof($column_list); $i < $n; $i++) {
       switch ($column_list[$i]) {
         case 'PRODUCT_LIST_MODEL':
           $select_column_list .= 'p.products_model, ';

           break;

         case 'PRODUCT_LIST_NAME':
           $select_column_list .= 'pd.products_name, ';

           break;

         case 'PRODUCT_LIST_MANUFACTURER':
           $select_column_list .= 'm.manufacturers_name, ';

           break;

         case 'PRODUCT_LIST_QUANTITY':
           $select_column_list .= 'p.products_quantity, ';

           break;

         case 'PRODUCT_LIST_IMAGE':
           $select_column_list .= 'p.products_image, ';

           break;

         case 'PRODUCT_LIST_WEIGHT':
           $select_column_list .= 'p.products_weight, ';

           break;
       }
     }

     // show the products of a specified manufacturer
     if (isset($HTTP_GET_VARS['manufacturers_id'])) {
       if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
         // We are asked to show only a specific category
         $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";
       } else {
         // We show them all
         $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";
       }
     } else {
       // show the products in a given categorie
       if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
         // We are asked to show only specific catgeory
         $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
       } else {
         // We show them all
         $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
       }
     }

     if ((!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list))) {
       for ($i = 0, $n = sizeof($column_list); $i < $n; $i++) {
         if ($column_list[$i] == 'PRODUCT_LIST_NAME') {
           $HTTP_GET_VARS['sort'] = $i + 1 . 'a';
           $listing_sql .= " order by pd.products_name";
           break;
         }
       }
     } else {
       $sort_col = substr($HTTP_GET_VARS['sort'], 0, 1);
       $sort_order = substr($HTTP_GET_VARS['sort'], 1);
       $listing_sql .= ' order by ';

       switch ($column_list[$sort_col - 1]) {
         case 'PRODUCT_LIST_MODEL':
           $listing_sql .= "p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

           break;

         case 'PRODUCT_LIST_NAME':
           $listing_sql .= "pd.products_name " . ($sort_order == 'd' ? 'desc' : '');

           break;

         case 'PRODUCT_LIST_MANUFACTURER':
           $listing_sql .= "m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

           break;

         case 'PRODUCT_LIST_QUANTITY':
           $listing_sql .= "p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

           break;

         case 'PRODUCT_LIST_IMAGE':
           $listing_sql .= "pd.products_name";

           break;

         case 'PRODUCT_LIST_WEIGHT':
           $listing_sql .= "p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

           break;

         case 'PRODUCT_LIST_PRICE':
           $listing_sql .= "final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

           break;
       }
     }

     $content = CONTENT_INDEX_PRODUCTS;
   } else { // default page
     $content = CONTENT_INDEX_DEFAULT;
   }
 }

 include(bts_select('main', $content_template));

 require (DIR_WS_INCLUDES . 'application_bottom.php');
?>

Link to comment
Share on other sites

Hi,

 

i have installed this hack and i have this error when i access to the index of catalog :

 

/* * Altered the original file, so now the product in the URL isn't identified by name, but by model. * * File changed by [email protected] * * Released under the GNU General Public License * * Please respect this message in future changes * */ 
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at c:\archivos de programa\easyphp1-8\www\catalog\includes\classes\url_rewrite.php:11) in c:\archivos de programa\easyphp1-8\www\catalog\includes\functions\sessions.php on line 67

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at c:\archivos de programa\easyphp1-8\www\catalog\includes\classes\url_rewrite.php:11) in c:\archivos de programa\easyphp1-8\www\catalog\includes\functions\sessions.php on line 67

 

 

and when i trie to add a product to cart :

 

http://localhost/catalog/product_info.php/...d90d766551c0089

 

i have this error :

 

/* * Altered the original file, so now the product in the URL isn't identified by name, but by model. * * File changed by [email protected] * * Released under the GNU General Public License * * Please respect this message in future changes * */ 
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at c:\archivos de programa\easyphp1-8\www\catalog\includes\classes\url_rewrite.php:11) in c:\archivos de programa\easyphp1-8\www\catalog\includes\functions\sessions.php on line 67

Warning: Cannot modify header information - headers already sent by (output started at c:\archivos de programa\easyphp1-8\www\catalog\includes\classes\url_rewrite.php:11) in c:\archivos de programa\easyphp1-8\www\catalog\includes\functions\general.php on line 29

 

the probleme that in the general.php file in the install of the hack they tell that i have to add :

 

Before (around line 956):

 

}

 

 

Add this code (around line 956):

 

@unlink(DIR_FS_CACHE . 'categories_array.cache');

@unlink(DIR_FS_CACHE . 'manufacturers_array.cache');

@unlink(DIR_FS_CACHE . 'products_array.cache');

 

but in the line 956 of my general.php (contrubution clean) i have in this line :

 

 

////

//! Send email (text/html) using MIME

// This is the central mail function. The SMTP Server should be configured

// correct in php.ini

// Parameters:

// $to_name The name of the recipient, e.g. "Jan Wildeboer"

// $to_email_address The eMail address of the recipient,

// e.g. [email protected]

// $email_subject The subject of the eMail

// $email_text The text of the eMail, may contain HTML entities

// $from_email_name The name of the sender, e.g. Shop Administration

// $from_email_adress The eMail address of the sender,

// e.g. [email protected]

 

so i add the code here :

 

    return $greeting_string;
    @unlink(DIR_FS_CACHE . 'categories_array.cache'); 
   @unlink(DIR_FS_CACHE . 'manufacturers_array.cache'); 
   @unlink(DIR_FS_CACHE . 'products_array.cache');
 }

 

i suppose that this is the error.

Edited by oussama
Link to comment
Share on other sites

Blueyon, thanks for the index file for BTS, worked with a few minor fixes to suite my site.

 

Now the front page comes up ok but I get a Server 500 error if I try click on any link. I can see from the status bar that it's rewriting the URLs as expeted however the 500 error comes almost immediately. I enabled db query logging and none of the db lookups even happen.

 

My Test Website

 

Any ideas???

 

oh, one last thing ... my hosting provider does not allow access to the apache error or access logs :-( hence making debugging this a bit harder

 

Thanks

 

Nick

Link to comment
Share on other sites

I'm updating the script now. Hopefully I can release it tomorrow.

 

I have taken alot of stuff out of the url_rewite.php script. I'm still testing, but it should clear up alot of bugs.

 

Also I'm going to start a page caching script. Chemos was good, but I thought it had to many features for just page caching.

Link to comment
Share on other sites

BlueYon, i suggest to make olse changement of title of product page and path or categorie page.

 

http://hiperdisco.com/catalog/Peliculas-DVD/Accion/

 

-- title (osCommerce)

 

and :

 

http://www.itchi-tech.co.uk/Midi-Moto/

 

with title : Midi Moto

 

How can i make it like this !

 

thanks and sorry for my bad english

 

I added the meta tag control contribution. I'm thinking of removing it and using a script to generate the tags automically. oSCommerce should have done this in the first place. hopefully it will be added in ms3.

 

Also BTS does this.

Link to comment
Share on other sites

I added the meta tag control contribution. I'm thinking of removing it and using a script to generate the tags automically. oSCommerce should have done this in the first place. hopefully it will be added in ms3.

 

Also BTS does this.

 

Pleas BlueYon,

 

What is the contribution that u use ?

 

http://www.oscommerce.com/community?contributions=&search=meta+tag+control&category=all

 

Thanks

Link to comment
Share on other sites

I'm thinking of removing it and using a script to generate the tags automically.

 

There is already a contribution that does this. However, you lose the flexibility that you have in creating and optimising your own meta tags that you get with Meta Tag Controller.

 

It's not being added to MS3, perhaps MS4.

 

Vger

Link to comment
Share on other sites

Pleas BlueYon,

 

What is the contribution that u use ?

 

http://www.oscommerce.com/community?contributions=&search=meta+tag+control&category=all

 

Thanks

 

I combined BTS with meta tag controller. You want me to create meta tag generator?

 

It's not to hard.

 

I quit my job and I'm moving back to the UK next month. I have around 1 month of adding a few contirbutions.

 

Give me time I want to do the page caching first.

Link to comment
Share on other sites

My test :

 

Mi Test

 

but in the product info the popup of image dont rullz :(

 

 

Ok I found your problem about the popup pictures.

 

Basicly because its running from index.php its not included the javascript for the popup window to work.

 

Just copy this in

 

<script language="javascript"><!--
function popupWindow(url) {
?window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,res
izable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,le
ft=150')
}
//--></script>

 

just before it says </head>

Edited by BlueYon
Link to comment
Share on other sites

Hey

 

i've just installed this contrib

 

but my Url's aren't being rewritten properly

 

my urls are coming out like

 

/Store/catalog/index.php/cPath/1_17

 

Tried to find a solution in this htread but coudl'n't find anything, too many pages to sift thru

 

Any help would be appreciated

Link to comment
Share on other sites

well if i want to have .html as extension instead of DMOZ style / then how to go for it

plz help

 

Find this line in url_rewrite.php

 

return $url_parts['scheme'] . '://' . $url_parts['host'] . $url_parts['path'] . '/';

 

and change the '/'; to '.html';

 

and replace

      // Put the request URL into an array
     $request_url_array = explode('/', trim(getenv('REQUEST_URI'), '/'));

 

with

 

      

// Put the request URL into an array
     $url = str_replace('.html', '', getenv('REQUEST_URI'));
     $request_url_array = explode('/', trim($url, '/'));

Link to comment
Share on other sites

is there no answer for my problem? BlueYon?

 

What are you running? Apache, Unix?

 

Can you give the address of your site. Looks like your urls are comming out like search engine safe. Are you sure you did everything on the instructions?

 

What other conributions have u installed?

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...