Jump to content
spidometrs

[CONTRIBUTION] Ultimate SEO URLs v2.1 - by Chemo

Recommended Posts

A new version has been uploaded with these changes:

 

- Fixed automatic install code so it handles the updates correctly

- Added an option to use the title from Header Tags for the url

- Added fix to allow code to work with all languages

- Fixed long standing problem with code for Links Manager cache

 

To update existing installations, just upload the seo_class.php file, click on a link on your site and clear cache in admin.

 

The new Header Tags option was added to allow better control of the url's. The url's will now match the web browser title as well as the page heading. This will increase SEO in many cases. However, you need to be careful with this option. If a Header Tags title is setup to contain more than the main keyword of the page, it could cause url's that are not the best choice. Also, since using this option may change your url's, it could cause a loss of index position for existing pages. 301's are issued for the pages so that should recover in a few weeks but this isn't a change to be done lightly for established sites.

 

Jack

Share this post


Link to post
Share on other sites

I've just installed new version, it's working perfect in my localhost, but it's not working in my production server...¿?... this is the error:

 

Fatal error: Call to undefined function mb_convert_case() in /var/www/vhosts/telegrow.com/httpdocs/tienda_desarrollo/includes/classes/seo.class.php on line 1384

 

I've uploaded seo.class.php, and reset the cache...¿?¿?...

 

Can you help me?

Thanks!

Share this post


Link to post
Share on other sites

Hello all,

 

Great add on, thank you to whoever invented it, I've installed it and everything seems to be working properly. I have one simple question:

All of the URL's generated always have an additional letter and number added on the end e.g.:

 

http://www.mysweaters.com/wolly-sweaters-c-4.html

 

So how do I remove this letter and number for all my categories and products so that it displays without them. e.g.

 

http://www.mysweaters.com/wolly-sweaters.html

 

How can I do this?

 

Thanks in advance!

Share this post


Link to post
Share on other sites

got it working! thanks to the contributor! I have a small new problem though. If a product is added to the cart prior to clicking the product page, the customer is automatically redirected to the new product page. This is a minor issue but could be annoying for future customers.. Any ideas?

Edited by Jan Zonjee

Share this post


Link to post
Share on other sites

Hello,

 

Im new to osC and have been trying to get this contrib working but im getting nowhere. I have an offline testing server that I have been working with. If anybody can point be in the right direction or advise me what Im doing wrong I would be very grateful.

 

Does this only work with a new install of osC or can it be applied to an excising site that has products.

 

I cannot find a htaccess file to edit? - Where should this be or how do I create it

 

Also when the live site is up and running with products - when I get this working will it work ok with the existing products

 

Sorry for all the questions but I have been at this for 2 days,

 

Cheers,

Share this post


Link to post
Share on other sites
Hello,

 

Im new to osC and have been trying to get this contrib working but im getting nowhere. I have an offline testing server that I have been working with. If anybody can point be in the right direction or advise me what Im doing wrong I would be very grateful.

 

Does this only work with a new install of osC or can it be applied to an excising site that has products.

 

I cannot find a htaccess file to edit? - Where should this be or how do I create it

 

Also when the live site is up and running with products - when I get this working will it work ok with the existing products

 

Sorry for all the questions but I have been at this for 2 days,

 

Cheers,

 

 

Here’s how to create a text file suitable for an .htaccess file:

 

1. Open up a text editor on your computer. We recommend that you use Notepad (Windows), SimpleText (Macintosh), or Emacs (Linux / UNIX).

2. Save the file (in an easy-to-find location) as .htaccess (including the initial dot).

3. Now, make sure that your text editor did not append a .txt suffix to the file name. (In Windows, you can do this by right-clicking the icon for the text file and selecting Properties.) If the file name does have a .txt suffix (i.e. '.htaccess.txt'), remove the suffix by renaming the file.

4. Before entering code into your new file, make sure that Word Wrap is turned off. (In Notepad, select Format… from the top navigation bar and make sure that Word Wrap is unchecked. This is important because most .htaccess commands need to be placed on one line only.

5. You can now enter your code into the file.

6. Upload the .htaccess file into your web space in ASCII mode. The .htaccess file will affect the folder that it is uploaded to and all its subfolders.

Share this post


Link to post
Share on other sites
I've just installed new version, it's working perfect in my localhost, but it's not working in my production server...¿?... this is the error:

 

Fatal error: Call to undefined function mb_convert_case() in /var/www/vhosts/telegrow.com/httpdocs/tienda_desarrollo/includes/classes/seo.class.php on line 1384

 

I've uploaded seo.class.php, and reset the cache...¿?¿?...

 

Can you help me?

Thanks!

That's a function in php. Your server may be using an oldver version of php. Ask your host why the function isn't there.

 

Jack

Share this post


Link to post
Share on other sites
Hello all,

 

Great add on, thank you to whoever invented it, I've installed it and everything seems to be working properly. I have one simple question:

All of the URL's generated always have an additional letter and number added on the end e.g.:

 

http://www.mysweaters.com/wolly-sweaters-c-4.html

 

So how do I remove this letter and number for all my categories and products so that it displays without them. e.g.

 

http://www.mysweaters.com/wolly-sweaters.html

 

How can I do this?

 

Thanks in advance!

Those are required for this contribution. I think there other url rewriter contribuitons that have that option, though it is strictly for apperance sake.

 

Jack

Share this post


Link to post
Share on other sites

Thanks thetatr1,

 

Have have created htaccess and placed it in my main catalog (in my case called store) and amended all the code now I am just receiving a total white screen when I try and view the store (No error messages)

 

I can get into the admin area but there is no new section under - Configuration => SEO URLs

 

I will post my code and if anybody can have a quick look over to make sure its all in order that would be great.

 

have added the new files to there correct locations

 

STEP #2 - Edit includes/application_top.php (my code)

// set the language
 if (!tep_session_is_registered('language') || isset($HTTP_GET_VARS['language'])) {
   if (!tep_session_is_registered('language')) {
     tep_session_register('language');
     tep_session_register('languages_id');
   }

   include(DIR_WS_CLASSES . 'language.php');
   $lng = new language();

   if (isset($HTTP_GET_VARS['language']) && tep_not_null($HTTP_GET_VARS['language'])) {
     $lng->set_language($HTTP_GET_VARS['language']);
   } else {
     $lng->get_browser_language();
   }

   $language = $lng->language['directory'];
   $languages_id = $lng->language['id'];
 }

// include the language translations
 require(DIR_WS_LANGUAGES . $language . '.php');

  // Ultimate SEO URLs v2.1
if ((!defined(SEO_ENABLED)) || (SEO_ENABLED == 'true')) {
  include_once(DIR_WS_CLASSES . 'seo.class.php');
  if ( !is_object($seo_urls) ){
    $seo_urls = new SEO_URL($languages_id);

// currency
 if (!tep_session_is_registered('currency') || isset($HTTP_GET_VARS['currency']) || ( (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') && (LANGUAGE_CURRENCY != $currency) ) ) {
   if (!tep_session_is_registered('currency')) tep_session_register('currency');

 

STEP #3 - Edit includes/functions/html_output.php

 Released under the GNU General Public License
*/

////
// Ultimate SEO URLs v2.1
// The HTML href link wrapper function
function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) {
  global $seo_urls;                
  if ( !is_object($seo_urls) ){
   if ( !class_exists('SEO_URL') ){
    include_once(DIR_WS_CLASSES . 'seo.class.php');
   }
   global $languages_id;
   $seo_urls = new SEO_URL($languages_id);
  }
  return $seo_urls->href_link($page, $parameters, $connection, $add_session_id);
}

////
// The HTML image wrapper function
 function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '') {
   if ( (empty($src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) {
     return false;
   }

// alt is added to the img tag even if it is null to prevent browsers from outputting
// the image filename as default
   $image = '<img src="' . tep_output_string($src) . '" border="0" alt="' . tep_output_string($alt) . '"';

   if (tep_not_null($alt)) {
     $image .= ' title=" ' . tep_output_string($alt) . ' "';
   }

   if ( (CONFIG_CALCULATE_IMAGE_SIZE == 'true') && (empty($width) || empty($height)) ) {
     if ($image_size = @getimagesize($src)) {
       if (empty($width) && tep_not_null($height)) {
         $ratio = $height / $image_size[1];
         $width = intval($image_size[0] * $ratio);
       } elseif (tep_not_null($width) && empty($height)) {
         $ratio = $width / $image_size[0];
         $height = intval($image_size[1] * $ratio);
       } elseif (empty($width) && empty($height)) {
         $width = $image_size[0];
         $height = $image_size[1];
       }
     } elseif (IMAGE_REQUIRED == 'false') {
       return false;
     }
   }

   if (tep_not_null($width) && tep_not_null($height)) {
     $image .= ' width="' . tep_output_string($width) . '" height="' . tep_output_string($height) . '"';
   }

   if (tep_not_null($parameters)) $image .= ' ' . $parameters;

   $image .= '>';

   return $image;
 }

 

STEP #4 - Edit admin/categories.php

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

 require(DIR_WS_CLASSES . 'currencies.php');
 $currencies = new currencies();

 $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');
 // Ultimate SEO URLs v2.1
// If the action will affect the cache entries
   if ( eregi("(insert|update|setflag)", $action) ) include_once('includes/reset_seo_cache.php');

 if (tep_not_null($action)) {
   switch ($action) {
     case 'setflag':
       if ( ($HTTP_GET_VARS['flag'] == '0') || ($HTTP_GET_VARS['flag'] == '1') ) {
         if (isset($HTTP_GET_VARS['pID'])) {
           tep_set_product_status($HTTP_GET_VARS['pID'], $HTTP_GET_VARS['flag']);
         }

         if (USE_CACHE == 'true') {
           tep_reset_cache_block('categories');
           tep_reset_cache_block('also_purchased');

 

STEP #5 - Edit admin/includes/functions/general.php

// nl2br() prior PHP 4.2.0 did not convert linefeeds on all OSs (it only converted \n)
 function tep_convert_linefeeds($from, $to, $string) {
   if ((PHP_VERSION < "4.0.5") && is_array($from)) {
     return ereg_replace('(' . implode('|', $from) . ')', $to, $string);
   } else {
     return str_replace($from, $to, $string);
   }
 }

 function tep_string_to_int($string) {
   return (int)$string;
 }

////
// Parse and secure the cPath parameter values
 function tep_parse_category_path($cPath) {
// make sure the category IDs are integers
   $cPath_array = array_map('tep_string_to_int', explode('_', $cPath));

// make sure no duplicate category IDs exist which could lock the server in a loop
   $tmp_array = array();
   $n = sizeof($cPath_array);
   for ($i=0; $i<$n; $i++) {
     if (!in_array($cPath_array[$i], $tmp_array)) {
       $tmp_array[] = $cPath_array[$i];
     }
   }
// Function to reset SEO URLs database cache entries 
// Ultimate SEO URLs v2.1
function tep_reset_cache_data_seo_urls($action){        
 switch ($action){
   case 'reset':
      tep_db_query("DELETE FROM cache WHERE cache_name LIKE '%seo_urls%'");
      tep_db_query("UPDATE configuration SET configuration_value='false' WHERE configuration_key='SEO_URLS_CACHE_RESET'");
   break;
   default:
   break;
 }
 # The return value is used to set the value upon viewing
 # It's NOT returining a false to indicate failure!!
 return 'false';

?>

 

STEP #6 - Edit .htaccess file (in your catalog directory) (My .htaccess file is located in the main catalog folder in my case "store" folder as shop is not in site root.

Options +FollowSymLinks
RewriteEngine On 
RewriteBase /store/

RewriteRule ^(.*)-p-(.*).html$ product_info.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-c-(.*).html$ index.php?cPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-m-([0-9]+).html$ index.php?manufacturers_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pi-([0-9]+).html$ popup_image.php?pID=$2&%{QUERY_STRING}
RewriteRule ^(.*)-t-([0-9]+).html$ articles.php?tPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-a-([0-9]+).html$ article_info.php?articles_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pr-([0-9]+).html$ product_reviews.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pri-([0-9]+).html$ product_reviews_info.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-i-([0-9]+).html$ information.php?info_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-links-(.*).html$ links.php?lPath=$2&%{QUERY_STRING}

 

I have tried it 3 times with the same result just blank white page where the store should be.

 

Sorry about the long post,

 

The link to the store - http://computerrepairs.ie/store/

 

Cheers,

Share this post


Link to post
Share on other sites

Did you upload the included files? Is mod rewrite enabled on your server?

 

Jack

Share this post


Link to post
Share on other sites

This contrib is a really great idea, but it has caused something to go wrong with my product listings and home page. I was able to add products to the cart with one click while on the category listing or homepage, but now when the buy now button is clicked it causes a redirect to the new products page (i have display shopping cart after buy now disabled in admin). Has anyone else experienced this?? How do I fix this? Is this an .htaccess issue? I dont have a clue

 

 

Actually just checked and I cant add any products to the cart unless im NOT on the actual product info page? grrrr... this is so frustrating

Edited by thetatr1

Share this post


Link to post
Share on other sites
This contrib is a really great idea, but it has caused something to go wrong with my product listings and home page. I was able to add products to the cart with one click while on the category listing or homepage, but now when the buy now button is clicked it causes a redirect to the new products page (i have display shopping cart after buy now disabled in admin). Has anyone else experienced this?? How do I fix this? Is this an .htaccess issue? I dont have a clue

 

 

Actually just checked and I cant add any products to the cart unless im NOT on the actual product info page? grrrr... this is so frustrating

 

 

ok got the ability to add products to the cart on product info pages back, but still have this annoying issue of being redirected to the new products page if i click the add to cart button and im NOT on a product info page... Please help!!!

Share this post


Link to post
Share on other sites
That's a function in php. Your server may be using an oldver version of php. Ask your host why the function isn't there.

 

Jack

 

 

You're right!... Thanks!. This is what told me my hosting:

"module mbstring php was not loaded, now it is"

 

SEO is finally working... I got another issue, it'll be in other post.

Thanks!.

Share this post


Link to post
Share on other sites
ok got the ability to add products to the cart on product info pages back, but still have this annoying issue of being redirected to the new products page if i click the add to cart button and im NOT on a product info page... Please help!!!

 

I have the same problem here... searching in the url string generated, maybe it's missing the code of the product in that link...

Chemo, any solution for this?... Thank you in advance!.

Share this post


Link to post
Share on other sites

ANyone tried this with 3000 categories and 200 000 products? I tested it and the site seems not to load at all. Is there anyway to get it working?

Share this post


Link to post
Share on other sites
ANyone tried this with 3000 categories and 200 000 products? I tested it and the site seems not to load at all. Is there anyway to get it working?

Actually I got it working somehow by disabling product cache, but for some reason orders won't get through at all then. Maybe too heavy load on database or what could be the cause of this?

Share this post


Link to post
Share on other sites

Hi all, had to register another account as it's been years since I was on this forum and my old account seems dead. :(

 

I've recently been put in charge of an osCommerce site [Version 2.2RC2] and have the task of installing an SEO URL mod.

 

Looking on the contributions page I see there are many versions available since the original by Chemo.

 

Question: Is it best to install the latest release?

 

I've tried installing Ultimate SEO 2-2.2d-3 by Jack_mcs but after completing the install instructions I get the following error:

 

Parse error: syntax error, unexpected $end in /home/sites/mysite.co.uk/public_html/catalog/includes/application_top.php on line 519

Which version would you recommend? and is there a specific version that works best with 2.2RC2?

 

Cheers

Gav

Share this post


Link to post
Share on other sites
I've tried installing Ultimate SEO 2-2.2d-3 by Jack_mcs but after completing the install instructions I get the following error:

 

Parse error: syntax error, unexpected $end in /home/sites/mysite.co.uk/public_html/catalog/includes/application_top.php on line 519

Which version would you recommend? and is there a specific version that works best with 2.2RC2?

That error means you made a mistake in the changes for the includes/application_top.php file (probably missed a } ).

 

Jack

Share this post


Link to post
Share on other sites
That error means you made a mistake in the changes for the includes/application_top.php file (probably missed a } ).

 

Jack

 

wow. Thanks for your quick reply Jack.

 

Incidentally if I remove

// Ultimate SEO URLs v2.1
if ((!defined(SEO_ENABLED)) || (SEO_ENABLED == 'true')) {
  include_once(DIR_WS_CLASSES . 'seo.class.php');
  if ( !is_object($seo_urls) ){
 $seo_urls = new SEO_URL($languages_id);
  }
}

from the application_top.php file it seems to work.

I'm guessing it needs to be in there for it to work 100% ?

Edited by images

Share this post


Link to post
Share on other sites

My bad. I had missed off a "}".

 

Cheers for giving me the kick I needed on this late Friday afternoon :)

Share this post


Link to post
Share on other sites
I have the same problem here... searching in the url string generated, maybe it's missing the code of the product in that link...

Chemo, any solution for this?... Thank you in advance!.

 

 

Still nothing on the product redirect Jack? I dont want to display the cart after a customer adds a product (seems like im rushing them through the transaction), and I dont want the customer redirected to "new products" after each item is added to the cart (seems counter intuitive). I would like the customer to remain on the same page after adding an item to their shopping cart...

 

Do you know what might be causing this error? It worked well before installing SEO... I would like it back.. let me kno, thanks

Share this post


Link to post
Share on other sites

I'm not aware of any such problem. You can try one of the other versions to see if they work though.

 

Jack

Share this post


Link to post
Share on other sites

Hey Folks!

 

First, thank you for this awesome contribution! I was able to install this without a problem -- VERY NICE!

 

Second, would you guys mind checking out my store to make it works okay with the contribution installed now?

 

http://www.jabcellular.com

 

Thank you,


Alex Blythe

JAB Cellular - Owner

Share this post


Link to post
Share on other sites
Still nothing on the product redirect Jack? I dont want to display the cart after a customer adds a product (seems like im rushing them through the transaction), and I dont want the customer redirected to "new products" after each item is added to the cart (seems counter intuitive). I would like the customer to remain on the same page after adding an item to their shopping cart...

 

Do you know what might be causing this error? It worked well before installing SEO... I would like it back.. let me kno, thanks

 

To any and all having a problem with this supposed non existent issue here is a link to the solution

 

http://forums.oscommerce.com/lofiversion/i...hp?t248505.html

 

Thanks for all the non help on the support thread

 

P.S.

 

I am only a help vampire on the google search engine... code snobs! The revolution will be televised!

 

P.P.S.

 

I tried a lot of different keywords on google, these are the ones that finally worked for me: "prevent the "add to cart" button from redirecting oscommerce

Edited by thetatr1

Share this post


Link to post
Share on other sites

Hey Guys,

 

As I mentioned above, I was able to install this contribution without a problem! However, one concern I have is when you visit my site (http://www.jabcellular.com) and click on a product, the title of the page never changes from what it is on the index page.

 

For example, on ever page, the titel is JAB Cellular - "Cellphones Without the Contract!" and when you click on a proudct to view the product page, instead of having the product name as the title of the page, it just says; JAB Cellular - "Cellphones Without the Contract!"

 

What might be causing this? How can I fix/change this?

 

Any advice would be GREATLY appreciated!

 

Thank you in advance for your time, and I look forward to your reply!

 

Best Regards,


Alex Blythe

JAB Cellular - Owner

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

×