Jump to content



Latest News: (loading..)

- - - - -

SEF NIMMIT Update for OsC 2.3.1 (PhP 5.3)

sef nimmit 2.3.1 update

This topic has been archived. This means that you cannot reply to this topic.
10 replies to this topic

#-19   Stefan Hekman

Stefan Hekman
  • Members
  • 8 posts

Posted 07 March 2012 - 12:19 PM

Hello All,

The SEF NIMMIT script worked on my old version of OsC.
Google already knows all the urls of my categories.
Now that i installed a new version of OsC (2.3.1) none of the urls match anymore.
So thats why i want to change them excactly like the old links.

Now when i click it says: http://domainname.com/index.php/cPath/1
I want to change it into http://domainname.com/alfa-romeo-tuning.html

So i installed the 'immit sef' module.
In the install manual u have to disable sef in de config admin panel.
But when i install the files and turn sef off the webpage gives a few errors like:


Deprecated: Function eregi() is deprecated in /home/domainname.com/public_html/includes/nimmit_sef.php on line 19
Deprecated: Function eregi() is deprecated in /home/domainname.com/public_html/includes/nimmit_sef.php on line 20

When i turn sef ON in the config admin panel the errors disappear, but the links do not change.

The module defenitly needs an update, but i can't get it working.

Does anyone know how? I am willing to pay for the effort.

Any free help would be extremely appreciated!

Edited by Stefan Hekman, 07 March 2012 - 12:20 PM.


#-18   burt

burt

    Code Monkey

  • Community Team
  • 7,723 posts

Posted 07 March 2012 - 12:39 PM

You need to go through the nimmit code and replace all the deprecated code such as eregi which you can replace with preg_match
eBooks / Templates

Warning: My posts may contain Horsemeat.

#-17 ONLINE   toyicebear

toyicebear
  • Community Sponsor
  • 6,052 posts

Posted 07 March 2012 - 01:00 PM

You can find tips on fix those kind of errors in this topic>>>
Basics for osC 2.2 Design - Basics for Design V2.3+ - Seo & Sef Url's - Meta Tags for Your osC Shop - Steps to prevent Fraud... - MS3 and Team News... - SEO, Meta Tags, SEF Urls and osCommerce

Check out my profile [click here] for information on professional services, custom coding, templates, SEO optimization, modifications, commercial support and help.

#-16   Stefan Hekman

Stefan Hekman
  • Members
  • 8 posts

Posted 07 March 2012 - 01:25 PM

I have read it and tried to change ergi to preg_match with '!' and without '!'
Still getting errorrs:

Warning: preg_match() [function.preg-match]: No ending delimiter '^' found in /home/domainname.com/public_html/includes/nimmit_sef.php on line 19

This is the only script nimmit uses (i have made it original again):

<?php
# --> Nimmit SEF:B
  //products_id
  if(isset($HTTP_GET_VARS['products_id']) && !eregi('^[0-9]*$',$HTTP_GET_VARS['products_id'])){
	$name_Q= tep_db_query("select products_id from " . TABLE_PRODUCTS_DESCRIPTION . " where products_name = '" . str_replace("_"," ", $HTTP_GET_VARS['products_id']) . "'");
if(tep_db_num_rows($name_Q)){
	$t = tep_db_fetch_array($name_Q);
	$HTTP_GET_VARS['products_id'] = $t['products_id'];
  }
  }
  // manufactures_id
  if(isset($HTTP_GET_VARS['manufacturers_id']) && !eregi('^[0-9]*$',$HTTP_GET_VARS['manufacturers_id'])){
	$brand_Q = tep_db_query("select manufacturers_id from " . TABLE_MANUFACTURERS . " where manufacturers_name = '" . str_replace("_"," ", $HTTP_GET_VARS['manufacturers_id']) . "'");
if(tep_db_num_rows($brand_Q)){
   $t = tep_db_fetch_array($brand_Q);
	  $HTTP_GET_VARS['manufacturers_id'] = $t['manufacturers_id'];
}
  }
  if(isset($HTTP_GET_VARS['cPath']) && !eregi('^[_0-9]$', $HTTP_GET_VARS['cPath'])){
	if(!eregi('^[_0-9]*$',$cPath)){
   $cat_arr = explode('_' , $cPath);
   foreach($cat_arr as $value){
	 $cat_Q = tep_db_query("select categories_id from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_name = '" . str_replace('+' , ' ' , $value) . "'");
  $cat_name = tep_db_fetch_array($cat_Q);
  if(!$count){
	$result .= $cat_name['categories_id'];
	$count = true;
  }
  else{
	$result .= '_' . $cat_name['categories_id'];
  }
   }
   $HTTP_GET_VARS['cPath'] = $result;
}
  }
# --> Nimmit SEF:E
?>

Do you have an idea?

Edited by Stefan Hekman, 07 March 2012 - 01:26 PM.


#-15 ONLINE   toyicebear

toyicebear
  • Community Sponsor
  • 6,052 posts

Posted 07 March 2012 - 01:46 PM

For instance change this

Quote

if(!eregi('^[_0-9]*$',$cPath)){


To this

Quote

if(!preg_match('/^[_0-9]*$/i',$cPath)){


Basics for osC 2.2 Design - Basics for Design V2.3+ - Seo & Sef Url's - Meta Tags for Your osC Shop - Steps to prevent Fraud... - MS3 and Team News... - SEO, Meta Tags, SEF Urls and osCommerce

Check out my profile [click here] for information on professional services, custom coding, templates, SEO optimization, modifications, commercial support and help.

#-14   Stefan Hekman

Stefan Hekman
  • Members
  • 8 posts

Posted 07 March 2012 - 02:46 PM

View Posttoyicebear, on 07 March 2012 - 01:46 PM, said:

For instance change this


To this
Yes i thought that, but if i change that this error will appear:
Warning: preg_match() [function.preg-match]: No ending delimiter '^' found in /home/domainname.com/public_html/includes/nimmit_sef.php on line 20

Edited by Stefan Hekman, 07 March 2012 - 02:46 PM.


#-13 ONLINE   toyicebear

toyicebear
  • Community Sponsor
  • 6,052 posts

Posted 07 March 2012 - 03:19 PM

You must have done something wrong somewhere, the code example i gave is correct.....

check and make sure that you have the / before and the /i after inside the brackets exactly as in the example i gave.
Basics for osC 2.2 Design - Basics for Design V2.3+ - Seo & Sef Url's - Meta Tags for Your osC Shop - Steps to prevent Fraud... - MS3 and Team News... - SEO, Meta Tags, SEF Urls and osCommerce

Check out my profile [click here] for information on professional services, custom coding, templates, SEO optimization, modifications, commercial support and help.

#-12   Stefan Hekman

Stefan Hekman
  • Members
  • 8 posts

Posted 07 March 2012 - 06:11 PM

View Posttoyicebear, on 07 March 2012 - 03:19 PM, said:

You must have done something wrong somewhere, the code example i gave is correct.....

check and make sure that you have the / before and the /i after inside the brackets exactly as in the example i gave.
Nice! i didnt had the / in the brackets!
I no longer get errors if the sef in de admin panel /config is off by changing

Quote

if(!eregi('^[_0-9]*$',$cPath)){
to

Quote

if(!preg_match('/^[_0-9]*$/i',$cPath)){

This is how the nimmit_sef.php should be:

<?php
# --> Nimmit SEF:B
  //products_id
  if(isset($HTTP_GET_VARS['products_id']) && !preg_match('/^[_0-9]*$/i',$HTTP_GET_VARS['products_id'])){
	$name_Q= tep_db_query("select products_id from " . TABLE_PRODUCTS_DESCRIPTION . " where products_name = '" . str_replace("_"," ", $HTTP_GET_VARS['products_id']) . "'");
if(tep_db_num_rows($name_Q)){
  $t = tep_db_fetch_array($name_Q);
  $HTTP_GET_VARS['products_id'] = $t['products_id'];
}
  }  
  // manufactures_id
  if(isset($HTTP_GET_VARS['manufacturers_id']) && !preg_match('/^[_0-9]*$/i',$HTTP_GET_VARS['manufacturers_id'])){
	$brand_Q = tep_db_query("select manufacturers_id from " . TABLE_MANUFACTURERS . " where manufacturers_name = '" . str_replace("_"," ", $HTTP_GET_VARS['manufacturers_id']) . "'");
if(tep_db_num_rows($brand_Q)){
 $t = tep_db_fetch_array($brand_Q);
	  $HTTP_GET_VARS['manufacturers_id'] = $t['manufacturers_id'];
}
  }
  if(isset($HTTP_GET_VARS['cPath']) && !preg_match('/^[_0-9]*$/i', $HTTP_GET_VARS['cPath'])){
if(!preg_match('/^[_0-9]*$/i',$cPath)){
 $cat_arr = explode('_' , $cPath);
 foreach($cat_arr as $value){
   $cat_Q = tep_db_query("select categories_id from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_name = '" . str_replace('+' , ' ' , $value) . "'");
$cat_name = tep_db_fetch_array($cat_Q);
if(!$count){
 $result .= $cat_name['categories_id'];
 $count = true;
}
else{
 $result .= '_' . $cat_name['categories_id'];
} 
 }
 $HTTP_GET_VARS['cPath'] = $result;
}
  }
# --> Nimmit SEF:E
?>

But the script still aint showing the same Urls as before.
Maybe the second file: url_rewrite.php need some brackets to?

<?php
/*
SEF Link Transformer for osCommerce  (SEF stand for Search Engine Friendly)
Nimmit SEF v0.4
Original contibution base: Silencer (silencer@softhome.net)
New contribution with catgory names, brand names , and product names: Nimmit
*/

function callback($pagecontent) {
  $pagecontent = preg_replace_callback("/(<[Aa][ \r\n\t]{1}[^>]*href[^]*=[ '\"\n\r\t]*)([^ \"'>\r\n\t#]+)([^>]*>)/",'wrap_href',$pagecontent);
  return $pagecontent;
}
function transform_uri($param) {
  $uriparts = parse_url($param[2]);
  $newquery='';
  $scheme = $uriparts['scheme'].'://';
  if (($scheme != 'http://') && ($scheme != 'https://')) return $param[1].$param[2].$param[3];
  $host = $uriparts['host'];
  if ($host != $_SERVER['SERVER_NAME'] && $host != $_SERVER['SERVER_ADDR']) return $param[1].$param[2].$param[3];

  $path = $uriparts['path'];
  list($file,$extension) = explode('.', basename($path));
  if($extension != 'php') return $param[1].$param[2].$param[3];
  $extension = ".html";
  $path = rtrim(dirname($path),'/');
  $query = $uriparts['query'];
  $anchor = $uriparts['anchor'];
  if ($a = explode('&',$query)){
	foreach ($a as $B) {
   list($key,$val) = split('=',$B);
   switch ($key) {
  case 'cPath':
	  if(eregi('[_0-9]', $val)){
	 if($cat_arr = explode('_', $val)){
	   $count = false;
	   foreach($cat_arr as $value){
	  $cat_Q = tep_db_query("select c.categories_id, cd.categories_name from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . $value . "'  and c.categories_id = cd.categories_id");
	  $cat_name = tep_db_fetch_array($cat_Q);
	  if(!$count){
		$result .= $cat_name['categories_name'];
	 $count = true;
	  }
	  else{
		$result .= '_' . $cat_name['categories_name'];
	  }
	}
	$cat = '/category/'. str_replace(' ' , '+' , $result);
	 }
	 else{  
	   $cat = '/category/'.$val;
	 }
   }
   else{
	 $cat = '/category/'.$val;
   }
	  break;
  case 'language':
   $lan = $val.'/'.$path;
	  break;
  case 'products_id':
   $name_Q = tep_db_query("select products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . $val . "'");
		 $pro = ($t = tep_db_fetch_array($name_Q)) ? '/product/' . str_replace(" ", "_" , $t['products_name']) : '/product/'.$val;
	  break;
  case 'manufacturers_id':
	  $brand_Q = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . $val . "'");
		 $man = ($t = tep_db_fetch_array($brand_Q)) ? '/brand/'.str_replace(" ", "_" , $t['manufacturers_name']) : $man = '/brand/'.$val;
	  break;
  case 'osCsid':
	  if(strstr($_SERVER["HTTP_USER_AGENT"],'Mozilla'))  $newquery .= $key.'='.$val.'&';
	  break;
  default:
	  if($newquery || $key) $newquery .= $key.'='.$val.'&';  
   }
	}
  }
  if ($newquery) $newquery = '?'.rtrim($newquery,'&');
  $path = '';
  if(isset($man)) $path .= $man;
  if(isset($cat)) $path .= $cat;
  if(isset($pro)) $path .= $pro;

  ((isset($man) || isset($cat) || isset($pro))) ? $host .= '' :$host .= '/';
  if($file == 'index' || $file == 'product_info'){
	if((isset($man) || isset($cat) || isset($pro))) $file= '';
  }
  if(eregi('reviews',$file)) $file = '/' . $file;
  return $param[1].$scheme.$host.$file.$path.$extension.$newquery.$anchor.$param[3];

}
function wrap_href($param) {
  return transform_uri($param);
}
ob_start("callback");
?>

Thanks for your help!

Edited by Stefan Hekman, 07 March 2012 - 06:13 PM.


#-11 ONLINE   toyicebear

toyicebear
  • Community Sponsor
  • 6,052 posts

Posted 07 March 2012 - 11:16 PM

you need to replace all the eregi calls in that file too
Basics for osC 2.2 Design - Basics for Design V2.3+ - Seo & Sef Url's - Meta Tags for Your osC Shop - Steps to prevent Fraud... - MS3 and Team News... - SEO, Meta Tags, SEF Urls and osCommerce

Check out my profile [click here] for information on professional services, custom coding, templates, SEO optimization, modifications, commercial support and help.

#-10   Stefan Hekman

Stefan Hekman
  • Members
  • 8 posts

Posted 08 March 2012 - 10:15 AM

Damn, didnt see the eregi's in the code..
I have changed  this:

Quote

   if(eregi('[_0-9]', $val)){
in to:

Quote

   if(preg_match('/[_0-9]', $val)){
and

Quote

  if(eregi('reviews',$file)) $file = '/' . $file;
in to:

Quote

  if(preg_match('/reviews',$file)) $file = '/' . $file;

Is this correct?

#-9 ONLINE   toyicebear

toyicebear
  • Community Sponsor
  • 6,052 posts

Posted 08 March 2012 - 01:43 PM

No... like this:

Quote

if(preg_match('/[_0-9]/i', $val)){

Basics for osC 2.2 Design - Basics for Design V2.3+ - Seo & Sef Url's - Meta Tags for Your osC Shop - Steps to prevent Fraud... - MS3 and Team News... - SEO, Meta Tags, SEF Urls and osCommerce

Check out my profile [click here] for information on professional services, custom coding, templates, SEO optimization, modifications, commercial support and help.