PDA

View Full Version : Categories Accordion Box



michael_s
11-03-2011, 05:54 PM
Whoops, Sorry!! I forgot to add the ability to reset the cache block too!!! (Within admin/tools/cache control)

First off, please make sure your cache works properly, IE* folder permissions are set correctly
and the path is set under configuration > cache:

It should like like this and be chmod to 755 etc:

/path-to-your-includes-work-directory-etc/includes/work

I have simply modified the includes/modules/boxes/bm_categories_accordion.php and includes/functions/cache.php.

The problem was if cache was enabled it would have a display issue and display the older categories menu due to missing code.

NEW INSTALL? = Follow instructions to install in the PDF document attached and then modify your cache related files as below:

ALREADY INSTALLED THE PREVIOUS CONTRIBUTION? = To upgrade and enable cached support, simply upload the
new includes/modules/boxes/bm_categories_accordion.php overwriting your previous one and then modify your cache files as below:

STEP 1: OPEN INCLUDES/FUNCTIONS/CACHE.PHP AND FIND:

////
//! Cache the categories box
// Cache the categories box
function tep_cache_categories_box($auto_expire = false, $refresh = false) {
global $cPath, $language;

$cache_output = '';

if (($refresh == true) || !read_cache($cache_output, 'categories_box-' . $language . '.cache' . $cPath, $auto_expire)) {
if (!class_exists('bm_categories')) {
include(DIR_WS_MODULES . 'boxes/bm_categories.php');
}

$bm_categories = new bm_categories();
$cache_output = $bm_categories->getData();

write_cache($cache_output, 'categories_box-' . $language . '.cache' . $cPath);
}

return $cache_output;
}

////


ADD AFTER:

//! Cache the categories accordion box
// Cache the categories accordion box
function tep_cache_categories_box2($auto_expire = false, $refresh = false) {
global $cPath, $language;

$cache_output = '';

if (($refresh == true) || !read_cache($cache_output, 'categories_box2-' . $language . '.cache' . $cPath, $auto_expire)) {
if (!class_exists('bm_categories_accordion')) {
include(DIR_WS_MODULES . 'boxes/bm_categories_accordion.php');
}

$bm_categories_accordion = new bm_categories_accordion();
$cache_output = $bm_categories_accordion->getData();

write_cache($cache_output, 'categories_box2-' . $language . '.cache' . $cPath);
}

return $cache_output;
}



STEP 2. Open admin/languages/english.php and Find:

define('TEXT_CACHE_CATEGORIES', 'Categories Box');

Add Below:

define('TEXT_CACHE_CATEGORIES_ACCORDION', 'Categories Accordion Box');


STEP 3. Open admin/includes/application_top.php and FIND:

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

ADD BELOW:

array('title' => TEXT_CACHE_CATEGORIES_ACCORDION, 'code' => 'categories_accordion', 'file' => 'categories_box2-language.cache', 'multiple' => true),

Full fixed Package Included.

More... (http://addons.oscommerce.com/info/7847)