Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

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


Recommended Posts

I'm having a question regarding the "preventDuplicates"-class.

My problem is, that the titles of the pages are modified, when changing the language or changing pages in product listing:

language_en | other title => for english
language_de | other title => for german
language_es | other title => for espanol

sort_2a page_1 language_de | other title
sort_2a page_2 language_de | other title

....

But one question:

Is it possible, to move this prevention method ('sort', 'page', 'language', 'currency') behind the original title ?

For example:

other title | language_en => for english
other title | language_de => for german
other title | language_es => for espanol

other title | sort_2a page_1 language_de
other title | sort_2a page_2 language_de

 

Is it correct, that the sort order of the title/meta-pattern can be influenced in the function "performPCRE" ??

Then I guess, that changing these lines here maybe the right point:

   $pattern[]   = '@<title>\s*@i';
   $pattern[]   = '@<meta\s*name\s*=\s*"\s*description\s*"\s*content\s*=\s*"\s*@i';
   $pattern[]   = '@<meta\s*name\s*=\s*"\s*keywords\s*"\s*content\s*=\s*"\s*@i';
   $replace[]   = '<title>' . str_replace('-', ' | ', $this->addedMeta);
   $replace[]   = '<meta name="description" content="' . str_replace('-', ' ', $this->addedMeta);
   $replace[]   = '<meta name="keywords" content="' . str_replace('-', ', ', $this->addedMeta);

but I don't know how.

 

I saw, that FWR is the author of this file.

@FWR, maybe you can help me please.

 

Thanks in advance,

kind regards

Andreas

Link to comment
Share on other sites

not yet, I thought that line wouldnt be there just for fun... but I will try :)

 

Does not seem to work, the index is a blank page in firefox, and internal server error 500 in Internet Explorer. Is that because of the #Options +FollowSymLinks or should I look somewhere else?

 

chem

Link to comment
Share on other sites

Is it correct, that the sort order of the title/meta-pattern can be influenced in the function "performPCRE" ??

Then I guess, that changing these lines here maybe the right point:

   $pattern[]   = '@<title>\s*@i';
   $pattern[]   = '@<meta\s*name\s*=\s*"\s*description\s*"\s*content\s*=\s*"\s*@i';
   $pattern[]   = '@<meta\s*name\s*=\s*"\s*keywords\s*"\s*content\s*=\s*"\s*@i';
   $replace[]   = '<title>' . str_replace('-', ' | ', $this->addedMeta);
   $replace[]   = '<meta name="description" content="' . str_replace('-', ' ', $this->addedMeta);
   $replace[]   = '<meta name="keywords" content="' . str_replace('-', ', ', $this->addedMeta);

but I don't know how.

 

I saw, that FWR is the author of this file.

@FWR, maybe you can help me please.

 

Thanks in advance,

kind regards

Andreas

 

Any advice ?

 

Thank you very much in advance!

Link to comment
Share on other sites

Is it correct, that the sort order of the title/meta-pattern can be influenced in the function "performPCRE" ??

 

Any advice ?

I'm confused on what your problem is and what version you are using. But if you are using Ultimate SEO v 2.7, then that needs to be changed since no one is supporting it, as far as I know.

Edited by Jack_mcs

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

I'm confused on what your problem is and what version you are using. But if you are using Ultimate SEO v 2.7, then that needs to be changed since no one is supporting it, as far as I know.

 

Thanks for your answer, Jack.

Yes, that's right, I'm on v2.7.

But why should I change it, when it is working correctly and giving me multi-language-URLs. I'm satisfied at this point, except for the a.m.

 

Robert has written this piece of code some time ago.

And I think, for the needed change only a quick look at the a.m. code is needed.

 

The full code of the file "preventDuplicates.php" is:

<?php
/**
* Google Duplicate Content Manager
* 
* oscommerce version compatability - MS-2.2, RC1, RC2, RC2a
* PHP4/5, MySQL (No DB changes needed)
* Adds title/meta to pages in order to cure duplicate title/meta problems
* @package preventDuplicates.php
* @link http://www.fwrmedia.co.uk/ FWR Media
* @copyright Copyright 2008, FWR Media
* @author Robert Fisher
* @filesource catalog/includes/classes/preventDuplicates
* @version 1.0alpha
* @license See standard oscommerce license
* filename preventDuplicates.php
* date: 07 September 2008
*/

/**
* class preventDuplicates
* 
* @param $getValues - array of $_GET variables which will action the added meta
* @param $meta - contains the title/meta info prior to being altered by this class
* @param $caught - Numerical array containing $_GET keys that were present in $getValues
* @param $addedMeta - $_GET as a string containing key value pairs
* @param $finalMeta - The modified (or not) meta that will be printed to screen
* @param $IhaveDuplicateContent - Set to true or false dependent on whether Google webmaster tolls is showing duplicate content
* @param $noIndex - meta shown when $IhaveDuplicateContent is set to false 
*/
class preventDuplicates {

 var $getValues = array('sort', 'page', 'language', 'currency');
 var $IhaveDuplicateContent = true;
 var $turnServiceOn = true; // true turns on false will turn this service off
 var $meta;
 var $caught;
 var $addedMeta;
 var $finalMeta;
 var $noIndex = '<meta name="ROBOTS" content="NOINDEX, FOLLOW" />';

 function preventDuplicates(){
 }
 /**
 * Sets $this->finalMeta (Final meta to be output based on the methods and properties below
 * 
 * @param mixed $meta - $meta - contains the buffered title/meta info prior to being altered by this class
 * @method - $this->targetsExist() - Returns true or false based on whether $getValues was found in $_GET
 * @method - $this->parseMeta() - Ultimately sets $this->finalMeta;
 */
 function checkTarget($meta) {

   $this->meta = $meta;
   if( $this->targetsExist() && (false !== $this->turnServiceOn) ){
     if( false !== $this->IhaveDuplicateContent ){
     $this->parseMeta();
     } else {
       $this->finalMeta = $this->meta . "\n" . $this->noIndex;
     }
   } else {
     $this->finalMeta = $this->meta;
   }
 }
 /**
 * Checks whether any $this->getValues exist in the $_GET array
 * 
 * @param - $this->caught - set as an array of keys found in $_GET 
 * @return - Returns true or false, if true $this->caught is also set as an array
 */
 function targetsExist(){
   $caught = array();
   foreach( $this->getValues as $value ){
     if( isset($_GET[$value]) ){
       $caught[] = tep_output_string_protected($value);
     }
 }
 if( !empty($caught)) {
   $this->caught = $caught;
   return true; 
 } else{
   return false;
 }
 }
 /**
 * Sets $this->addedMeta which is a string made up of matched $_GET key value pairs
 * Key value pairs are seperated with _ (underscore) seperate $_GET are se[erated with - (hyphen)
 * 
 * @param $this->addedMeta -  A string made up of matched $_GET key value pairs
 * @method $this->performPCRE() - performs PCRE replace operations on the buffered $meta  
 * 
 */
 function parseMeta(){

   $addedMeta = '';
   $count = count($this->caught);
   for( $i=0; $i<$count; $i++ ){
     $addedMeta .= $this->caught[$i] . '_' . tep_sanitize_string(tep_output_string_protected($_GET[$this->caught[$i]])) . '-';
   }
   $this->addedMeta = $addedMeta;
   $this->performPCRE();
 }
 /**
 * PCRE replace operations to inject added meta info based on matched $_GET variables
 * 
 * @param $this->finalMeta - Sets $this->finalMeta which contains the modified meat data 
 */
 function performPCRE() {

   $pattern[]   = '@<title>\s*@i';
   $pattern[]   = '@<meta\s*name\s*=\s*"\s*description\s*"\s*content\s*=\s*"\s*@i';
   $pattern[]   = '@<meta\s*name\s*=\s*"\s*keywords\s*"\s*content\s*=\s*"\s*@i';
   $replace[]   = '<title>' . str_replace('-', ' | ', $this->addedMeta);
   $replace[]   = '<meta name="description" content="' . str_replace('-', ' ', $this->addedMeta);
   $replace[]   = '<meta name="keywords" content="' . str_replace('-', ', ', $this->addedMeta);

   $this->finalMeta = preg_replace($pattern, $replace, $this->meta);
 }

} //End preventDuplicates class  
?>

 

I think, that the title and the meta description is separated first and then added together with this mentioned sorting prefix / sorting separator.

 

Thanks for your help,

regards

Andreas

Link to comment
Share on other sites

Yes, that's right, I'm on v2.7.

But why should I change it, when it is working correctly and giving me multi-language-URLs. I'm satisfied at this point, except for the a.m.

Because no one is supporting it. If you want to continue using it, your'e on your own unless someone decides to help.

Robert has written this piece of code some time ago.

And I think, for the needed change only a quick look at the a.m. code is needed.

You need to ask him about his code.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Thanks for your answer, Jack.

Yes, that's right, I'm on v2.7.

But why should I change it, when it is working correctly and giving me multi-language-URLs. I'm satisfied at this point, except for the a.m.

 

Robert has written this piece of code some time ago.

And I think, for the needed change only a quick look at the a.m. code is needed.

 

The full code of the file "preventDuplicates.php" is:

<?php
/**
* Google Duplicate Content Manager
* 
* oscommerce version compatability - MS-2.2, RC1, RC2, RC2a
* PHP4/5, MySQL (No DB changes needed)
* Adds title/meta to pages in order to cure duplicate title/meta problems
* @package preventDuplicates.php
* @link http://www.fwrmedia.co.uk/ FWR Media
* @copyright Copyright 2008, FWR Media
* @author Robert Fisher
* @filesource catalog/includes/classes/preventDuplicates
* @version 1.0alpha
* @license See standard oscommerce license
* filename preventDuplicates.php
* date: 07 September 2008
*/

/**
* class preventDuplicates
* 
* @param $getValues - array of $_GET variables which will action the added meta
* @param $meta - contains the title/meta info prior to being altered by this class
* @param $caught - Numerical array containing $_GET keys that were present in $getValues
* @param $addedMeta - $_GET as a string containing key value pairs
* @param $finalMeta - The modified (or not) meta that will be printed to screen
* @param $IhaveDuplicateContent - Set to true or false dependent on whether Google webmaster tolls is showing duplicate content
* @param $noIndex - meta shown when $IhaveDuplicateContent is set to false 
*/
class preventDuplicates {

 var $getValues = array('sort', 'page', 'language', 'currency');
 var $IhaveDuplicateContent = true;
 var $turnServiceOn = true; // true turns on false will turn this service off
 var $meta;
 var $caught;
 var $addedMeta;
 var $finalMeta;
 var $noIndex = '<meta name="ROBOTS" content="NOINDEX, FOLLOW" />';

 function preventDuplicates(){
 }
 /**
 * Sets $this->finalMeta (Final meta to be output based on the methods and properties below
 * 
 * @param mixed $meta - $meta - contains the buffered title/meta info prior to being altered by this class
 * @method - $this->targetsExist() - Returns true or false based on whether $getValues was found in $_GET
 * @method - $this->parseMeta() - Ultimately sets $this->finalMeta;
 */
 function checkTarget($meta) {

   $this->meta = $meta;
   if( $this->targetsExist() && (false !== $this->turnServiceOn) ){
     if( false !== $this->IhaveDuplicateContent ){
     $this->parseMeta();
     } else {
       $this->finalMeta = $this->meta . "\n" . $this->noIndex;
     }
   } else {
     $this->finalMeta = $this->meta;
   }
 }
 /**
 * Checks whether any $this->getValues exist in the $_GET array
 * 
 * @param - $this->caught - set as an array of keys found in $_GET 
 * @return - Returns true or false, if true $this->caught is also set as an array
 */
 function targetsExist(){
   $caught = array();
   foreach( $this->getValues as $value ){
     if( isset($_GET[$value]) ){
       $caught[] = tep_output_string_protected($value);
     }
 }
 if( !empty($caught)) {
   $this->caught = $caught;
   return true; 
 } else{
   return false;
 }
 }
 /**
 * Sets $this->addedMeta which is a string made up of matched $_GET key value pairs
 * Key value pairs are seperated with _ (underscore) seperate $_GET are se[erated with - (hyphen)
 * 
 * @param $this->addedMeta -  A string made up of matched $_GET key value pairs
 * @method $this->performPCRE() - performs PCRE replace operations on the buffered $meta  
 * 
 */
 function parseMeta(){

   $addedMeta = '';
   $count = count($this->caught);
   for( $i=0; $i<$count; $i++ ){
     $addedMeta .= $this->caught[$i] . '_' . tep_sanitize_string(tep_output_string_protected($_GET[$this->caught[$i]])) . '-';
   }
   $this->addedMeta = $addedMeta;
   $this->performPCRE();
 }
 /**
 * PCRE replace operations to inject added meta info based on matched $_GET variables
 * 
 * @param $this->finalMeta - Sets $this->finalMeta which contains the modified meat data 
 */
 function performPCRE() {

   $pattern[]   = '@<title>\s*@i';
   $pattern[]   = '@<meta\s*name\s*=\s*"\s*description\s*"\s*content\s*=\s*"\s*@i';
   $pattern[]   = '@<meta\s*name\s*=\s*"\s*keywords\s*"\s*content\s*=\s*"\s*@i';
   $replace[]   = '<title>' . str_replace('-', ' | ', $this->addedMeta);
   $replace[]   = '<meta name="description" content="' . str_replace('-', ' ', $this->addedMeta);
   $replace[]   = '<meta name="keywords" content="' . str_replace('-', ', ', $this->addedMeta);

   $this->finalMeta = preg_replace($pattern, $replace, $this->meta);
 }

} //End preventDuplicates class  
?>

 

I think, that the title and the meta description is separated first and then added together with this mentioned sorting prefix / sorting separator.

 

Thanks for your help,

regards

Andreas

 

The support topic for this is here why you are asking this question in the ultimate seo urls thread I don't know.

Link to comment
Share on other sites

Does anyone have a recommendation on how to deal with the problem of inserting 301 redirects on an old site to transition to Ultimate SEO?

 

I have version Ultimate_SEO_URLSv22d_7 installed on a new site and it is working great and now want to install it on an existing site, but my seo guy says I need to redirect all the old product URL's.

 

I found this post referencing Ultimate SEO which suggests dynamically rewriting page requests that use the old format:

 

About half way down this page is a discussion by Gtech:

http://forums.digitalpoint.com/showthread.php?t=136032

 

Seach the page for the "1) Ultimate SEO is what you want. This is a great contribution and I use it myself." to jump right to it.

 

But I wanted a second opinion from this forum. What's the best solution to the 301 problem for a user of Ultimate SEO on an established osCommerce site?

Link to comment
Share on other sites

Does anyone have a recommendation on how to deal with the problem of inserting 301 redirects on an old site to transition to Ultimate SEO?

Enable the auto redirect option in the settings and it will issue the 301.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

A new version has been uploaded with these changes:

 

- Added check for updating configure settings to remove warnings

- Added url verification code - works for categories and products - rest is still to be done

- Added option to add cPath ID to url back in per several requests

- Fixed typo for the articles topic cache code

- Replaced eregi call in admin/categories.php

 

If you have a recent version of 2.2d, then you just need to upload the contents of the upload directory to upgrade to this version.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Hy,

 

I have troubles with your Ultimate_SEO_URLSv22d_8 !

website url : http://www.zenetnature.fr/index.php

My htaccess in the root directory :

Options +FollowSymLinks

RewriteEngine On

RewriteBase /

 

RewriteRule ^(.*)-p-(.*).html$ product_info.php?products_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-c-(.*).html$ index.php?cPath=$2&%{QUERY_STRING}

RewriteRule ^(.*)-m-(.*).html$ index.php?manufacturers_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-pi-(.*).html$ popup_image.php?pID=$2&%{QUERY_STRING}

RewriteRule ^(.*)-by-(.*).html$ all-products.php?fl=$2&%{QUERY_STRING}

RewriteRule ^(.*)-t-(.*).html$ articles.php?tPath=$2&%{QUERY_STRING}

RewriteRule ^(.*)-a-(.*).html$ article_info.php?articles_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-au-(.*).html$ articles.php?authors_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-pr-(.*).html$ product_reviews.php?products_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-pri-(.*).html$ product_reviews_info.php?products_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-f-(.*).html$ faqdesk_info.php?faqdesk_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-fc-(.*).html$ faqdesk_index.php?faqPath=$2&%{QUERY_STRING}

RewriteRule ^(.*)-fri-(.*).html$ faqdesk_reviews_info.php?faqdesk_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-fra-(.*).html$ faqdesk_reviews_article.php?faqdesk_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-i-(.*).html$ information.php?info_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-links-(.*).html$ links.php?lPath=$2&%{QUERY_STRING}

RewriteRule ^(.*)-pm-([0-9]+).html$ info_pages.php?pages_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-n-(.*).html$ newsdesk_info.php?newsdesk_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-nc-(.*).html$ newsdesk_index.php?newsPath=$2&%{QUERY_STRING}

RewriteRule ^(.*)-nri-(.*).html$ newsdesk_reviews_info.php?newsdesk_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-nra-(.*).html$ newsdesk_reviews_article.php?newsdesk_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-po-([0-9]+).html$ pollbooth.php?pollid=$2&%{QUERY_STRING}

 

When you click on a product : nothing happens !

when i want to log to my admin, i've got this error message :

Warning: main(includes/classes/navigation_history.php) [function.main]: failed to open stream: No such file or directory in /XXXXXXX/zenetnat/www/admin/includes/application_top.php on line 136

 

Fatal error: main() [function.require]: Failed opening required 'includes/classes/navigation_history.php' (include_path='.:/usr/local/lib/php') in /XXXXXXX/zenetnat/www/admin/includes/application_top.php on line 136

 

May you can help me on this ?

 

thx

 

David

Link to comment
Share on other sites

Hy,

 

I have troubles with your Ultimate_SEO_URLSv22d_8 !

website url : http://www.zenetnature.fr/index.php

My htaccess in the root directory :

Options +FollowSymLinks

RewriteEngine On

RewriteBase /

 

RewriteRule ^(.*)-p-(.*).html$ product_info.php?products_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-c-(.*).html$ index.php?cPath=$2&%{QUERY_STRING}

RewriteRule ^(.*)-m-(.*).html$ index.php?manufacturers_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-pi-(.*).html$ popup_image.php?pID=$2&%{QUERY_STRING}

RewriteRule ^(.*)-by-(.*).html$ all-products.php?fl=$2&%{QUERY_STRING}

RewriteRule ^(.*)-t-(.*).html$ articles.php?tPath=$2&%{QUERY_STRING}

RewriteRule ^(.*)-a-(.*).html$ article_info.php?articles_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-au-(.*).html$ articles.php?authors_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-pr-(.*).html$ product_reviews.php?products_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-pri-(.*).html$ product_reviews_info.php?products_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-f-(.*).html$ faqdesk_info.php?faqdesk_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-fc-(.*).html$ faqdesk_index.php?faqPath=$2&%{QUERY_STRING}

RewriteRule ^(.*)-fri-(.*).html$ faqdesk_reviews_info.php?faqdesk_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-fra-(.*).html$ faqdesk_reviews_article.php?faqdesk_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-i-(.*).html$ information.php?info_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-links-(.*).html$ links.php?lPath=$2&%{QUERY_STRING}

RewriteRule ^(.*)-pm-([0-9]+).html$ info_pages.php?pages_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-n-(.*).html$ newsdesk_info.php?newsdesk_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-nc-(.*).html$ newsdesk_index.php?newsPath=$2&%{QUERY_STRING}

RewriteRule ^(.*)-nri-(.*).html$ newsdesk_reviews_info.php?newsdesk_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-nra-(.*).html$ newsdesk_reviews_article.php?newsdesk_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-po-([0-9]+).html$ pollbooth.php?pollid=$2&%{QUERY_STRING}

 

When you click on a product : nothing happens !

when i want to log to my admin, i've got this error message :

Warning: main(includes/classes/navigation_history.php) [function.main]: failed to open stream: No such file or directory in /XXXXXXX/zenetnat/www/admin/includes/application_top.php on line 136

 

Fatal error: main() [function.require]: Failed opening required 'includes/classes/navigation_history.php' (include_path='.:/usr/local/lib/php') in /XXXXXXX/zenetnat/www/admin/includes/application_top.php on line 136

 

May you can help me on this ?

 

thx

 

David

 

Can't help with the first problem as I don't support this version.

 

Re: your second problem:

Failed opening required 'includes/classes/navigation_history.php'

 

admin/includes/application_top.php does not include the navigation class so looks like you have overwritten the admin file with catalog/includes/application_top.php

Link to comment
Share on other sites

Still David on http://www.zenetnature.fr/index.php !

 

If I don't add a double } at the end of your code in includes/the application_top.php, I've got this error :

Parse error: syntax error, unexpected $end in /homez.332/zenetnat/www/includes/application_top.php on line 523

 

with my application top file :

 

<?php

/*

$Id: application_top.php 1833 2008-01-30 22:03:30Z hpdl $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2008 osCommerce

 

Released under the GNU General Public License

*/

 

// Start the clock for the page parse time log

define('PAGE_PARSE_START_TIME', microtime());

 

// Set the level of error reporting

error_reporting(E_ALL & ~E_NOTICE);

 

// check support for register_globals

if (function_exists('ini_get') && (ini_get('register_globals') == false) && (PHP_VERSION < 4.3) ) {

exit('Server Requirement Error: register_globals is disabled in your PHP configuration. This can be enabled in your php.ini configuration file or in the .htaccess file in your catalog directory. Please use PHP 4.3+ if register_globals cannot be enabled on the server.');

}

 

// Set the local configuration parameters - mainly for developers

if (file_exists('includes/local/configure.php')) include('includes/local/configure.php');

 

// Include application configuration parameters

require('includes/configure.php');

 

// Define the project version

define('PROJECT_VERSION', 'osCommerce Online Merchant v2.2 RC2a');

 

// some code to solve compatibility issues

require(DIR_WS_FUNCTIONS . 'compatibility.php');

 

// set php_self in the local scope

$PHP_SELF = (isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME']);

 

// Used in the "Backup Manager" to compress backups

define('LOCAL_EXE_GZIP', '/usr/bin/gzip');

define('LOCAL_EXE_GUNZIP', '/usr/bin/gunzip');

define('LOCAL_EXE_ZIP', '/usr/local/bin/zip');

define('LOCAL_EXE_UNZIP', '/usr/local/bin/unzip');

 

// include the list of project filenames

require(DIR_WS_INCLUDES . 'filenames.php');

 

// include the list of project database tables

require(DIR_WS_INCLUDES . 'database_tables.php');

 

// customization for the design layout

define('BOX_WIDTH', 125); // how wide the boxes should be in pixels (default: 125)

 

// Define how do we update currency exchange rates

// Possible values are 'oanda' 'xe' or ''

define('CURRENCY_SERVER_PRIMARY', 'oanda');

define('CURRENCY_SERVER_BACKUP', 'xe');

 

// include the database functions

require(DIR_WS_FUNCTIONS . 'database.php');

 

// make a connection to the database... now

tep_db_connect() or die('Unable to connect to database server!');

 

// set application wide parameters

$configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION);

while ($configuration = tep_db_fetch_array($configuration_query)) {

define($configuration['cfgKey'], $configuration['cfgValue']);

}

 

// define our general functions used application-wide

require(DIR_WS_FUNCTIONS . 'general.php');

require(DIR_WS_FUNCTIONS . 'html_output.php');

 

// initialize the logger class

require(DIR_WS_CLASSES . 'logger.php');

 

// include shopping cart class

require(DIR_WS_CLASSES . 'shopping_cart.php');

 

// check to see if php implemented session management functions - if not, include php3/php4 compatible session class

if (!function_exists('session_start')) {

define('PHP_SESSION_NAME', 'osCAdminID');

define('PHP_SESSION_PATH', '/');

define('PHP_SESSION_SAVE_PATH', SESSION_WRITE_DIRECTORY);

 

include(DIR_WS_CLASSES . 'sessions.php');

}

 

// define how the session functions will be used

require(DIR_WS_FUNCTIONS . 'sessions.php');

 

// set the session name and save path

tep_session_name('osCAdminID');

tep_session_save_path(SESSION_WRITE_DIRECTORY);

 

// set the session cookie parameters

if (function_exists('session_set_cookie_params')) {

session_set_cookie_params(0, DIR_WS_ADMIN);

} elseif (function_exists('ini_set')) {

ini_set('session.cookie_lifetime', '0');

ini_set('session.cookie_path', DIR_WS_ADMIN);

}

 

// lets start our session

tep_session_start();

 

if ( (PHP_VERSION >= 4.3) && function_exists('ini_get') && (ini_get('register_globals') == false) ) {

extract($_SESSION, EXTR_OVERWRITE+EXTR_REFS);

}

 

// 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'];

}

 

// redirect to login page if administrator is not yet logged in

if (!tep_session_is_registered('admin')) {

$redirect = false;

 

$current_page = basename($PHP_SELF);

 

if ($current_page != FILENAME_LOGIN) {

if (!tep_session_is_registered('redirect_origin')) {

tep_session_register('redirect_origin');

 

$redirect_origin = array('page' => $current_page,

'get' => $HTTP_GET_VARS);

}

 

$redirect = true;

}

 

if ($redirect == true) {

tep_redirect(tep_href_link(FILENAME_LOGIN));

}

 

unset($redirect);

}

 

// include the language translations

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

$current_page = basename($PHP_SELF);

if (file_exists(DIR_WS_LANGUAGES . $language . '/' . $current_page)) {

include(DIR_WS_LANGUAGES . $language . '/' . $current_page);

}

 

// define our localization functions

require(DIR_WS_FUNCTIONS . 'localization.php');

 

// Include validation functions (right now only email address)

require(DIR_WS_FUNCTIONS . 'validations.php');

 

// setup our boxes

require(DIR_WS_CLASSES . 'table_block.php');

require(DIR_WS_CLASSES . 'box.php');

 

// initialize the message stack for output messages

require(DIR_WS_CLASSES . 'message_stack.php');

$messageStack = new messageStack;

 

// split-page-results

require(DIR_WS_CLASSES . 'split_page_results.php');

 

// entry/item info classes

require(DIR_WS_CLASSES . 'object_info.php');

 

// email classes

require(DIR_WS_CLASSES . 'mime.php');

require(DIR_WS_CLASSES . 'email.php');

 

// file uploading class

require(DIR_WS_CLASSES . 'upload.php');

 

// calculate category path

if (isset($HTTP_GET_VARS['cPath'])) {

$cPath = $HTTP_GET_VARS['cPath'];

} else {

$cPath = '';

}

 

if (tep_not_null($cPath)) {

$cPath_array = tep_parse_category_path($cPath);

$cPath = implode('_', $cPath_array);

$current_category_id = $cPath_array[(sizeof($cPath_array)-1)];

} else {

$current_category_id = 0;

}

 

// default open navigation box

if (!tep_session_is_registered('selected_box')) {

tep_session_register('selected_box');

$selected_box = 'configuration';

}

 

if (isset($HTTP_GET_VARS['selected_box'])) {

$selected_box = $HTTP_GET_VARS['selected_box'];

}

 

// the following cache blocks are used in the Tools->Cache section

// ('language' in the filename is automatically replaced by available languages)

$cache_blocks = array(array('title' => TEXT_CACHE_CATEGORIES, 'code' => 'categories', 'file' => 'categories_box-language.cache', 'multiple' => true),

array('title' => TEXT_CACHE_MANUFACTURERS, 'code' => 'manufacturers', 'file' => 'manufacturers_box-language.cache', 'multiple' => true),

array('title' => TEXT_CACHE_ALSO_PURCHASED, 'code' => 'also_purchased', 'file' => 'also_purchased-language.cache', 'multiple' => true)

);

 

// check if a default currency is set

if (!defined('DEFAULT_CURRENCY')) {

$messageStack->add(ERROR_NO_DEFAULT_CURRENCY_DEFINED, 'error');

}

 

// check if a default language is set

if (!defined('DEFAULT_LANGUAGE')) {

$messageStack->add(ERROR_NO_DEFAULT_LANGUAGE_DEFINED, 'error');

}

 

if (function_exists('ini_get') && ((bool)ini_get('file_uploads') == false) ) {

$messageStack->add(WARNING_FILE_UPLOADS_DISABLED, 'warning');

}

?>

 

 

THX

 

David

Link to comment
Share on other sites

Still David on http://www.zenetnature.fr/index.php !

 

If I don't add a double } at the end of your code in includes/the application_top.php, I've got this error :

Parse error: syntax error, unexpected $end in /homez.332/zenetnat/www/includes/application_top.php on line 523

 

with my application top file :

You may want to try editing the includes/application_top.php file, per the instructions, instead of admin/includes/application_top.php.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Hi

 

Recently upgraded from 2.2d_7 to 2.2d_8 but the cPath variable option doesn't come up under the SEO URLs menu.

 

All I get are options:

 

Add category parent to product URLs? true

Add category parent to begining of URLs? false

 

For the upgrade I just copied the reset.seo.cache and seo.class from the upload dir.

 

Also as an aside when I try to uninstall the SEO URLs it tells me CACHE table does not exist ...

Link to comment
Share on other sites

Recently upgraded from 2.2d_7 to 2.2d_8 but the cPath variable option doesn't come up under the SEO URLs menu.

 

All I get are options:

 

Add category parent to product URLs? true

Add category parent to begining of URLs? false

 

For the upgrade I just copied the reset.seo.cache and seo.class from the upload dir.

 

Also as an aside when I try to uninstall the SEO URLs it tells me CACHE table does not exist ...

All that changed in this update was the classes/seo.class.php file. The cache table has never been changed since the contribution was released so you shouldn't be seeing such an error. Try going into admin and using the uninstall option. Then go to your shop and click on the home page, which will re-install it.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

All that changed in this update was the classes/seo.class.php file. The cache table has never been changed since the contribution was released so you shouldn't be seeing such an error. Try going into admin and using the uninstall option. Then go to your shop and click on the home page, which will re-install it.

 

Hi Jack

 

I have uninstalled SEO URLs ( had to manually delete the records on the configuration table as using the UNINSTALL option would display the "1146 - Table 'xxxxxx_oscommerce.cache' doesn't exist")

 

So the SEO URL has now reinstalled after refreshing the page.

 

I have set "Add category parent to product URLs?" to true. This is for category name and ID I assume?

 

Anyway the cPath ID is still not being passed through with the rewritten URLs ...

 

Have double checked my edited files and .htaccess to match the original install instructions ...

Link to comment
Share on other sites

Anyway the cPath ID is still not being passed through with the rewritten URLs ...

Someone that was testing this pointed out that I uploaded the wrong file somehow. The one uploaded did not have all of the changes in, thus your problem. I have uploaded a new version. Please use the seo.class.php file from it and see if that is any better. I do aplogize for the frustration and confusion this caused.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Someone that was testing this pointed out that I uploaded the wrong file somehow. The one uploaded did not have all of the changes in, thus your problem. I have uploaded a new version. Please use the seo.class.php file from it and see if that is any better. I do aplogize for the frustration and confusion this caused.

 

 

Thanks ... now it works fine. cPath id is passed through.

 

There is another problem though :( ... When I disable the contribution i.e. set Enable SEO URLs to false, when I try to view a product (product_info.php) it hangs before displaying "This webpage has a redirected loop". When I enable SEO again it's fine.

 

My setup info:

 

Osc 2.2-MS2

PHP 5.2.13

Apache 2.2.15

 

I am also using the Product Listing Enhancements, Thumbnails & Manufacturers contrib.

Link to comment
Share on other sites

I installed and the url's are changed.

But it seems that changing the settings in admin doesn't do anything.

Whatever I change everything stays the same.

 

I allready uninstalled and reloaded the home page and still the settings remain unfunctional.

I need to remove the category from the url.

 

Anny ideas?

Link to comment
Share on other sites

This just does not work for me. Followed the instructions about 4-5 times and cannot see where i have gone wrong.

 

The urls for products show up all nice and seo'd but the page cannot be displayed.

 

URL: http://74.54.136.150/~whifbitz/

 

Heres the .htaccess which is in my public html root:

 

Options +FollowSymLinks

RewriteEngine On

RewriteBase /

 

RewriteRule ^(.*)-p-(.*).html$ product_info.php?products_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-c-(.*).html$ index.php?cPath=$2&%{QUERY_STRING}

RewriteRule ^(.*)-m-(.*).html$ index.php?manufacturers_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-pi-(.*).html$ popup_image.php?pID=$2&%{QUERY_STRING}

RewriteRule ^(.*)-by-(.*).html$ all-products.php?fl=$2&%{QUERY_STRING}

RewriteRule ^(.*)-t-(.*).html$ articles.php?tPath=$2&%{QUERY_STRING}

RewriteRule ^(.*)-a-(.*).html$ article_info.php?articles_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-au-(.*).html$ articles.php?authors_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-pr-(.*).html$ product_reviews.php?products_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-pri-(.*).html$ product_reviews_info.php?products_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-f-(.*).html$ faqdesk_info.php?faqdesk_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-fc-(.*).html$ faqdesk_index.php?faqPath=$2&%{QUERY_STRING}

RewriteRule ^(.*)-fri-(.*).html$ faqdesk_reviews_info.php?faqdesk_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-fra-(.*).html$ faqdesk_reviews_article.php?faqdesk_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-i-(.*).html$ information.php?info_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-links-(.*).html$ links.php?lPath=$2&%{QUERY_STRING}

RewriteRule ^(.*)-pm-([0-9]+).html$ info_pages.php?pages_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-n-(.*).html$ newsdesk_info.php?newsdesk_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-nc-(.*).html$ newsdesk_index.php?newsPath=$2&%{QUERY_STRING}

RewriteRule ^(.*)-nri-(.*).html$ newsdesk_reviews_info.php?newsdesk_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-nra-(.*).html$ newsdesk_reviews_article.php?newsdesk_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-po-([0-9]+).html$ pollbooth.php?pollid=$2&%{QUERY_STRING}

 

Thanks for any help!

Link to comment
Share on other sites

There is another problem though :( ... When I disable the contribution i.e. set Enable SEO URLs to false, when I try to view a product (product_info.php) it hangs before displaying "This webpage has a redirected loop". When I enable SEO again it's fine.

This is a known situation and has been mentioned many times in this thread. You need to set all of the settings to false, not just the first one.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

This just does not work for me. Followed the instructions about 4-5 times and cannot see where i have gone wrong.

 

The urls for products show up all nice and seo'd but the page cannot be displayed.

 

URL: http://74.54.136.150/~whifbitz/

This has been answered several times recently. The contribution won't work with an IP.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

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