Updated by Clustersolutions 05-05-2015
Updated by Piernas 01-31-2017.
Simple installation - should take only a few minutes.
Notes:
Another documents:
Upload the files and directories in the "uploads" directory to your server maintaining the directory structure of osCommerce.
Please note that "catalog" refers to the root of your osCommerce install and probably won't actually exist.
These are all new files so will not affect your osCommerce installation.
Important: now ensure that the following two directories are writable. Dependent on your server this may be 0755 or 0777.
Now upload the files in additional_uploads/ again .. maintaining the osCommerce directory structure. Those files overwrite the existiing ones, so I sggest you to do a backup.
Find ( this is within a block of code ) ...
tep_draw_form('filter', 'index.php', 'get')
Replace with ...
tep_draw_form('filter', tep_href_link( 'index.php' ), 'get')
Find ( complete function ) ...
////
// The HTML href link wrapper function
function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) {
global $request_type, $session_started, $SID;
$page = tep_output_string($page);
if (!tep_not_null($page)) {
die('</td></tr></table></td></tr></table><br /><br /><font color="#ff0000"><strong>Error!</strong></font><br /><br /><strong>Unable to determine the page link!<br /><br />');
}
if ($connection == 'NONSSL') {
$link = HTTP_SERVER . DIR_WS_HTTP_CATALOG;
} elseif ($connection == 'SSL') {
if (ENABLE_SSL == true) {
$link = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG;
} else {
$link = HTTP_SERVER . DIR_WS_HTTP_CATALOG;
}
} else {
die('</td></tr></table></td></tr></table><br /><br /><font color="#ff0000"><strong>Error!</strong></font><br /><br /><strong>Unable to determine connection method on a link!<br /><br />Known methods: NONSSL SSL</strong><br /><br />');
}
if (tep_not_null($parameters)) {
$link .= $page . '?' . tep_output_string($parameters);
$separator = '&';
} else {
$link .= $page;
$separator = '?';
}
while ( (substr($link, -1) == '&') || (substr($link, -1) == '?') ) $link = substr($link, 0, -1);
// Add the session ID when moving from different HTTP and HTTPS servers, or when SID is defined
if ( ($add_session_id == true) && ($session_started == true) && (SESSION_FORCE_COOKIE_USE == 'False') ) {
if (tep_not_null($SID)) {
$_sid = $SID;
} elseif ( ( ($request_type == 'NONSSL') && ($connection == 'SSL') && (ENABLE_SSL == true) ) || ( ($request_type == 'SSL') && ($connection == 'NONSSL') ) ) {
if (HTTP_COOKIE_DOMAIN != HTTPS_COOKIE_DOMAIN) {
$_sid = tep_session_name() . '=' . tep_session_id();
}
}
}
if (isset($_sid)) {
$link .= $separator . tep_output_string($_sid);
}
while (strstr($link, '&&')) $link = str_replace('&&', '&', $link);
if ( (SEARCH_ENGINE_FRIENDLY_URLS == 'true') && ($search_engine_safe == true) ) {
$link = str_replace('?', '/', $link);
$link = str_replace('&', '/', $link);
$link = str_replace('=', '/', $link);
} else {
$link = str_replace('&', '&', $link);
}
return $link;
}
Replace with ...
/**
* ULTIMATE Seo Urls 5 PRO by FWR Media
* Replacement for osCommerce href link wrapper function
*/
require_once 'includes/modules/ultimate_seo_urls5/main/usu5.php';
function tep_href_link( $page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true ) {
return Usu_Main::i()->hrefLink( $page, $parameters, $connection, $add_session_id, $search_engine_safe );
}
Find ...
// set php_self in the local scope
$req = parse_url($_SERVER['SCRIPT_NAME']);
$PHP_SELF = substr($req['path'], ($request_type == 'NONSSL') ? strlen(DIR_WS_HTTP_CATALOG) : strlen(DIR_WS_HTTPS_CATALOG));
Replace with ...
/**
* ULTIMATE Seo Urls 5 PRO by FWR Media
* function to return the base filename
*/
function usu5_base_filename() {
// Probably won't get past SCRIPT_NAME unless this is reporting cgi location
$base = new ArrayIterator( array( 'SCRIPT_NAME', 'PHP_SELF', 'REQUEST_URI', 'ORIG_PATH_INFO', 'HTTP_X_ORIGINAL_URL', 'HTTP_X_REWRITE_URL' ) );
while ( $base->valid() ) {
if ( array_key_exists( $base->current(), $_SERVER ) && !empty( $_SERVER[$base->current()] ) ) {
if ( false !== strpos( $_SERVER[$base->current()], '.php' ) ) {
preg_match( '@[a-z0-9_]+\.php@i', $_SERVER[$base->current()], $matches );
if ( is_array( $matches ) && ( array_key_exists( 0, $matches ) )
&& ( substr( $matches[0], -4, 4 ) == '.php' )
&& ( is_readable( $matches[0] ) ) ) {
return $matches[0];
}
}
}
$base->next();
}
// Some odd server set ups return / for SCRIPT_NAME and PHP_SELF when accessed as mysite.com (no index.php) where they usually return /index.php
if ( ( $_SERVER['SCRIPT_NAME'] == '/' ) || ( $_SERVER['PHP_SELF'] == '/' ) ) {
return 'index.php';
}
// Return the standard RC3 code
return ( ( ( strlen( ini_get( 'cgi.fix_pathinfo' ) ) > 0) && ( (bool)ini_get( 'cgi.fix_pathinfo' ) == false ) ) || !isset( $_SERVER['SCRIPT_NAME'] ) ) ? basename( $_SERVER['PHP_SELF'] ) : basename( $_SERVER['SCRIPT_NAME'] );
} // End function
// set php_self in the local scope
$PHP_SELF = usu5_base_filename();
Find ...
require('includes/languages/' . $language . '.php');
Add immediately ABOVE ...
/**
* ULTIMATE Seo Urls 5 PRO by FWR Media
*/
Usu_Main::i()->setVar( 'languages_id', $languages_id )
->setVar( 'request_type', $request_type )
->setVar( 'session_started', $session_started )
->setVar( 'sid', $SID )
->setVar( 'language', $language )
->setVar( 'filename', $PHP_SELF )
->initiate( ( isset( $lng ) && ( $lng instanceof language ) ) ? $lng : array(), $languages_id, $language );
Find ...
$navigation->add_current_page();
Add immediately BELOW ...
/**
* ULTIMATE Seo Urls 5 PRO by FWR Media
*/
if (USU5_MULTI_LANGUAGE_SEO_SUPPORT=="true") {
include_once 'includes/modules/ultimate_seo_urls5/includes/hreflang.php';
$usu5_multi = new FWR_hreflang( $navigation, $language, (isset( $lng ) && ( $lng instanceof language ) ) ? $lng : array(), $session_started );
}
Find ( in the long line search for action=buy_now ): ...
tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id'])
Replace with ...
tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'products_id')) . 'action=buy_now&products_id=' . $listing['products_id'])
Note: Don't worry if you can't find the above, if you have a modified file the code may not exist
Find ...
if (tep_not_null($action)) {
Replace with ...
if (tep_not_null($action)) {
// ULTIMATE Seo Urls 5 PRO by FWR Media
// If the action will affect the cache entries
if ( $action == 'insert' || $action == 'update' || $action == 'setflag' ) {
tep_reset_cache_data_usu5( 'reset' );
}
At the very bottom of the file (immediately above the very final ?> if exists) add ...
/**
* ULTIMATE Seo Urls 5 PRO by FWR Media
* Reset the various cache systems
* @param string $action
*/
function tep_reset_cache_data_usu5( $action = false ) {
if ( $action == 'reset' ) {
$usu5_path = realpath( dirname( __FILE__ ) . '/../../../' ) . '/' . 'includes/modules/ultimate_seo_urls5/';
switch( USU5_CACHE_SYSTEM ) {
case 'file':
$path_to_cache = $usu5_path . 'cache_system/cache/';
$it = new DirectoryIterator( $path_to_cache );
while( $it->valid() ) {
if ( !$it->isDot() && is_readable( $path_to_cache . $it->getFilename() ) && ( substr( $it->getFilename(), -6 ) == '.cache' ) ) {
@unlink( $path_to_cache . $it->getFilename() );
}
$it->next();
}
break;
case 'mysql':
tep_db_query( 'TRUNCATE TABLE `usu_cache`' );
break;
case 'memcache':
if ( class_exists('Memcache') ){
include $usu5_path . 'interfaces/cache_interface.php';
include $usu5_path . 'cache_system/memcache.php';
Memcache_Cache_Module::iAdmin()->initiate()
->flushOut();
}
break;
case 'sqlite':
include $usu5_path . 'interfaces/cache_interface.php';
include $usu5_path . 'cache_system/sqlite.php';
Sqlite_Cache_Module::admini()->gc();
break;
}
tep_db_query( "UPDATE configuration SET configuration_value='false' WHERE configuration_key='USU5_RESET_CACHE'" );
}
} // end function
Although special language characters replacement can still be used via admin it is very limited. You now have the ability to add individual character conversion files to the following directory:catalog/includes/modules/ultimate_seo_urls5/includes/character_conversion. Some languages are already there.
The files must be named exactly the same as your language file in catalog/includes/languages/ - e.g. danish.php or german.php or espanol.php etc.
For most of these files I have tried to put the special characters in the array but it is up to you to add the English equivalents.
I also have tried to save the files in a relevant encoding but again, it is up to you to ensure the encoding matches the output of your site.
Once you have added files to the character_conversion folder these will take precedence and the admin settings will not work for that particular language.
Once a character conversion file has been completed it would be a great help to others if you could email the file to me so that I can add the full files to the next release.
IMPORTANT!!! If you enable multilanguage support for this contribution you have to use the multilanguage box and/or navbar modules replacing the stock oscommerce ones. You can locate the modules on the addittional_uploads directory of this package.
Paypal donation link from the original author (FWR Media):