Display a specified infobox in CRE Loaded

February 20, 2007 by hejian

Display infobox in CRE Loaded is not as easy as osCommerce. I write a function to display a specified infobox in CRE Loaded:

function hej_infobox_display($infobox_file_name) {
global $languages_id;
$column_query = tep_db_query('select infobox_id, display_in_column as cfgcol, infobox_file_name as cfgtitle, infobox_display as cfgvalue, infobox_define as cfgkey, box_template, box_heading_font_color from ' . TABLE_INFOBOX_CONFIGURATION . ' where template_id = ' . TEMPLATE_ID . ' and infobox_file_name = "' . $infobox_file_name . '" order by location');
$column = tep_db_fetch_array($column_query);
if ( file_exists(DIR_FS_TEMPLATE_BOXES . '/boxes/' . $column['cfgtitle'])) {
$box_heading = tep_get_box_heading($column['infobox_id'], $languages_id);
define($column['cfgkey'], $box_heading);
//$infobox_define = $box_heading;
$infobox_template = $column['box_template'];
$font_color = $column['box_heading_font_color'];
$infobox_class = $column['box_template'];
//cache control side box detect
if ((USE_CACHE == ‘true’) && empty($SID) && ($column['cfgtitle'] == ‘categories1.php’) ) {
echo tep_cache_categories_box();
} else if ((USE_CACHE == ‘true’) && empty($SID) && ($column['cfgtitle'] == ‘categories.php’) ) {
echo tep_cache_categories_box();
} else if ((USE_CACHE == ‘true’) && empty($SID) && ($column['cfgtitle'] == ‘categories2.php’) ) {
echo tep_cache_categories_box1();
} else if ((USE_CACHE == ‘true’) && empty($SID) && ($column['cfgtitle'] == ‘categories3.php’) ) {
echo tep_cache_categories_box3();
} else if ((USE_CACHE == ‘true’) && empty($SID) && ($column['cfgtitle'] == ‘categories4.php’) ) {
echo tep_cache_categories_box4();
} else if ((USE_CACHE == ‘true’) && empty($SID) && ($column['cfgtitle'] == ‘categories5.php’) ) {
echo tep_cache_categories_box5();
} else if ((USE_CACHE == ‘true’) && empty($SID) && ($column['cfgtitle'] == ‘coolmenu.php’) ) {
echo tep_cache_coolmenu();
} else if ((USE_CACHE == ‘true’) && empty($SID) && ($column['cfgtitle'] == ‘manufacturers.php’) ) {
echo tep_cache_manufacturers_box();
} else {
require(DIR_FS_TEMPLATE_BOXES . ‘/’ . $column['cfgtitle']);
}
} else {
$box_heading = tep_get_box_heading($column['infobox_id'], $languages_id);
error_log (’side ‘ . $column['infobox_id'] . $box_heading . $languages_id);
define($column['cfgkey'],$box_heading);
//$infobox_define = $box_heading;
$infobox_template = $column['box_template'];
$font_color = $column['box_heading_font_color'];
$infobox_class = $column['box_template'];
require(DIR_FS_TEMPLATE_BOXES . ‘/’ . $column['cfgtitle']);
}
}

Use can use this function to display a specific infobox in header or footer.

Leave a Reply

You must be logged in to post a comment.

Wordpress template made by HeJian