Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Dummies Guide to Updating an old osCommerce Shop


Recommended Posts

If you have an old osCommerce shop and want to update the code on it or if you want to build a test shop, here are the steps you could take:

Step1: Create a replica of your live database.

You do this by going to your control panel and doing a restore of your live shop database. There will be 2 options, one to overwrite the database, and another to create a replica database. Select the 2nd option.

After you have done this there will be 4 pieces of information you need for the database, so keep this webpage open.

Step2: Copy the W3-osCommerce shop files into a test folder.

Copy the W3-osCommerce shop files into a test folder of your domain. If you use another name for the folder you will need to modify these instructions accordingly.

You can delete the installation folder, and configuration files because we won't be using those.

Step3: Modify the configure files.

Now you have to copy your live shop configure files into the test shop folder.

On the catalog side, here is what the configure will look like:

<?php
  define('HTTP_SERVER', 'https://www.myshop.com');
  define('HTTPS_SERVER', 'https://www.myshop.com');
  define('ENABLE_SSL', true);
  define('HTTP_COOKIE_DOMAIN', '');
  define('HTTPS_COOKIE_DOMAIN', '');  
  define('HTTP_COOKIE_PATH', '/');
  define('HTTPS_COOKIE_PATH', '/');
  define('DIR_WS_HTTP_CATALOG', '/');
  define('DIR_WS_HTTPS_CATALOG', '/');
  define('DIR_WS_IMAGES', 'images/');
  define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');  
  define('DIR_WS_INCLUDES', 'includes/');
  define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');
  define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
  define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');
  define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');

  define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/');  
  define('DIR_FS_CATALOG', '/usr/www/users/xxx/');
  define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
  define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

  define('DB_SERVER', 'xxx');
  define('DB_SERVER_USERNAME', 'xxx');
  define('DB_SERVER_PASSWORD', 'xxx');
  define('DB_DATABASE', 'xxx');
  define('USE_PCONNECT', 'false');
  define('STORE_SESSIONS', 'mysql');
  define('CFG_TIME_ZONE', 'Africa/Johannesburg');
?>

myshop.com is your domain name.

Take note of these 4 lines:

  define('DB_SERVER', 'xxx');
  define('DB_SERVER_USERNAME', 'xxx');
  define('DB_SERVER_PASSWORD', 'xxx');
  define('DB_DATABASE', 'xxx');

You will have to complete this section with the 4 pieces of information mentioned in Step1.

This is what the new configure file needs to look like before you copy it into the test shop folder.

<?php
  define('HTTP_SERVER', 'https://www.myshop.com');
  define('HTTPS_SERVER', 'https://www.myshop.com');
  define('ENABLE_SSL', true);
  define('HTTP_COOKIE_DOMAIN', '');
  define('HTTPS_COOKIE_DOMAIN', '');  
  define('HTTP_COOKIE_PATH', '/test/');
  define('HTTPS_COOKIE_PATH', '/test/');
  define('DIR_WS_HTTP_CATALOG', '/test/');
  define('DIR_WS_HTTPS_CATALOG', '/test/');
  define('DIR_WS_IMAGES', 'images/');
  define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');  
  define('DIR_WS_INCLUDES', 'includes/');
  define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');
  define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
  define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');
  define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');

  define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/');  
  define('DIR_FS_CATALOG', '/usr/www/users/xxx/test/');
  define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
  define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

  define('DB_SERVER', 'xxx');
  define('DB_SERVER_USERNAME', 'xxx');
  define('DB_SERVER_PASSWORD', 'xxx');
  define('DB_DATABASE', 'xxx');
  define('USE_PCONNECT', 'false');
  define('STORE_SESSIONS', 'mysql');
  define('CFG_TIME_ZONE', 'Africa/Johannesburg');
?>

Take note of where "test" needs to be.

On the Admin configure file, before:

<?php
  define('HTTP_SERVER', 'https://www.myshop.com');
  define('HTTPS_SERVER', 'https://www.myshop.com');
  define('ENABLE_SSL', true);
  define('HTTP_COOKIE_DOMAIN', '');
  define('HTTPS_COOKIE_DOMAIN', '');  
  define('HTTP_COOKIE_PATH', '/admin');
  define('HTTPS_COOKIE_PATH', '/admin');
  define('HTTP_CATALOG_SERVER', 'https://www.myshop.com');
  define('HTTPS_CATALOG_SERVER', 'https://www.myshop.com');
  define('ENABLE_SSL_CATALOG', 'true');
  define('DIR_FS_DOCUMENT_ROOT', '/usr/www/users/xxx/');
  define('DIR_WS_ADMIN', '/admin/');
  define('DIR_WS_HTTPS_ADMIN', '/admin/');
  define('DIR_FS_ADMIN', '/usr/www/users/xxx/admin/');
  define('DIR_WS_CATALOG', '/');
  define('DIR_WS_HTTPS_CATALOG', '/');
  define('DIR_FS_CATALOG', '/usr/www/users/xxx/');
  define('DIR_WS_IMAGES', 'images/');
  define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');  
  define('DIR_WS_CATALOG_IMAGES', DIR_WS_CATALOG . 'images/');
  define('DIR_WS_INCLUDES', 'includes/');
  define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');
  define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');
  define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
  define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');
  define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');    
  define('DIR_WS_CATALOG_LANGUAGES', DIR_WS_CATALOG . 'includes/languages/');
  define('DIR_FS_CATALOG_LANGUAGES', DIR_FS_CATALOG . 'includes/languages/');
  define('DIR_FS_CATALOG_IMAGES', DIR_FS_CATALOG . 'images/');
  define('DIR_FS_CATALOG_MODULES', DIR_FS_CATALOG . 'includes/modules/');
  define('DIR_FS_BACKUP', DIR_FS_ADMIN . 'backups/');
  define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
  define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

  define('DB_SERVER', 'xxx');
  define('DB_SERVER_USERNAME', 'xxx');
  define('DB_SERVER_PASSWORD', 'xxx');
  define('DB_DATABASE', 'xxx');
  define('USE_PCONNECT', 'false');
  define('STORE_SESSIONS', 'mysql');
  define('CFG_TIME_ZONE', 'Africa/Johannesburg'); 
?>

After:

<?php
  define('HTTP_SERVER', 'https://www.myshop.com');
  define('HTTPS_SERVER', 'https://www.myshop.com');
  define('ENABLE_SSL', false);
  define('HTTP_COOKIE_DOMAIN', '');
  define('HTTPS_COOKIE_DOMAIN', '');
  define('HTTP_COOKIE_PATH', '/test/admin');
  define('HTTPS_COOKIE_PATH', '/test/admin');
  define('HTTP_CATALOG_SERVER', 'https://www.myshop.com');
  define('HTTPS_CATALOG_SERVER', 'https://www.myshop.com');
  define('ENABLE_SSL_CATALOG', 'false');
  define('DIR_FS_DOCUMENT_ROOT', '/usr/www/users/xxx/test/');
  define('DIR_WS_ADMIN', '/test/admin/');
  define('DIR_WS_HTTPS_ADMIN', '/test/admin/');
  define('DIR_FS_ADMIN', '/usr/www/users/xxx/test/admin/');
  define('DIR_WS_CATALOG', '/test/');
  define('DIR_WS_HTTPS_CATALOG', '/test/');
  define('DIR_FS_CATALOG', '/usr/www/users/xxx/test/');
  define('DIR_WS_IMAGES', 'images/');
  define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');
  define('DIR_WS_CATALOG_IMAGES', DIR_WS_CATALOG . 'images/');
  define('DIR_WS_INCLUDES', 'includes/');
  define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');
  define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');
  define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
  define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');
  define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');
  define('DIR_WS_CATALOG_LANGUAGES', DIR_WS_CATALOG . 'includes/languages/');
  define('DIR_FS_CATALOG_LANGUAGES', DIR_FS_CATALOG . 'includes/languages/');
  define('DIR_FS_CATALOG_IMAGES', DIR_FS_CATALOG . 'images/');
  define('DIR_FS_CATALOG_MODULES', DIR_FS_CATALOG . 'includes/modules/');
  define('DIR_FS_BACKUP', DIR_FS_ADMIN . 'backups/');
  define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
  define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

  define('DB_SERVER', 'xxx');
  define('DB_SERVER_USERNAME', 'xxx');
  define('DB_SERVER_PASSWORD', 'xxx');
  define('DB_DATABASE', 'xxx');
  define('USE_PCONNECT', 'false');
  define('STORE_SESSIONS', 'mysql');
  define('CFG_TIME_ZONE', 'Africa/Johannesburg');
?>

This will now allow you to connect to the replica database. One more Step to make.

Step4: Modify catalog/includes/application_top.php

In the test shop folder, you will need to make a modification to this file, otherwise it will throw an error for an undefined constant.

Towards the end of the file, find:

// add the products model/name to the breadcrumb trail
  if (isset($_GET['products_id'])) {
	if (PRODUCT_NAME_IN_BREADCRUMB == 'true') {
      $crumb_query = tep_db_query("select products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$_GET['products_id'] . "' and language_id = '" . (int)$languages_id . "'");
      if (tep_db_num_rows($crumb_query)) {
        $crumb = tep_db_fetch_array($crumb_query);
        $breadcrumb->add($crumb['products_name'], tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . $cPath . '&products_id=' . $_GET['products_id']));
     }		
	} else {	  
      $model_query = tep_db_query("select products_model from " . TABLE_PRODUCTS . " where products_id = '" . (int)$_GET['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=' . $_GET['products_id']));
      }
    }
  } 

And replace it with:

// add the products model to the breadcrumb trail
  if (isset($_GET['products_id'])) {
    $model_query = tep_db_query("select products_model from " . TABLE_PRODUCTS . " where products_id = '" . (int)$_GET['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=' . $_GET['products_id']));
    }
  }

Now you can connect to your replica database with all your products and customers, with updated code for php8 and a responsive design. You connect with the Admin credentials of your live shop. From here you will be able to see the amount of work further needed depending on the amount of modifications to your shop.

If were using SEO URLs, there will be no need to reinstall it. Those will be preserved after you update the new shop files with the SEO URLs code (incl .htaccess).

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...