Пример #1
0
    $smarty->assign('full_page', 1);
    $smarty->assign('ur_here', $_LANG['wholesale_list']);
    $smarty->assign('action_link', array('href' => 'wholesale.php?act=add', 'text' => $_LANG['add_wholesale']));
    $smarty->assign('action_link2', array('href' => 'wholesale.php?act=batch_add', 'text' => $_LANG['add_batch_wholesale']));
    $list = wholesale_list();
    $smarty->assign('wholesale_list', $list['item']);
    $smarty->assign('filter', $list['filter']);
    $smarty->assign('record_count', $list['record_count']);
    $smarty->assign('page_count', $list['page_count']);
    $sort_flag = sort_flag($list['filter']);
    $smarty->assign($sort_flag['tag'], $sort_flag['img']);
    /* 显示商品列表页面 */
    assign_query_info();
    $smarty->display('wholesale_list.htm');
} elseif ($_REQUEST['act'] == 'query') {
    $list = wholesale_list();
    $smarty->assign('wholesale_list', $list['item']);
    $smarty->assign('filter', $list['filter']);
    $smarty->assign('record_count', $list['record_count']);
    $smarty->assign('page_count', $list['page_count']);
    $sort_flag = sort_flag($list['filter']);
    $smarty->assign($sort_flag['tag'], $sort_flag['img']);
    make_json_result($smarty->fetch('wholesale_list.htm'), '', array('filter' => $list['filter'], 'page_count' => $list['page_count']));
} elseif ($_REQUEST['act'] == 'remove') {
    check_authz_json('whole_sale');
    $id = intval($_GET['id']);
    $wholesale = wholesale_info($id);
    if (empty($wholesale)) {
        make_json_error($_LANG['wholesale_not_exist']);
    }
    $name = $wholesale['goods_name'];
Пример #2
0
 $sql = "SELECT COUNT(*) FROM " . $ecs->table('wholesale') . " AS w, " . $ecs->table('goods') . " AS g " . $where;
 $count = $db->getOne($sql);
 if ($count > 0) {
     $default_display_type = $_CFG['show_order_type'] == '0' ? 'list' : 'text';
     $display = isset($_REQUEST['display']) && in_array(trim(strtolower($_REQUEST['display'])), array('list', 'text')) ? trim($_REQUEST['display']) : (isset($_COOKIE['ECS']['display']) ? $_COOKIE['ECS']['display'] : $default_display_type);
     $display = in_array($display, array('list', 'text')) ? $display : 'text';
     setcookie('ECS[display]', $display, gmtime() + 86400 * 7);
     /* 取得每页记录数 */
     $size = isset($_CFG['page_size']) && intval($_CFG['page_size']) > 0 ? intval($_CFG['page_size']) : 10;
     /* 计算总页数 */
     $page_count = ceil($count / $size);
     /* 取得当前页 */
     $page = isset($_REQUEST['page']) && intval($_REQUEST['page']) > 0 ? intval($_REQUEST['page']) : 1;
     $page = $page > $page_count ? $page_count : $page;
     /* 取得当前页的批发商品 */
     $wholesale_list = wholesale_list($size, $page, $where);
     $smarty->assign('wholesale_list', $wholesale_list);
     $param['act'] = 'list';
     $pager = get_pager('wholesale.php', array_reverse($param, TRUE), $count, $page, $size);
     $pager['display'] = $display;
     $smarty->assign('pager', $pager);
     /* 批发商品购物车 */
     $smarty->assign('cart_goods', isset($_SESSION['wholesale_goods']) ? $_SESSION['wholesale_goods'] : array());
 }
 /* 模板赋值 */
 assign_template();
 $position = assign_ur_here();
 $smarty->assign('page_title', $position['title']);
 // 页面标题
 $smarty->assign('ur_here', $position['ur_here']);
 // 当前位置