Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Open discussion on speeding up osCommerce


burt

Recommended Posts

I'm tryng to implement it in this way:

 

1 Copied phpfastcache folder in the "functions" directory.

 

2. In application_top.php

 

find:

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

 

Change to:

if (USE_CACHE == 'true') {
require_once DIR_WS_FUNCTIONS . '/phpfastcache/phpfastcache.php';
phpFastCache::setup("storage","files");
phpFastCache::setup("path", "/web/htdocs/www.mysite.biz/catalog/includes/work");
phpFastCache::setup($config);
include DIR_WS_FUNCTIONS . 'cache.php';
}

 

3. In /functions/cache.php find this function:

function tep_cache_categories_box($auto_expire = false, $refresh = false) {

 

and change the entire function to:

 

function tep_cache_categories_box($auto_expire = false, $refresh = false) {
global $cPath, $language;
$cache_output = '';
$cache_output = __c("files")->get('categories_box-' . $language . '.cache'. $cPath);
if (($refresh == true) || ( $cache_output == null)) {
 if (!class_exists('bm_categories')) {
 include(DIR_WS_MODULES . 'boxes/bm_categories.php');
 }
 $bm_categories = new bm_categories();
 $cache_output = $bm_categories->getData();
__c("files")->set('categories_box-' . $language . '.cache'. $cPath, $cache_output, 3600); //cache in milliseconds default 1 hour
}
return $cache_output;
}

 

This is only one example for the category box cached files in a folder, but can be implemented for other modules.

 

Another thing that can improve speed in oscommerce could be the spl_autoload_register function: http://www.php.net/manual/en/function.spl-autoload-register.php to fast load classes. But i'm unable to find the right way to recode this. Anoyone can help me?

Link to comment
Share on other sites

  • Replies 76
  • Created
  • Last Reply

Ok, maybe i've found the way for spl_autoload

 

In application_top.php before

require DIR_WS_FUNCTIONS . 'sessions.php';

 

I've put the following code

function autoload() {
 require_once DIR_WS_CLASSES . 'shopping_cart.php';
require_once DIR_WS_CLASSES . 'navigation_history.php';
require_once DIR_WS_CLASSES . 'osc_template.php';
require_once DIR_WS_CLASSES . 'split_page_results.php';
require_once DIR_WS_CLASSES . 'boxes.php';
}
spl_autoload_register('autoload');

 

and deleted all the duplicate require classes entries in this file. Performance seems a little better on my system, but i'm not sure if this is a bulletproof method. Anoyne can help?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...