Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seach Engine Friendly URL Support


BlueYon

Recommended Posts

nobody out there to help me please???

 

could somebody at least tell a noob like me if the code beneath is correct?

 

thx dahui

 

Step #6 - In In /admin/includes/functions/general.php

Before code } (around line 956) add this code

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

Note: This should be the at the end of the tep_reset_cache_block function

 

 

I found previous threads on that but no other awnsers than what is said in the instruction, and obviously thats what I don't understand :(

 

my lines (btw 977 - 1008 ) of the general php look like this:

 

  function tep_reset_cache_block($cache_block) {
   global $cache_blocks;

   for ($i=0, $n=sizeof($cache_blocks); $i<$n; $i++) {
     if ($cache_blocks[$i]['code'] == $cache_block) {
       if ($cache_blocks[$i]['multiple']) {
         if ($dir = @opendir(DIR_FS_CACHE)) {
           while ($cache_file = readdir($dir)) {
             $cached_file = $cache_blocks[$i]['file'];
             $languages = tep_get_languages();
             for ($j=0, $k=sizeof($languages); $j<$k; $j++) {
               $cached_file_unlink = ereg_replace('-language', '-' . $languages[$j]['directory'], $cached_file);
               if (ereg('^' . $cached_file_unlink, $cache_file)) {
                 @unlink(DIR_FS_CACHE . $cache_file);
               }
             }
           }
           closedir($dir);
         }
       } else {
         $cached_file = $cache_blocks[$i]['file'];
         $languages = tep_get_languages();
         for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
           $cached_file = ereg_replace('-language', '-' . $languages[$i]['directory'], $cached_file);
           @unlink(DIR_FS_CACHE . $cached_file);
         }
       }
       break;
     }
   }
@unlink(DIR_FS_CACHE . 'url.cache');         // <======= right position ???
 }

Link to comment
Share on other sites

  • Replies 968
  • Created
  • Last Reply

Top Posters In This Topic

No, I put it here and it is working for me. (just after line 1048)

 

___________________________________________________

 

if (is_dir($source)) {

$dir = dir($source);

while ($file = $dir->read()) {

if ( ($file != '.') && ($file != '..') ) {

if (is_writeable($source . '/' . $file)) {

tep_remove($source . '/' . $file);

$cached_file = ereg_replace('-language', '-' . $languages[$i]['directory'], $cached_file);

@unlink(DIR_FS_CACHE . $cached_file);

}

}

break;

 

________________________________________________

 

Hope that helps!

 

a short reply for this one code line to positio would be great help for the moment

 

thx dahui

 

:(

Link to comment
Share on other sites

hi paul

 

sorry call me dump and stupid and you might be right, but in the zip of the contrib there is a general php at HeaderTagsController_V_2.5.3\catalog_for_new_shop_only\admin\includes\functions

 

I found the following code lines 975-1005:

  function tep_reset_cache_block($cache_block) {
   global $cache_blocks;

   for ($i=0, $n=sizeof($cache_blocks); $i<$n; $i++) {
     if ($cache_blocks[$i]['code'] == $cache_block) {
       if ($cache_blocks[$i]['multiple']) {
         if ($dir = @opendir(DIR_FS_CACHE)) {
           while ($cache_file = readdir($dir)) {
             $cached_file = $cache_blocks[$i]['file'];
             $languages = tep_get_languages();
             for ($j=0, $k=sizeof($languages); $j<$k; $j++) {
               $cached_file_unlink = ereg_replace('-language', '-' . $languages[$j]['directory'], $cached_file);
               if (ereg('^' . $cached_file_unlink, $cache_file)) {
                 @unlink(DIR_FS_CACHE . $cache_file);
               }
             }
           }
           closedir($dir);
         }
       } else {
         $cached_file = $cache_blocks[$i]['file'];
         $languages = tep_get_languages();
         for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
           $cached_file = ereg_replace('-language', '-' . $languages[$i]['directory'], $cached_file);
           @unlink(DIR_FS_CACHE . $cached_file);
         }
       }
       break;
     }
   }
 }

 

its got twice that line in it by default and i dunno where to place the code " @unlink(DIR_FS_CACHE . $cached_file);" from the intructions

 

sorry :(

dahui

Link to comment
Share on other sites

its got twice that line in it by default and i dunno where to place the code " @unlink(DIR_FS_CACHE . $cached_file);" from the intructions

sorry the install say insert "@unlink(DIR_FS_CACHE . 'url.cache');"

 

dahui

Link to comment
Share on other sites

Hi all, just to throw some more confusion into the mix, when i set this up, it only worked depending on what i called the directory it was placed in.

 

For example it worked if put in : nm, test, health, but not shop, shopping test5!

any ideas why that is? had me scatching my bum fluff for a while! :P

 

in the end i couldn't be arsed to work out why and just restructed all my code and went with a new directory name that worked. I'd be interedted to know why it is though.

 

lee

Link to comment
Share on other sites

For example it worked if put in : nm, test, health, but not shop

 

hi leecook

 

interesting as my installation (as descibed in a post further up) went fine untill SEF was installed and now the HTC and login and oscsid and and and are messed

 

as you can see my shop in development runs under /shop

 

http://funjumping.de/shop

 

so confused :-/

 

dahui

Link to comment
Share on other sites

Can someone please help me out. I got the contribution to work but i have a question.

 

 

my category for the jewelry part of the store comes up like this:

 

www.mysite.com/category21/index.html

 

it should say:

 

www.mysite.com/jewelry/index.html

 

How can i fix this? Other peoples sites dont have this problem.

 

 

thanks

Yoni

Link to comment
Share on other sites

Hi,

 

I installed SEF v1.8 and the url got updated correctly. The only problem I got is that now the product_info page has been replaced with:

 

Product not found!

 

I read some previous post that this contrib essentially combined index.php and product_info.php together. Wonder what went wrong in the process? I would grately appreciate if someone can give me some hint on which file to debug with!

 

Thanks!

Link to comment
Share on other sites

Hi,

 

I installed SEF v1.8 and the url got updated correctly. The only problem I got is that now the product_info page has been replaced with:

 

Product not found!

 

I read some previous post that this contrib essentially combined index.php and product_info.php together. Wonder what went wrong in the process? I would grately appreciate if someone can give me some hint on which file to debug with!

 

Thanks!

 

BTW, my store is a STS store, with HTC, Easy Populate, Easier Field contrib installed. Please suggest!

Link to comment
Share on other sites

Hi, I am having problems with my site after I installed the addon. When I click on a product it wont bring up the product properly

eg

http://www.cycron.com.au/Cooling/GlacialTe...000-VGA-cooler/

 

and when going a few categories deep the products dont come up at all

like in http://www.cycron.com.au/Graphics-Cards/PCI-Express/ATI/

 

Thanks in advance for any help

Link to comment
Share on other sites

Hi, I am having problems with my site after I installed the addon. When I click on a product it wont bring up the product properly

eg

http://www.cycron.com.au/Cooling/GlacialTe...000-VGA-cooler/

 

and when going a few categories deep the products dont come up at all

like in http://www.cycron.com.au/Graphics-Cards/PCI-Express/ATI/

 

Thanks in advance for any help

 

You havernt set the contribution up properly. I can't remember exactly what causes this, i just know its a problem with installing.

Link to comment
Share on other sites

hi leecook

 

interesting as my installation (as descibed in a post further up) went fine untill SEF was installed and now the HTC and login and oscsid and and and are messed

 

as you can see my shop in development runs under /shop

 

http://funjumping.de/shop

 

so confused :-/

 

dahui

 

Just noticed you are using index2.php. Did you includ this file name in the page function?

Link to comment
Share on other sites

Can someone please help me out. I got the contribution to work but i have a question.

my category for the jewelry part of the store comes up like this:

 

www.mysite.com/category21/index.html

 

it should say:

 

www.mysite.com/jewelry/index.html

 

How can i fix this? Other peoples sites dont have this problem.

thanks

Yoni

 

You are not using the Search Engine Friendly URL contribution, but the SEF Link Transformer one....Which gives just the urls you describe...

 

To get the format you want, you can use Nimmit Sef URLS instead

 

If you use the Search Engine Friendly URLS one...

 

It will look like this...

 

www.mysite.com/jewelry/

Link to comment
Share on other sites

I love this contribution, I really love the idea behind it. Thanks to Hilton, got it installed and mostley running. I highly recomend hilton for anyone needing help with this contribution.

 

Now, for the problem i'm haveing... My drop down navigation menu works great, but, My menu tree is looping the subcatagories.

 

Example

Cat A

Sub Cat 1,2,3

 

Cat B

Sub Cat 1,2,3

 

If I click A2 I will see A1 If I click B I will see my index page, If I click B3 I may see B1 or A1 it just loops back to a page no matter what sub cat I click.

 

Does anyone know what would cause that?

Link to comment
Share on other sites

When the user adds a product to the shopping cart it appears in the shopping cart box as expected.

 

However, when the next item is added and the customer uses the back button to continue shopping the last item disappears from the box. When the browser is refreshed it reappears.

 

Any suggestions as to how to fix this would be appreciated.

 

Also, I have less hits on my site since I installed this contribution.

 

www.ezyink.com

Link to comment
Share on other sites

I love this contribution, I really love the idea behind it. Thanks to Hilton, got it installed and mostley running. I highly recomend hilton for anyone needing help with this contribution.

 

Now, for the problem i'm haveing... My drop down navigation menu works great, but, My menu tree is looping the subcatagories.

 

Example

Cat A

Sub Cat 1,2,3

 

Cat B

Sub Cat 1,2,3

 

If I click A2 I will see A1 If I click B I will see my index page, If I click B3 I may see B1 or A1 it just loops back to a page no matter what sub cat I click.

 

Does anyone know what would cause that?

 

You have possible 2 or more items the same name!

Link to comment
Share on other sites

i'm trying to install this and having the problem that after turning on search engine safe URLS and clicking a product it is going to the correct url but just 404ing. Is there something i need to enable in either httpd.conf or php.ini?

:wq!

Link to comment
Share on other sites

You have possible 2 or more items the same name!

 

I went through it all, changed all duplicates, now, all the products names I changed loop back to the catagory page. The ones i did not change loop to the names I DID change, unless I go in and change them too, then it loops back to the catagory page. The url's are showing correctly in the browser, but, all I get is the looping. I think that if I added new product I would have the same problem.

 

What do I need to do to fix this.

 

Signed Desperate for help!

Link to comment
Share on other sites

Has anyone got this to work with CRE Loaded 6.15? CRE uses a different template system than BTS and the index.php file is completely different due to it being split into different sections.

 

Any help is greatly appreciated. ;)

Link to comment
Share on other sites

Datazen, I have it partially working with THAT version using this index.php file

 

be quick before the mods delete this!

 

<?php
/*
 $Id: index.php,v 1.2 2004/03/09 19:56:29 ccwjr 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');

// 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') {
//Code change for Categories Description 1.5
//    $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 . "'");
//Changed to the following
   $category_query = tep_db_query("select cd.categories_name, cd.categories_heading_title, cd.categories_description, c.categories_image from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . $current_category_id . "' and cd.categories_id = '" . $current_category_id . "' and cd.language_id = '" . $languages_id . "'");
//End Categories Description 1.5

   $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;
     }
   }
// Get the category name and description
   $category_query = tep_db_query("select cd.categories_name, cd.categories_heading_title, cd.categories_description, c.categories_image from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . $current_category_id . "' and cd.categories_id = '" . $current_category_id . "' and cd.language_id = '" . $languages_id . "'");
   $category = tep_db_fetch_array($category_query);


// 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)) ) {
     $sort_column = CATEGORIES_SORT_ORDER;
     $sort_order = 'a';
   } else {
     $sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);
     $sort_column = $column_list[$sort_col-1];
     $sort_order = substr($HTTP_GET_VARS['sort'], 1);
   }
   $listing_sql .= ' order by ';
   switch ($sort_column) {
     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;

 }

 require(DIR_WS_TEMPLATES . TEMPLATE_NAME . '/' . TEMPLATENAME_MAIN_PAGE);

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

 

 

After installing maybe 6 test versions of this i think that the host configuration makes a difference, eg i can not get this contribution working with a standard MS2 on 1and1 hosting, yet it works fine on other hosts.

 

I am currently using Chemo's instead however I'm hoping Daniel can have another look at this now he is back in the UK, it is a great contribution and i would love to use it on a live site.

 

cheers

 

Andy

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