holy shit

寺夺喜从天降

首页,列表页,错误页显示最新、推荐、物价控制设置

后台configuration-index listing设置显示及排序,配置项以SHOW_PRODUCT_INFO开头,值为数字,如SHOW_PRODUCT_INFO_MAIN_NEW_PRODUCTS,SHOW_PRODUCT_INFO_CATEGORY_NEW_PRODUCTS

/includes/classes/db/mysql/define_queries.php文件定义sql查询语句常量,输出相应模块。如
DEFINE('SQL_SHOW_PRODUCT_INFO_MAIN',"select configuration_key, configuration_value from " . TABLE_CONFIGURATION . " where configuration_key RLIKE 'SHOW_PRODUCT_INFO_MAIN' and configuration_value > 0 order by configuration_value");

模板里调用sql常量,输出相应模块
<?php
$show_display_category = $db->Execute(SQL_SHOW_PRODUCT_INFO_MAIN);
while (!$show_display_category->EOF) {
    if ($show_display_category->fields['configuration_key'] == 'SHOW_PRODUCT_INFO_MAIN_FEATURED_PRODUCTS') {
        // display the Featured Products Center Box
        require($template->get_template_dir('tpl_modules_featured_products.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_featured_products.php');
    }
    if ($show_display_category->fields['configuration_key'] == 'SHOW_PRODUCT_INFO_MAIN_SPECIALS_PRODUCTS') {
        //display the Special Products Center Box
        require($template->get_template_dir('tpl_modules_specials_default.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_specials_default.php');
    }
    if ($show_display_category->fields['configuration_key'] == 'SHOW_PRODUCT_INFO_MAIN_NEW_PRODUCTS') {
        //display the New Products Center Box
        require($template->get_template_dir('tpl_modules_whats_new.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_whats_new.php');
    } if ($show_display_category->fields['configuration_key'] == 'SHOW_PRODUCT_INFO_MAIN_UPCOMING') {
        // display the Upcoming Products Center Box
        include(DIR_WS_MODULES . zen_get_module_directory(FILENAME_UPCOMING_PRODUCTS)); }
        $show_display_category->MoveNext();
}
?>

posted @ 2011-08-20 18:27  潜水鱼  阅读(336)  评论(0编辑  收藏  举报

holy shit on foot