Jump to content
Sign in to follow this  
BlueYon

Seach Engine Friendly URL Support

Recommended Posts

Hi there,

i have a lot of issues with the contrib :blink:

 

I use "STS v4 module by Rigadin" and the v1.6 from this contrib (i'll think that's the best one).

 

My Issue:

When i click on a category the URL show in the right syntax "localhost/category/sub-category" and the product_listing shows normaly -

but when i click on an product i'll see nothing on the productpage (localhost/category/sub-category/product.html) i see only my placeholder from STS

$searchbox, $cartbox, $categorybox, $manufacturerbox

 

Has anyone an idea? :rolleyes:

 

 

Hello Everyone..........

 

I am going through the provided "catalog" folder from the "all updates packaged" version with my file merge utility and everything was going fine with all the files that had the SEF code bracketed by the:

 

// SEF BEGIN

CODE

//SEF END

Everything was going fine until I arrived at the index.php file and started comparing it to mine. I have installed a few contributions, including HTC, and there is one very large section of code in the provided SEF index.php file that is very different compared to mine. This code is not as well defined in that, inside of the // SEF brackets some of my code matches and some does not.

 

My concern is ................. what do I do with this section? Do I just merge EVERYTHING within the // SEF brackets, or do I do something else?

 

Ohyeha, thats also my problem. My index.php has a lot of changes... has anyone a snipset from the code for the index.php?

Edited by IrOnGaTe

Share this post


Link to post
Share on other sites
thread above: DONE!

 

It is possible to become the manufacturer_name ist the URL?

 

Like this: "localhost/category/sub-category/manufacturer_name-product.html"

Share this post


Link to post
Share on other sites

i'm back :)

 

now another question:

 

My SEO URLs looks great, but when i click on the "optional Product List Filter" and change to another manufacturer the URL looks like "index.php?cPath=1033_1116&sort=3a&filter_id=" is there a way to change it?

 

also the link in the statusbar by hover a product or the "buy now button" looks like "http://localhost/index.php/cPath/1033_1116/sort/3a/action/buy_now/products_id/16505" is there a way to change it?

 

best regards from germany

 

Rudi

Share this post


Link to post
Share on other sites

I had a quick question before I install this contribution.

How well does it work with "quotes" in a product name.

In other words, will is strip them, or produce & quot or will it just screw it up entirely?

 

Many of our product titles have measurements in them, as in inches.

 

Thanks in advance

Edited by googlejunky

Share this post


Link to post
Share on other sites

help me

 

why i can not "Force Cookies"

Set Admin -> Configuration -> Sessions -> Force Cookies Use -> True

 

when i force cookies , i can't use function add to cart

all product can't use function "Add to cart"

The osCommerce say

 

Cookie Usage

We have detected that your browser does not support cookies, or has set cookies to be disabled.

To continue shopping online, we encourage you to enable cookies on your browser.

 

 

when i set admin -> Configuration -> Sessions -> Force Cookies Use -> False

all product can use function "Add to cart"

 

?????help me ple ?????

Share this post


Link to post
Share on other sites
help me

 

why i can not "Force Cookies"

Set Admin -> Configuration -> Sessions -> Force Cookies Use -> True

 

when i force cookies , i can't use function add to cart

all product can't use function "Add to cart"

The osCommerce say

 

Cookie Usage

We have detected that your browser does not support cookies, or has set cookies to be disabled.

To continue shopping online, we encourage you to enable cookies on your browser.

when i set admin -> Configuration -> Sessions -> Force Cookies Use -> False

all product can use function "Add to cart"

 

?????help me ple ?????

 

 

 

Well it did state plainly "We have detected that your browser does not support cookies, or has set cookies to be disabled.

To continue shopping online, we encourage you to enable cookies on your browser."

 

 

So... do you have cookies enables in your browser? Do you know how to do that?

 

 

Although I gave you a reply, I wouldn't expect many of them to show up here. I already tried asking a question here and have been waiting for a reply for quite awhile now. This is one very dead thread.

Don't expect much help here.

Edited by googlejunky

Share this post


Link to post
Share on other sites
So... do you have cookies enables in your browser? Do you know how to do that?

 

My Internet Explorer cookies enables ok .

ple.. >_<

 

Set Admin -> Configuration -> Sessions -> Force Cookies Use -> True

 

when i force cookies , i can't use function add to cart

Edited by kapook007

Share this post


Link to post
Share on other sites

Hello all, I am having a problem after my installation as well though somewhat different. It seems that in any categories where i have more than 1 page of products, when you click to view the next page, it just keeps coming up as the first page? I disabled the contribution and everything worked fine, so I know it is an issue with the contrib. Anyone have any ideas on how to fix this?

Share this post


Link to post
Share on other sites

Hello all,

Installed the contribution as directed. When i force cookies to true, I start getting errors on my index page like this:

 

Warning: array_key_exists(): The second argument should be either an array or an object in /srv/www/htdocs/catalog/catalog/includes/functions/sessions.php on line 127 Warning: array_key_exists(): The second argument should be either an array or an object in /srv/www/htdocs/catalog/catalog/includes/functions/sessions.php on line 127 Warning: array_key_exists(): The second argument should be either an array or an object in /srv/www/htdocs/catalog/catalog/includes/functions/sessions.php on line 127 Warning: array_key_exists(): The second argument should be either an array or an object in /srv/www/htdocs/catalog/catalog/includes/functions/sessions.php on line 127 Warning: array_key_exists(): The second argument should be either an array or an object in /srv/www/htdocs/catalog/catalog/includes/functions/sessions.php on line 127 Warning: array_key_exists(): The second argument should be either an array or an object in /srv/www/htdocs/catalog/catalog/includes/functions/sessions.php on line 127 Warning: array_key_exists(): The second argument should be either an array or an object in /srv/www/htdocs/catalog/catalog/includes/functions/sessions.php on line 127 Warning: array_key_exists(): The second argument should be either an array or an object in /srv/www/htdocs/catalog/catalog/includes/functions/sessions.php on line 127 Warning: array_key_exists(): The second argument should be either an array or an object in /srv/www/htdocs/catalog/catalog/includes/functions/sessions.php on line 127 Warning: array_key_exists(): The second argument should be either an array or an object in /srv/www/htdocs/catalog/catalog/includes/functions/sessions.php on line 127

 

Any idea what could be causing it?

Share this post


Link to post
Share on other sites
Hello all,

Installed the contribution as directed. When i force cookies to true, I start getting errors on my index page like this:

 

Warning: array_key_exists(): The second argument should be either an array or an object in /srv/www/htdocs/catalog/catalog/includes/functions/sessions.php on line 127 Warning: array_key_exists(): The second argument should be either an array or an object in /srv/www/htdocs/catalog/catalog/includes/functions/sessions.php on line 127 Warning: array_key_exists(): The second argument should be either an array or an object in /srv/www/htdocs/catalog/catalog/includes/functions/sessions.php on line 127 Warning: array_key_exists(): The second argument should be either an array or an object in /srv/www/htdocs/catalog/catalog/includes/functions/sessions.php on line 127 Warning: array_key_exists(): The second argument should be either an array or an object in /srv/www/htdocs/catalog/catalog/includes/functions/sessions.php on line 127 Warning: array_key_exists(): The second argument should be either an array or an object in /srv/www/htdocs/catalog/catalog/includes/functions/sessions.php on line 127 Warning: array_key_exists(): The second argument should be either an array or an object in /srv/www/htdocs/catalog/catalog/includes/functions/sessions.php on line 127 Warning: array_key_exists(): The second argument should be either an array or an object in /srv/www/htdocs/catalog/catalog/includes/functions/sessions.php on line 127 Warning: array_key_exists(): The second argument should be either an array or an object in /srv/www/htdocs/catalog/catalog/includes/functions/sessions.php on line 127 Warning: array_key_exists(): The second argument should be either an array or an object in /srv/www/htdocs/catalog/catalog/includes/functions/sessions.php on line 127

 

Any idea what could be causing it?

 

 

 

 

Look here first http://forums.oscommerce.com/index.php?showtopic=291794

Then here if the last one didn't help

http://forums.oscommerce.com/index.php?act...amp;pid=1199520

Edited by googlejunky

Share this post


Link to post
Share on other sites

Well, I finally got this working. I modified, kept notes and added a new contribution listing so it will work with the newest "osCommerce Online Merchant v2.2 Release Candidate 2a"

 

I know a lot of members have been having trouble with it and I needed it to work as well.

Trust that I was pulling my hair out trying to covert the outdated code to the newest oscommerce version.

 

I hope it works as well for you as it did me

http://addons.oscommerce.com/info/2796

 

The only mistake I might have made was that I didn't add the next highest version number. I added it as version 1.11 and it seems that a file I downloaded was 1.20, although it wasn't described in the page for other contributions. oh well :)

 

If you want to add to it then feel free to do so

 

Good luck in all you do,

Google Junky

Edited by googlejunky

Share this post


Link to post
Share on other sites

I've installed this great contrib on my test site (www.ikenmijnkind.nl/testwinkel), but when I click on the categories and subcategories nohting changes in the url. When I finally select a product, the url is changed. Also when I use the manufacturers box (Merken) it also works.

I've used version 1.9 (and the index.php of 1.10), tried the url rewrite fixes (1 to 3) and 'The doubled subcategories bug fixed + More than 2 level categories fix 1'.

The only big difference between my shop and the provided files is the html_output, because I use "On the Fly Auto Thumbnailer", but I also tried the provided html_output file, but without results.

 

Anyone an idea where I have to look?

Share this post


Link to post
Share on other sites
I've installed this great contrib on my test site (www.ikenmijnkind.nl/testwinkel), but when I click on the categories and subcategories nohting changes in the url. When I finally select a product, the url is changed. Also when I use the manufacturers box (Merken) it also works.

I've used version 1.9 (and the index.php of 1.10), tried the url rewrite fixes (1 to 3) and 'The doubled subcategories bug fixed + More than 2 level categories fix 1'.

The only big difference between my shop and the provided files is the html_output, because I use "On the Fly Auto Thumbnailer", but I also tried the provided html_output file, but without results.

 

Anyone an idea where I have to look?

 

 

 

what version of oscommerce are you using?

the last contribution I just added yesterday as a full package works for v2.2 Release Candidate 2a

Have you tried that one yet?

 

the one I added is a complete update from the old ones. I even simplified it so you don't have to replace files in the case that you have other contributions already incorporated.

Share this post


Link to post
Share on other sites

HI. have downloaded Sea®ch Engine Friendly URL v1.11.zip but it not include any url_rewrite.php :huh:

 

IT this contrib compatible with OSC 2.2ms2 17 aug 2006?

There is any way to make work with it?

Edited by scaistar

Share this post


Link to post
Share on other sites
HI. have downloaded Sea®ch Engine Friendly URL v1.11.zip but it not include any url_rewrite.php :huh:

 

IT this contrib compatible with OSC 2.2ms2 17 aug 2006?

There is any way to make work with it?

 

 

Sorry about that scaistar. I am uploading it right now with all the files and instructions again.

http://addons.oscommerce.com/info/2796

 

 

I am unable to tell you if it is compatible with OSC 2.2ms2 17 aug 2006

I have never used oscommerce before my join date here. my first experience with the code for it has been with the newest v2.2 Release Candidate 2a

 

 

Just be sure to make backups of all the files you change and try it out and see if it will work with your older version. There have been some noticeable changes when I converted code from just the last few contributions for this.

Let me know if you get it to work with your older version. It would be good information for someone else to know as well

Share this post


Link to post
Share on other sites
what version of oscommerce are you using?

the last contribution I just added yesterday as a full package works for v2.2 Release Candidate 2a

Have you tried that one yet?

 

the one I added is a complete update from the old ones. I even simplified it so you don't have to replace files in the case that you have other contributions already incorporated.

 

My application_top says 'osCommerce 2.2-MS2'.

 

I noticed there are differences in the index.php, but the provided one is from 2003 and mine from 2005. i've tried the changes, but without result.

 

Now, I did not use your 1.11. As I wrote above I used 1.9 and some fixes, because I did not want html extensions. A dutch colleague advised to use 1.9, because it worked for him to. He tried higher versions, but he had problems with it.

Share this post


Link to post
Share on other sites
My application_top says 'osCommerce 2.2-MS2'.

 

I noticed there are differences in the index.php, but the provided one is from 2003 and mine from 2005. i've tried the changes, but without result.

 

Now, I did not use your 1.11. As I wrote above I used 1.9 and some fixes, because I did not want html extensions. A dutch colleague advised to use 1.9, because it worked for him to. He tried higher versions, but he had problems with it.

 

 

I would suggest using your colleagues files then. It would make a shortcut for you if that person has it working.

I had to use a software called ExamDiff to compare the old contribution files with my newer ones just to get this to work with the newer oscommerce. There were noticeable changes. it was a pain, but I managed to pull it off.

Comparing the files side by side in a software made it so much easier than it would have been.

 

I wish you luck

Share this post


Link to post
Share on other sites
Ok - it is because I run my shop from /catalog

 

application_top.php:

 

FIND:

$url = str_replace('?', '/', $url);

$url = str_replace('=', '/', $url);

$url = str_replace('&', '/', $url);

 

AFTER, INSERT:

$url = str_replace('catalog/', '', $url);

 

FIND:

if((trim($PHP_SELF, '/') == FILENAME_DEFAULT)and(sizeof($url_array) > 0)){

 

REPLACE WITH:

if((str_replace('catalog/', '', trim($PHP_SELF, '/')) == FILENAME_DEFAULT)and(sizeof($url_array) > 0)){

 

Seems to work, except the category does not get printed in the URL, only the product name.

Best regards,

Brett

 

 

I'm stuck here as well.... I don't see what's wrong. My applicationtop.php looks like this below, any ideas?

 

 

<?php

/*

$Id: application_top.php,v 1.280 2003/07/12 09:38:07 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

// start the timer 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 if register_globals is enabled.

// since this is a temporary measure this message is hardcoded. The requirement will be removed before 2.2 is finalized.

if (function_exists('ini_get')) {

ini_get('register_globals') or 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.');

}

 

// Set the local configuration parameters - mainly for developers

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

 

// include server parameters

require('includes/configure.php');

 

if (strlen(DB_SERVER) < 1) {

if (is_dir('install')) {

header('Location: install/index.php');

}

}

 

// define the project version

define('PROJECT_VERSION', 'osCommerce 2.2-MS2');

 

// set the type of request (secure or not)

$request_type = (getenv('HTTPS') == 'on') ? 'SSL' : 'NONSSL';

 

// set php_self in the local scope

if (!isset($PHP_SELF)) $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF'];

 

if ($request_type == 'NONSSL') {

define('DIR_WS_CATALOG', DIR_WS_HTTP_CATALOG);

} else {

define('DIR_WS_CATALOG', DIR_WS_HTTPS_CATALOG);

}

 

// 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)

 

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

}

 

// if gzip_compression is enabled, start to buffer the output

if ( (GZIP_COMPRESSION == 'true') && ($ext_zlib_loaded = extension_loaded('zlib')) && (PHP_VERSION >= '4') ) {

if (($ini_zlib_output_compression = (int)ini_get('zlib.output_compression')) < 1) {

if (PHP_VERSION >= '4.0.4') {

ob_start('ob_gzhandler');

} else {

include(DIR_WS_FUNCTIONS . 'gzip_compression.php');

ob_start();

ob_implicit_flush();

}

} else {

ini_set('zlib.output_compression_level', GZIP_LEVEL);

}

}

 

// set the HTTP GET parameters manually if search_engine_friendly_urls is enabled

if (SEARCH_ENGINE_FRIENDLY_URLS == 'true') {

if (strlen(getenv('PATH_INFO')) > 1) {

$GET_array = array();

$PHP_SELF = str_replace(getenv('PATH_INFO'), '', $PHP_SELF);

$vars = explode('/', substr(getenv('PATH_INFO'), 1));

for ($i=0, $n=sizeof($vars); $i<$n; $i++) {

if (strpos($vars[$i], '[]')) {

$GET_array[substr($vars[$i], 0, -2)][] = $vars[$i+1];

} else {

$HTTP_GET_VARS[$vars[$i]] = $vars[$i+1];

}

$i++;

}

 

if (sizeof($GET_array) > 0) {

while (list($key, $value) = each($GET_array)) {

$HTTP_GET_VARS[$key] = $value;

}

}

}

}

 

// define general functions used application-wide

require(DIR_WS_FUNCTIONS . 'general.php');

require(DIR_WS_FUNCTIONS . 'html_output.php');

 

// set the cookie domain

$cookie_domain = (($request_type == 'NONSSL') ? HTTP_COOKIE_DOMAIN : HTTPS_COOKIE_DOMAIN);

$cookie_path = (($request_type == 'NONSSL') ? HTTP_COOKIE_PATH : HTTPS_COOKIE_PATH);

 

// include cache functions if enabled

if (USE_CACHE == 'true') include(DIR_WS_FUNCTIONS . 'cache.php');

// SEF BEGIN

require(DIR_WS_CLASSES . 'url_rewrite.php');

$url_rewrite = new url_rewrite;

$url_rewrite->request_url();

// SEF END

 

// include shopping cart class

require(DIR_WS_CLASSES . 'shopping_cart.php');

 

// include navigation history class

require(DIR_WS_CLASSES . 'navigation_history.php');

 

// some code to solve compatibility issues

require(DIR_WS_FUNCTIONS . 'compatibility.php');

 

// check if sessions are supported, otherwise use the php3 compatible session class

if (!function_exists('session_start')) {

define('PHP_SESSION_NAME', 'osCsid');

define('PHP_SESSION_PATH', $cookie_path);

define('PHP_SESSION_DOMAIN', $cookie_domain);

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('osCsid');

tep_session_save_path(SESSION_WRITE_DIRECTORY);

 

// set the session cookie parameters

if (function_exists('session_set_cookie_params')) {

session_set_cookie_params(0, $cookie_path, $cookie_domain);

} elseif (function_exists('ini_set')) {

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

ini_set('session.cookie_path', $cookie_path);

ini_set('session.cookie_domain', $cookie_domain);

}

 

// set the session ID if it exists

if (isset($HTTP_POST_VARS[tep_session_name()])) {

tep_session_id($HTTP_POST_VARS[tep_session_name()]);

} elseif ( ($request_type == 'SSL') && isset($HTTP_GET_VARS[tep_session_name()]) ) {

tep_session_id($HTTP_GET_VARS[tep_session_name()]);

}

 

// start the session

$session_started = false;

if (SESSION_FORCE_COOKIE_USE == 'True') {

tep_setcookie('cookie_test', 'please_accept_for_session', time()+60*60*24*30, $cookie_path, $cookie_domain);

 

if (isset($HTTP_COOKIE_VARS['cookie_test'])) {

tep_session_start();

$session_started = true;

}

} elseif (SESSION_BLOCK_SPIDERS == 'True') {

$user_agent = strtolower(getenv('HTTP_USER_AGENT'));

$spider_flag = false;

 

if (tep_not_null($user_agent)) {

$spiders = file(DIR_WS_INCLUDES . 'spiders.txt');

 

for ($i=0, $n=sizeof($spiders); $i<$n; $i++) {

if (tep_not_null($spiders[$i])) {

if (is_integer(strpos($user_agent, trim($spiders[$i])))) {

$spider_flag = true;

break;

}

}

}

}

 

if ($spider_flag == false) {

tep_session_start();

$session_started = true;

}

} else {

tep_session_start();

$session_started = true;

}

 

// set SID once, even if empty

$SID = (defined('SID') ? SID : '');

 

// verify the ssl_session_id if the feature is enabled

if ( ($request_type == 'SSL') && (SESSION_CHECK_SSL_SESSION_ID == 'True') && (ENABLE_SSL == true) && ($session_started == true) ) {

$ssl_session_id = getenv('SSL_SESSION_ID');

if (!tep_session_is_registered('SSL_SESSION_ID')) {

$SESSION_SSL_ID = $ssl_session_id;

tep_session_register('SESSION_SSL_ID');

}

 

if ($SESSION_SSL_ID != $ssl_session_id) {

tep_session_destroy();

tep_redirect(tep_href_link(FILENAME_SSL_CHECK));

}

}

 

// verify the browser user agent if the feature is enabled

if (SESSION_CHECK_USER_AGENT == 'True') {

$http_user_agent = getenv('HTTP_USER_AGENT');

if (!tep_session_is_registered('SESSION_USER_AGENT')) {

$SESSION_USER_AGENT = $http_user_agent;

tep_session_register('SESSION_USER_AGENT');

}

 

if ($SESSION_USER_AGENT != $http_user_agent) {

tep_session_destroy();

tep_redirect(tep_href_link(FILENAME_LOGIN));

}

}

 

// verify the IP address if the feature is enabled

if (SESSION_CHECK_IP_ADDRESS == 'True') {

$ip_address = tep_get_ip_address();

if (!tep_session_is_registered('SESSION_IP_ADDRESS')) {

$SESSION_IP_ADDRESS = $ip_address;

tep_session_register('SESSION_IP_ADDRESS');

}

 

if ($SESSION_IP_ADDRESS != $ip_address) {

tep_session_destroy();

tep_redirect(tep_href_link(FILENAME_LOGIN));

}

}

 

// create the shopping cart & fix the cart if necesary

if (tep_session_is_registered('cart') && is_object($cart)) {

if (PHP_VERSION < 4) {

$broken_cart = $cart;

$cart = new shoppingCart;

$cart->unserialize($broken_cart);

}

} else {

tep_session_register('cart');

$cart = new shoppingCart;

}

 

// include currencies class and create an instance

require(DIR_WS_CLASSES . 'currencies.php');

$currencies = new currencies();

 

// include the mail classes

require(DIR_WS_CLASSES . 'mime.php');

require(DIR_WS_CLASSES . 'email.php');

 

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

 

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

 

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

if (!$currency = tep_currency_exists($HTTP_GET_VARS['currency'])) $currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;

} else {

$currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;

}

}

 

// navigation history

if (tep_session_is_registered('navigation')) {

if (PHP_VERSION < 4) {

$broken_navigation = $navigation;

$navigation = new navigationHistory;

$navigation->unserialize($broken_navigation);

}

} else {

tep_session_register('navigation');

$navigation = new navigationHistory;

}

$navigation->add_current_page();

 

// Shopping cart actions

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

// redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled

if ($session_started == false) {

tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE));

}

 

if (DISPLAY_CART == 'true') {

$goto = FILENAME_SHOPPING_CART;

$parameters = array('action', 'cPath', 'products_id', 'pid');

} else {

$goto = basename($PHP_SELF);

if ($HTTP_GET_VARS['action'] == 'buy_now') {

$parameters = array('action', 'pid', 'products_id');

} else {

$parameters = array('action', 'pid');

}

}

switch ($HTTP_GET_VARS['action']) {

// customer wants to update the product quantity in their shopping cart

case 'update_product' : for ($i=0, $n=sizeof($HTTP_POST_VARS['products_id']); $i<$n; $i++) {

if (in_array($HTTP_POST_VARS['products_id'][$i], (is_array($HTTP_POST_VARS['cart_delete']) ? $HTTP_POST_VARS['cart_delete'] : array()))) {

$cart->remove($HTTP_POST_VARS['products_id'][$i]);

} else {

if (PHP_VERSION < 4) {

// if PHP3, make correction for lack of multidimensional array.

reset($HTTP_POST_VARS);

while (list($key, $value) = each($HTTP_POST_VARS)) {

if (is_array($value)) {

while (list($key2, $value2) = each($value)) {

if (ereg ("(.*)\]\[(.*)", $key2, $var)) {

$id2[$var[1]][$var[2]] = $value2;

}

}

}

}

$attributes = ($id2[$HTTP_POST_VARS['products_id'][$i]]) ? $id2[$HTTP_POST_VARS['products_id'][$i]] : '';

} else {

$attributes = ($HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]]) ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] : '';

}

$cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes, false);

}

}

tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

break;

// customer adds a product from the products page

case 'add_product' : if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {

$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+$HTTP_POST_VARS['quantity'], $HTTP_POST_VARS['id']);

}

tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

break;

// performed by the 'buy now' button in product listings and review page

case 'buy_now' : if (isset($HTTP_GET_VARS['products_id'])) {

if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {

tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));

} else {

$cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+1);

}

}

tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

break;

case 'notify' : if (tep_session_is_registered('customer_id')) {

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

$notify = $HTTP_GET_VARS['products_id'];

} elseif (isset($HTTP_GET_VARS['notify'])) {

$notify = $HTTP_GET_VARS['notify'];

} elseif (isset($HTTP_POST_VARS['notify'])) {

$notify = $HTTP_POST_VARS['notify'];

} else {

tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'notify'))));

}

if (!is_array($notify)) $notify = array($notify);

for ($i=0, $n=sizeof($notify); $i<$n; $i++) {

$check_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $notify[$i] . "' and customers_id = '" . $customer_id . "'");

$check = tep_db_fetch_array($check_query);

if ($check['count'] < 1) {

tep_db_query("insert into " . TABLE_PRODUCTS_NOTIFICATIONS . " (products_id, customers_id, date_added) values ('" . $notify[$i] . "', '" . $customer_id . "', now())");

}

}

tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'notify'))));

} else {

$navigation->set_snapshot();

tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

}

break;

case 'notify_remove' : if (tep_session_is_registered('customer_id') && isset($HTTP_GET_VARS['products_id'])) {

$check_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");

$check = tep_db_fetch_array($check_query);

if ($check['count'] > 0) {

tep_db_query("delete from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");

}

tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action'))));

} else {

$navigation->set_snapshot();

tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

}

break;

case 'cust_order' : if (tep_session_is_registered('customer_id') && isset($HTTP_GET_VARS['pid'])) {

if (tep_has_product_attributes($HTTP_GET_VARS['pid'])) {

tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['pid']));

} else {

$cart->add_cart($HTTP_GET_VARS['pid'], $cart->get_quantity($HTTP_GET_VARS['pid'])+1);

}

}

tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

break;

}

}

 

// include the who's online functions

require(DIR_WS_FUNCTIONS . 'whos_online.php');

tep_update_whos_online();

 

// include the password crypto functions

require(DIR_WS_FUNCTIONS . 'password_funcs.php');

 

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

require(DIR_WS_FUNCTIONS . 'validations.php');

 

// split-page-results

require(DIR_WS_CLASSES . 'split_page_results.php');

 

// infobox

require(DIR_WS_CLASSES . 'boxes.php');

 

// auto activate and expire banners

require(DIR_WS_FUNCTIONS . 'banner.php');

tep_activate_banners();

tep_expire_banners();

 

// auto expire special products

require(DIR_WS_FUNCTIONS . 'specials.php');

tep_expire_specials();

 

// calculate category path

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

$cPath = $HTTP_GET_VARS['cPath'];

} elseif (isset($HTTP_GET_VARS['products_id']) && !isset($HTTP_GET_VARS['manufacturers_id'])) {

$cPath = tep_get_product_path($HTTP_GET_VARS['products_id']);

} 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;

}

 

// include the breadcrumb class and start the breadcrumb trail

require(DIR_WS_CLASSES . 'breadcrumb.php');

$breadcrumb = new breadcrumb;

 

$breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER);

$breadcrumb->add(HEADER_TITLE_CATALOG, tep_href_link(FILENAME_DEFAULT));

 

// add category names or the manufacturer name to the breadcrumb trail

if (isset($cPath_array)) {

for ($i=0, $n=sizeof($cPath_array); $i<$n; $i++) {

$categories_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$cPath_array[$i] . "' and language_id = '" . (int)$languages_id . "'");

if (tep_db_num_rows($categories_query) > 0) {

$categories = tep_db_fetch_array($categories_query);

$breadcrumb->add($categories['categories_name'], tep_href_link(FILENAME_DEFAULT, 'cPath=' . implode('_', array_slice($cPath_array, 0, ($i+1)))));

} else {

break;

}

}

} elseif (isset($HTTP_GET_VARS['manufacturers_id'])) {

$manufacturers_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'");

if (tep_db_num_rows($manufacturers_query)) {

$manufacturers = tep_db_fetch_array($manufacturers_query);

$breadcrumb->add($manufacturers['manufacturers_name'], tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id']));

}

}

 

// add the products model to the breadcrumb trail

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

$model_query = tep_db_query("select products_model from " . TABLE_PRODUCTS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");

if (tep_db_num_rows($model_query)) {

$model = tep_db_fetch_array($model_query);

$breadcrumb->add($model['products_model'], tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . $cPath . '&products_id=' . $HTTP_GET_VARS['products_id']));

}

}

 

// initialize the message stack for output messages

require(DIR_WS_CLASSES . 'message_stack.php');

$messageStack = new messageStack;

 

// set which precautions should be checked

define('WARN_INSTALL_EXISTENCE', 'true');

define('WARN_CONFIG_WRITEABLE', 'true');

define('WARN_SESSION_DIRECTORY_NOT_WRITEABLE', 'true');

define('WARN_SESSION_AUTO_START', 'true');

define('WARN_DOWNLOAD_DIRECTORY_NOT_READABLE', 'true');

?>

Share this post


Link to post
Share on other sites

Hi, great thought trying to pull all the mods together into a working mod, especially for osc 2.2 rc2a.

Would really love to see this work and im sure lots have got it working.

I have tried but i get Parse error: syntax error, unexpected '}' in /osc/index.php on line 542. tried changing it but just throws up other errors.

I did get rid of that error by loading another index.php from an earlier version but then get great urls but "page not found error" at the bottom of the and the url changes but doesnt change the page from the index page.

 

would love to get this working through the last package as it says its designed with rc2a in mind.

 

anyone have the answer?

Cheers in advance.

Share this post


Link to post
Share on other sites

* Updated to Search Engine Friendly URL v1.12

Fixed one line of code that was missing and leaving an error about a closing bracket

I also added catalog/index.php with all the changes in the case that someone has a fresh install of osCommerce or has made no changes to their index.php since their first install.

Still only works for osCommerce v2.2 RC2a unless someone tells me otherwise. It hasn't been tested on older versions.

 

 

Good luck in all you do,

Google Junky

Share this post


Link to post
Share on other sites
Hi, great thought trying to pull all the mods together into a working mod, especially for osc 2.2 rc2a.

Would really love to see this work and im sure lots have got it working.

I have tried but i get Parse error: syntax error, unexpected '}' in /osc/index.php on line 542. tried changing it but just throws up other errors.

I did get rid of that error by loading another index.php from an earlier version but then get great urls but "page not found error" at the bottom of the and the url changes but doesnt change the page from the index page.

 

would love to get this working through the last package as it says its designed with rc2a in mind.

 

anyone have the answer?

Cheers in advance.

 

Your problem should be fixed now. Only time will tell...waiting for your reply :)

my personal opinion is that the contributors need to stop adding snippets of fixes and keep updating the full package instead.

Well that is they should only add snippets if it is not really directly related to fixing the original and just extra features that not everyone would want in it.

That is just my opinion though

Share this post


Link to post
Share on other sites

Uploaded v1.12 once again because of a minor fluke on my part. I hadn't saved the index.php file with all the changes before sending it up.

The correct one is there now.

Share this post


Link to post
Share on other sites

It seems that it doesn't work for products?

 

Any way to fix that? My install is not in the basedirectory.

Share this post


Link to post
Share on other sites
It seems that it doesn't work for products?

 

Any way to fix that? My install is not in the basedirectory.

 

I don't have a test area set up to test your sub directory type of install.

The only thing that I can see that would be different is changing the one part in the htaccess file

RewriteRule ^(.*) index.php

change to 

RewriteRule ^catalog/(.*) index.php

 

I'm just taking a big guess at this since I can't test it.

 

I'm assuming it worked fine before, which would let me know that you have your config set up correctly already for oscommerce.

 

 

If it does work then let me know so I can add it to the instructions.

Share this post


Link to post
Share on other sites

SEO Warning

 

This contribution allows all server errors(404 and others) to only return to the content of the homepage of your site and using the same url that the error happen on. In the sense of SEO this is very bad.

 

I have went into this contribution pretty deep and finally after days of trying to find a solution to it I have came a point where I know there isn't a solution.

Well, that is there isn't one for this contribution.

I just made a bad choice in assuming that the previous programmers knew better than to allow it to work this way.

 

What does this mean?

Well, I'll tell you...

 

Your index.php page will be used for every wrong url that is accessed by search engines

This wrong url is kept in the address bar and the content of index.php used

This means that you will have many many duplicate content pages.

 

This contribution takes a 404 return code and changes it into a 200 return code. Search engines will think that this no existent page is a good page.

 

A person could type anything they want to get your site and showing the front page

 

domain.com/porn

domain.com/porn.html

domain.com/anything_here/more_stuff

 

 

This contribution was a waste of my time to try to update and make work.

In the end is was very SEO unfriendly if a site owner has to deal with a duplicate content penalty.

A competitor could easily submit your site to directories with false title, description and place an obscene url with it that validates and have your site related to things that your site has nothing to do with.

 

 

I suggest you go with Ultimate SEO URLs at http://addons.oscommerce.com/info/2823

The download from member "FWR Media" works just fine with osCommerce 2.2RC2a.

It allows the errors that are supposed to happen naturally.

The developer made the scripting to work with the .htaccess file the way it should have been used.

 

 

Sorry if I babbled a bit, but it was very irritating that I spent all this time and effort on something that didn't work as it should have. It did give a good false sense of function.

Edited by googlejunky

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
Sign in to follow this  

×