function get_street_stores($cate_id = 0, $page = 1, $size = 15) { if ($cate_id) { $sql = "select id from " . $GLOBALS['ecs']->table('store_category') . " where id='{$cate_id}'"; $cate_id = $GLOBALS['db']->getOne($sql); if ($cate_id) { $where = " and sh.street_cate='{$cate_id}' "; } } /* 获得符合条件的店铺总数 */ $sql = "select count(sh.id) from " . $GLOBALS['ecs']->table('seller_shopinfo') . " as sh left join " . $GLOBALS['ecs']->table('store_category') . " as c on sh.street_cate=c.id left join " . $GLOBALS['ecs']->table('street_tags') . " as st on sh.street_tags=st.id where sh.status=1 and sh.apply=1 and sh.is_street=1 and c.is_show=1 " . $where; $count = $GLOBALS['db']->getOne($sql); $max_page = $count > 0 ? ceil($count / $size) : 1; if ($page > $max_page) { $page = $max_page; } $sql = "select sh.id,sh.shop_name,sh.street_logo,sh.street_spjpg,sh.shop_title,st.tag_name from " . $GLOBALS['ecs']->table('seller_shopinfo') . " as sh left join " . $GLOBALS['ecs']->table('store_category') . " as c on sh.street_cate=c.id left join " . $GLOBALS['ecs']->table('street_tags') . " as st on sh.street_tags=st.id where sh.status=1 and sh.apply=1 and sh.is_street=1 and c.is_show=1 " . $where . " order by sh.street_order desc"; $res = $GLOBALS['db']->SelectLimit($sql, $size, ($page - 1) * $size); $arr = array(); while ($row = $GLOBALS['db']->FetchRow($res)) { $arr[$row['id']]['id'] = $row['id']; $arr[$row['id']]['shop_name'] = $row['shop_name']; $arr[$row['id']]['street_logo'] = str_replace('../', './', $row['street_logo']); $arr[$row['id']]['street_spjpg'] = str_replace('../', './', $row['street_spjpg']); $arr[$row['id']]['shop_title'] = $row['shop_title']; $arr[$row['id']]['tag_name'] = $row['tag_name']; } $pager['search'] = array('cat' => $cate_id); $pager = get_pager('store_street.php', $pager['search'], $count, $page, $size); $street_stores = array('pager' => $pager, 'result' => $arr); return $street_stores; }
function action_list() { $smarty = $GLOBALS['smarty']; /* 取得预售活动总数 */ $count = pre_sale_count(); if ($count > 0) { /* 取得每页记录数 */ $size = isset($_CFG['page_size']) && intval($_CFG['page_size']) > 0 ? intval($_CFG['page_size']) : 12; /* 计算总页数 */ $page_count = ceil($count / $size); /* 取得当前页 */ $page = isset($_REQUEST['page']) && intval($_REQUEST['page']) > 0 ? intval($_REQUEST['page']) : 1; $page = $page > $page_count ? $page_count : $page; /* 缓存id:语言 - 每页记录数 - 当前页 */ $cache_id = $_CFG['lang'] . '-' . $size . '-' . $page; $cache_id = sprintf('%X', crc32($cache_id)); } else { /* 缓存id:语言 */ $cache_id = $_CFG['lang']; $cache_id = sprintf('%X', crc32($cache_id)); } assign_template(); /* 如果没有缓存,生成缓存 */ if (!$smarty->is_cached('pre_sale_list.dwt', $cache_id) || true) { if ($count > 0) { /* 取得当前页的预售活动 */ $ps_list = pre_sale_list($size, $page); $smarty->assign('ps_list', $ps_list); /* 设置分页链接 */ $pager = get_pager('pre_sale.php', array('act' => 'list'), $count, $page, $size); $smarty->assign('pager', $pager); } /* 模板赋值 */ $smarty->assign('cfg', $_CFG); assign_template(); $position = assign_ur_here(); $smarty->assign('page_title', $position['title']); // 页面标题 $smarty->assign('ur_here', $position['ur_here']); // 当前位置 $smarty->assign('categories', get_categories_tree()); // 分类树 $smarty->assign('helps', get_shop_help()); // 网店帮助 $smarty->assign('top_goods', get_top10()); // 销售排行 $smarty->assign('promotion_info', get_promotion_info()); $smarty->assign('feed_url', $_CFG['rewrite'] == 1 ? "feed-typepre_sale.xml" : 'feed.php?type=pre_sale'); // RSS // URL assign_dynamic('pre_sale_list'); } /* 显示模板 */ $smarty->display('pre_sale_list.dwt', $cache_id); }
function myinvite($page = NULL) { check_login(); $page = intval($page) < 1 ? 1 : intval($page); $limit = $this->config->item('per_page'); $start = ($page - 1) * $limit; $page_all = ceil($this->invite->get_user_invite_num() / $limit); $base = '/invite/myinvite'; $data['list'] = $this->invite->get_user_invite($start, $limit); $data['pager'] = get_pager($page, $page_all, $base); $this->view('myinvite', $data); }
function index($page = NULL) { check_admin(); $data = array(); $limit = 10; $page = intval($page) > 0 ? $page : 1; $start = ($page - 1) * $limit; $data['froms'] = $this->form->get_forms($start, $limit); $page_all = ceil(get_count() / $limit); $data['pager'] = get_pager($page, $page_all, '/design'); $this->view('index', $data); }
function index() { //$data = array(); $data['ci_top_title'] = '微件列表'; $args = func_get_args(); if (isset($args[2])) { $search = strip_tags(trim($args[2])); $search = urldecode($search); } else { $search = strip_tags(trim(v('search'))); } $data['search'] = $search; $type = intval(v('type')); if ($args) { $mid = intval($args[0]); } if (!isset($mid) || $mid == '') { $mid = $type; } // if ($mid == '0') { $where = " AND `name` LIKE '%" . $search . "%' "; //$data['name'] = '全部范围'; } elseif ($mid > '0') { $where = " AND `mid` = '" . intval($mid) . "' AND `name` LIKE '%" . $search . "%'"; $name = lazy_get_var("SELECT `name` FROM `u2_plugs` WHERE 1 AND `id` = '" . intval($mid) . "'"); if (!$name) { info_page('错误的组件ID'); } } else { info_page('错误的组件ID'); } $data['mid'] = $mid; $data['plugs_name'] = lazy_get_data("SELECT * FROM `u2_plugs`"); $data['page'] = $page = !isset($args[1]) || intval($args[1]) < 1 ? 1 : intval($args[1]); $limit = 5; $start = ($page - 1) * $limit; $item = lazy_get_data("SELECT sql_calc_found_rows * FROM `u2_plugs_widget` WHERE 1 {$where} ORDER BY `id` DESC LIMIT {$start},{$limit}"); $all = get_count(); $data['item'] = $item; //$type = urlencode( $type ); $base = '/plugs/index/' . $mid; $page_all = ceil($all / $limit); $text = urlencode($search); $data['pager'] = get_pager($page, $page_all, $base, $text); $data['is_admin'] = is_admin() ? true : false; $domain = _sess('domain'); if ($domain != '') { $data['domain'] = $domain; } $this->view('list', $data); }
function action_my_comment() { $user = $GLOBALS['user']; $_CFG = $GLOBALS['_CFG']; $_LANG = $GLOBALS['_LANG']; $smarty = $GLOBALS['smarty']; $db = $GLOBALS['db']; $ecs = $GLOBALS['ecs']; $user_id = $_SESSION['user_id']; $min_time = gmtime() - 86400 * $_CFG['comment_youxiaoqi']; $page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1; $count = $db->getOne("SELECT COUNT(*) FROM " . $ecs->table('order_goods') . " AS og \r\n\t\t\t\t\t\t LEFT JOIN " . $ecs->table('order_info') . " AS o ON og.order_id=o.order_id\r\n\t\t\t\t\t\t WHERE o.user_id = '{$user_id}' AND o.shipping_time_end > 0 AND og.is_back = 0"); $size = 20; $page_count = $count > 0 ? intval(ceil($count / $size)) : 1; // 代码添加$o_id,if判断 $o_id = $_REQUEST['order_id']; if ($o_id) { $sql = "SELECT og.*, o.add_time, o.shipping_time_end, o.order_id, g.goods_thumb, s.shaidan_id, s.pay_points AS shaidan_points, s.status AS shaidan_status,\r\n\t\t\tc.status AS comment_status,g.supplier_id,ifnull(ssc.value,'网站自营') AS shopname\r\n\t\t\tFROM " . $ecs->table('order_goods') . " AS og\r\n\t\t\tLEFT JOIN " . $ecs->table('order_info') . " AS o ON og.order_id=o.order_id\r\n\t\t\tLEFT JOIN " . $ecs->table('goods') . " AS g ON og.goods_id=g.goods_id\r\n\t\t\tLEFT JOIN " . $ecs->table('shaidan') . " AS s ON og.rec_id=s.rec_id\r\n\t\t\tLEFT JOIN " . $ecs->table('comment') . " AS c ON og.rec_id=c.rec_id\r\n\t\t\tLEFT JOIN " . $ecs->table('supplier_shop_config') . " AS ssc ON ssc.supplier_id=g.supplier_id AND ssc.code='shop_name'\r\n\t\t\tWHERE o.user_id = '{$user_id}' AND og.order_id = '{$o_id}' AND o.shipping_time_end > 0 AND og.is_back = 0 ORDER BY o.add_time DESC"; } else { $sql = "SELECT og.*, o.add_time, o.shipping_time_end, o.order_id, g.goods_thumb, s.shaidan_id, s.pay_points AS \tshaidan_points, s.status AS shaidan_status, \r\n\t\t\tc.status AS comment_status,g.supplier_id,ifnull(ssc.value,'网站自营') AS shopname \r\n\t\t\tFROM " . $ecs->table('order_goods') . " AS og \r\n\t\t\tLEFT JOIN " . $ecs->table('order_info') . " AS o ON og.order_id=o.order_id\r\n\t\t\tLEFT JOIN " . $ecs->table('goods') . " AS g ON og.goods_id=g.goods_id\r\n\t\t\tLEFT JOIN " . $ecs->table('shaidan') . " AS s ON og.rec_id=s.rec_id\r\n\t\t\tLEFT JOIN " . $ecs->table('comment') . " AS c ON og.rec_id=c.rec_id\r\n\t\t\tLEFT JOIN " . $ecs->table('supplier_shop_config') . " AS ssc ON ssc.supplier_id=g.supplier_id AND ssc.code='shop_name'\r\n\t\t\tWHERE o.user_id = '{$user_id}' AND o.shipping_time_end > 0 AND c.content > 0 AND og.is_back = 0 ORDER BY o.add_time DESC"; } $res = $db->selectLimit($sql, $size, ($page - 1) * $size); $points_list = array(); while ($row = $db->fetchRow($res)) { $row['thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true); $row['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']); $row['add_time_str'] = local_date("Y-m-d", $row['add_time']); $row['goods_tags'] = $db->getAll("SELECT * FROM " . $ecs->table('goods_tag') . " WHERE goods_id = '{$row['goods_id']}'"); $item_list[] = $row; } // 代码增加 for 循环 for ($i = 1; $i < count($item_list); $i++) { $item_list[$i]['o_id'] = $item_list[$i]['order_id']; unset($item_list[$i]['order_id']); } $smarty->assign('item_list', $item_list); // 统计信息 $num['x'] = $db->getOne("SELECT COUNT(*) AS num FROM " . $ecs->table('order_goods') . " AS og \r\n\t\t\t\t\t\t\tLEFT JOIN " . $ecs->table('order_info') . " AS o ON og.order_id=o.order_id\r\n\t\t\t\t\t\t\tWHERE o.user_id = '{$user_id}' AND og.is_back = 0 AND og.comment_state = 0 AND o.shipping_time_end > {$min_time}"); $num['y'] = $db->getOne("SELECT COUNT(*) AS num FROM " . $ecs->table('order_goods') . " AS og \r\n\t\t\t\t\t\t\tLEFT JOIN " . $ecs->table('order_info') . " AS o ON og.order_id=o.order_id\r\n\t\t\t\t\t\t\tWHERE o.user_id = '{$user_id}' AND og.is_back = 0 AND og.shaidan_state = 0 AND o.shipping_time_end > {$min_time}"); $smarty->assign('num', $num); $pager = get_pager('user.php', array('act' => $action), $count, $page, $size); $smarty->assign('min_time', $min_time); $smarty->assign('pager', $pager); $smarty->display('user_my_comment.dwt'); }
$smarty->assign('min_price', $min_price); $smarty->assign('max_price', $max_price); $smarty->assign('outstock', $_REQUEST['outstock']); /* 分页 */ $url_format = "search.php?category={$category}&keywords=" . urlencode(stripslashes($_REQUEST['keywords'])) . "&brand=" . $_REQUEST['brand'] . "&action=" . $action . "&goods_type=" . $_REQUEST['goods_type'] . "&sc_ds=" . $_REQUEST['sc_ds']; if (!empty($intromode)) { $url_format .= "&intro=" . $intromode; } if (isset($_REQUEST['pickout'])) { $url_format .= '&pickout=1'; } $url_format .= "&min_price=" . $_REQUEST['min_price'] . "&max_price=" . $_REQUEST['max_price'] . "&sort={$sort}"; $url_format .= "{$attr_url}&order={$order}&page="; $pager['search'] = array('keywords' => stripslashes(urlencode($_REQUEST['keywords'])), 'category' => $category, 'brand' => $_REQUEST['brand'], 'sort' => $sort, 'order' => $order, 'min_price' => $_REQUEST['min_price'], 'max_price' => $_REQUEST['max_price'], 'action' => $action, 'intro' => empty($intromode) ? '' : trim($intromode), 'goods_type' => $_REQUEST['goods_type'], 'sc_ds' => $_REQUEST['sc_ds'], 'outstock' => $_REQUEST['outstock']); $pager['search'] = array_merge($pager['search'], $attr_arg); $pager = get_pager('search.php', $pager['search'], $count, $page, $size); $pager['display'] = $display; $smarty->assign('url_format', $url_format); $smarty->assign('pager', $pager); assign_template(); assign_dynamic('search'); $position = assign_ur_here(0, $ur_here . ($_REQUEST['keywords'] ? '_' . $_REQUEST['keywords'] : '')); $smarty->assign('page_title', $position['title']); // 页面标题 $smarty->assign('ur_here', $position['ur_here']); // 当前位置 $smarty->assign('intromode', $intromode); $smarty->assign('categories', get_categories_tree()); // 分类树 $smarty->assign('helps', get_shop_help()); // 网店帮助
$where = " WHERE w.enabled = 1 AND CONCAT(',', w.rank_ids, ',') LIKE '" . '%,' . $_SESSION['user_rank'] . ',%' . "'"; /* 取得批发商品总数 */ $sql = "SELECT COUNT(*) FROM " . $ecs->table('wholesale') . " AS w " . $where; $count = $db->getOne($sql); if ($count > 0) { /* 取得每页记录数 */ $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); $pager = get_pager('wholesale.php', array('act' => 'list'), $count, $page, $size); $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']); // 当前位置 $smarty->assign('categories', get_categories_tree()); // 分类树 $smarty->assign('helps', get_shop_help()); // 网店帮助
$smarty->assign('categories', get_categories_tree()); // 分类树 $smarty->assign('top_goods', get_top10()); // 销售排行 $smarty->assign('cat_list', cat_list(0, 0, true, 2, false)); $smarty->assign('brand_list', get_brand_list()); $smarty->assign('promotion_info', get_promotion_info()); $smarty->assign('enabled_mes_captcha', intval($_CFG['captcha']) & CAPTCHA_MESSAGE); $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('comment') . " WHERE STATUS =1 AND comment_type =0 "; $record_count = $db->getOne($sql); $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('feedback') . " WHERE `msg_area`='1' AND `msg_status` = '1' "; $record_count += $db->getOne($sql); /* 获取留言的数量 */ $page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1; $pagesize = get_library_number('message_list', 'message_board'); $pager = get_pager('message.php', array(), $record_count, $page, $pagesize); $msg_lists = get_msg_list($pagesize, $pager['start']); assign_dynamic('message_board'); $smarty->assign('rand', mt_rand()); $smarty->assign('msg_lists', $msg_lists); $smarty->assign('pager', $pager); $smarty->display('message_board.dwt'); } /** * 获取留言的详细信息 * * @param integer $num * @param integer $start * * @return array */
include_once dirname(__FILE__) . '/function.php'; $data = array(); $tab_type = 'items'; $data['ci_top_title'] = '物品'; $data['tab_type'] = $tab_type; $data['tab_array'] = $tab_array; $page = array_shift($args); $page = intval($page) < 1 ? 1 : intval($page); $limit = '48'; $start = ($page - 1) * $limit; $uid = format_uid(); $items = lazy_get_data("select sql_calc_found_rows * from `global_user_items` where `uid` = '{$uid}' and `count` > 0 LIMIT {$start} , {$limit} "); $all = get_count(); $base = '/app/native/ihome/items'; $page_all = ceil($all / $limit); $data['pager'] = get_pager($page, $page_all, $base); $data['list'] = array(); if ($items) { foreach ($items as $v) { $iid[] = $v['iid']; $count[$v['iid']] = $v['count']; } $items_info = lazy_get_data("select * from `global_items` where `id` IN(" . join(',', $iid) . ") "); if ($items_info) { foreach ($items_info as $v) { $v['count'] = $count[$v['id']]; $data['list'][] = $v; } } } $data['baggage_count'] = count($data['list']);
function get_widget_pager($wid, $page, $page_all, $extra = NULL) { $pid = _Page('pid'); $base = 'JavaScript:ajax_widget_page( ' . intval($wid) . ' , ' . intval(_Page('cid')) . ' , ' . intval(_Page('pid')) . ', \''; $extra = $extra . "')"; return get_pager($page, $page_all, $base, $extra); }
public function goodsByBrandId () { $list = array(); if (!empty($_REQUEST['id'])) { $id = trim($_REQUEST['id']); $page = !empty($_REQUEST['page']) ? intval(trim($_REQUEST['page'])) : 1; $page_size = !empty($_REQUEST['page_size']) ? intval(trim($_REQUEST['page_size'])) : 10; $orderStr = !empty($_REQUEST['orderStr']) ? trim($_REQUEST['orderStr']) : "shop_price"; $orderVal = !empty($_REQUEST['orderVal']) ? trim($_REQUEST['orderVal']) : "0"; //正序 倒叙排列 if ($orderVal == "0") { $order = "asc"; } else if ($orderVal == "1") { $order = "desc"; } $sql_count = "SELECT count(*) FROM " . $GLOBALS['ecs']->table('goods') . " where brand_id = " . $id ; $record_count = $GLOBALS['db']->getOne($sql_count); $page_count = ($record_count > 0) ? intval(ceil($record_count / $page_size)) : 1; if($record_count>0) { $sql = "SELECT goods_id,goods_name,promote_start_date,promote_end_date,promote_price,market_price,shop_price,goods_brief,goods_thumb,is_best,is_hot,is_new FROM " . $GLOBALS['ecs']->table('goods') . " as g where g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 and g.brand_id = " . $id . " order by " . $orderStr . " $order "; $res = $GLOBALS['db']->selectLimit($sql, $page_size, ($page - 1) * $page_size); $index = 0; while($row =$GLOBALS['db']->fetchRow($res)) { /* 促销时间倒计时 */ $time = gmtime(); if ($time >= $row['promote_start_date'] && $time <= $row['promote_end_date']) { $row['gmt_end_time'] = $row['promote_end_date']; } else { $row['gmt_end_time'] = 0; } $arr[$index] = $row; $arr[$index]['format_market_price'] = price_format($row['market_price']); $arr[$index]['format_shop_price'] = price_format($row['shop_price']); $arr[$index]['format_promote_price'] = price_format($row['promote_price']); $index++; } $pager = get_pager('goods_list.php', array('act' => "goodsByBrandId"), $record_count, $page, $page_size); if(!empty($arr)) { $list['goods'] = $arr; $list['pager'] = $pager; } } } jsonExit($list); }
//$integral_records = get_all_integral_records($user_id); //$smarty->assign('integral_records',$integral_records); $ctl = isset($_REQUEST['ctl']) ? $_REQUEST['ctl'] : '0'; $smarty->assign('ctl', $ctl); $integralCondition = array(); $integralCondition[] = array($user_id, ' 1 ', ' is_frozen=0 '); $integralCondition[] = array($user_id, 'type = 0', ' is_frozen=0 '); $integralCondition[] = array($user_id, 'type = 1', ' is_frozen=0 '); $integralCondition[] = array($user_id, 'type = 5', ' is_frozen=0 '); $integralCondition[] = array($user_id, ' 1 ', ' is_frozen=1 '); $integral_records_list = array(); $all_pages = array(); for ($i = 0; $i < 5; $i++) { $page = isset($_REQUEST["page{$i}"]) ? intval($_REQUEST["page{$i}"]) : 0; $record_count = get_integral_records_count($integralCondition[$i][0], $integralCondition[$i][1], $integralCondition[$i][2]); $all_pages[$i] = get_pager('user.php', array('act' => $action), $record_count, $page, 10, "page{$i}=", "&ctl={$i}", '#tab'); $integral_records_list[$i] = get_integral_records($integralCondition[$i][0], $integralCondition[$i][1], $integralCondition[$i][2], $all_pages[$i]['size'], $all_pages[$i]['start']); } $smarty->assign('integral_records_list', $integral_records_list); $smarty->assign('all_pages', $all_pages); $smarty->assign('frozen_integral', get_frozen_integral($user_id)); $smarty->display('user_clips.dwt'); } elseif ($action == 'user_complain') { $order_id = $_REQUEST['order_id']; $type = $_REQUEST['type']; $content = $_REQUEST['content']; $captcha = $_REQUEST['captcha']; $now = gmtime(); include_once 'includes/cls_captcha.php'; $validator = new captcha($_SESSION['captcha_word']); if (!$validator->check_word($_POST['captcha'])) {
?> </div> </div> <?php } ?> </div> <?php } } else { echo "<div class=\"project-preview\">Ничего не найдено</div>"; } ?> </div> <?php print get_pager($pages, $page, "?p=list&fld={$folder}&page="); ?> <script><?php if ($pages <= $page || !$prj_count) { ?> function dprj(){}<?php } else { ?> var prjc=<?php echo $prj_count; ?> ;function dprj(){if(!(--prjc))window.location.href='?p=list&fld=<?php echo $folder; ?> &page=<?php echo $page;
function search($page = NULL, $searchtext = NULL) { $searchtext = urldecode($searchtext); $page = intval($page) < 1 ? 1 : intval($page); $start = intval(c('user_per_page')) * ($page - 1); $data['users'] = $this->user->get_users($start, $searchtext); $all = get_count(); $page_all = ceil($all / intval(c('user_per_page'))); $url_base = '/user/search'; $data['action'] = 'search'; $data['searchtext'] = $searchtext; $data['pager'] = get_pager($page, $page_all, $url_base, $searchtext); $this->view('ulist', $data); }
/** * 获取虚拟商品列表 * @param type $search * @return type */ function get_virtual_goods_list($search) { $page = !empty($_REQUEST['page']) && intval($_REQUEST['page']) > 0 ? intval($_REQUEST['page']) : 1; $size = !empty($_CFG['page_size']) && intval($_CFG['page_size']) > 0 ? intval($_CFG['page_size']) : 8; $sort = empty($_REQUEST['sort']) ? $search['list_default_sort'] : trim($_REQUEST['sort']); $order = empty($_REQUEST['order']) ? 'DESC' : trim($_REQUEST['order']); $cat_id = $search['cat_id']; $catch_id = $search['catch_id']; $city_id = $search['city_id']; $county_id = $search['county_id']; $district_id = $search['district_id']; $where = ''; $wherecat = ''; // if($cat_id != 0){ // $wherecat = " and cat_id = '$cat_id'"; // } // if($cat_id != 0 && $catch_id != 0){ // $wherecat = " and cat_id = '$catch_id'"; // } if ($cat_id != 0) { if ($catch_id != 0) { $wherecat = " and cat_id = '{$catch_id}'"; } else { $sql = "select distinct cat_id from " . $GLOBALS['ecs']->table("category") . " where parent_id={$cat_id}"; $cat_ids = $GLOBALS['db']->getCol($sql); if (empty($cat_ids)) { $cat_ids = array(0); } $wherecat = " and (cat_id = '{$cat_id}' or cat_id in (" . implode(',', $cat_ids) . "))"; } } if ($city_id != 0) { $where .= " and city = '{$city_id}'"; } if ($county_id != 0) { $where .= " and county= '{$county_id}'"; } if ($district_id != 0) { $where .= " and district_id = {$district_id}"; } $sql = "select distinct district_id from " . $GLOBALS['ecs']->table("virtual_goods_district") . " where 1 " . $where; $district_ids = $GLOBALS['db']->getAll($sql); $district_ids_array = array(); foreach ($district_ids as $k => $v) { $district_ids_array[] = $v['district_id']; } if (empty($district_ids_array)) { $district_ids_array = array(0); } $sql = "select goods_id from " . $GLOBALS['ecs']->table("virtual_district") . " where district_id in (" . implode(',', $district_ids_array) . ")"; $goods_ids = $GLOBALS['db']->getAll($sql); $goods_ids_array = array(); foreach ($goods_ids as $k => $v) { $goods_ids_array[] = $v['goods_id']; } if (empty($goods_ids_array)) { $goods_ids_array = array(0); } $sql = "select count(*) from " . $GLOBALS['ecs']->table("goods") . " where is_on_sale='1' and is_delete = '0' and is_real='0' and extension_code = 'virtual_good' " . $wherecat . " and goods_id in (" . implode(',', $goods_ids_array) . ")"; $count = $GLOBALS['db']->getOne($sql); $max_page = $count > 0 ? ceil($count / $size) : 1; if ($page > $max_page) { $page = $max_page; } //$sql = "select * from ".$GLOBALS['ecs']->table("goods")." where is_delete = '0' and is_real='0' and extension_code = 'virtual_good' ".$wherecat." and goods_id in (".implode(',',$goods_ids_array).") ORDER BY $sort $order"; $sql = "select g.goods_id,g.goods_name,g.goods_number,g.supplier_id,g.cat_id,g.add_time,g.valid_date,g.last_update,g.shop_price,g.goods_thumb,ifnull(salenum,0) as salenum from " . $GLOBALS['ecs']->table("goods") . " as g left join (select goods_id,order_id, count(*) as salenum from " . $GLOBALS['ecs']->table("order_goods") . " group by goods_id) as og on og.goods_id = g.goods_id \r\n left join (select order_id from " . $GLOBALS['ecs']->table("order_info") . " where order_status = '5') as oi on oi.order_id = og.order_id" . " where g.is_on_sale='1' and g.is_delete = '0' and g.is_real='0' and g.extension_code = 'virtual_good' " . $wherecat . " and g.goods_id in (" . implode(',', $goods_ids_array) . ") ORDER BY {$sort} {$order}"; $res = $GLOBALS['db']->selectLimit($sql, $size, ($page - 1) * $size); $virtual_goods = array(); while ($goods_list = $GLOBALS['db']->fetchRow($res)) { $sql = "select supplier_id,supplier_name from " . $GLOBALS['ecs']->table("supplier") . " where supplier_id = " . $goods_list['supplier_id']; $supplier = $GLOBALS['db']->getRow($sql); $goods_list['supplier_name'] = $supplier['supplier_name']; $goods_list['add_time'] = date("Y-m-d H:i:s", $goods_list['add_time']); $goods_list['last_update'] = date("Y-m-d H:i:s", $goods_list['last_update']); $goods_list['valid_date'] = date("Y-m-d H:i:s", $goods_list['valid_date']); $goods_list['count1'] = selled_count($goods_list['goods_id']); $virtual_goods[] = $goods_list; } $pager = get_pager('virtual_group.php', array('act' => 'list', 'show' => 'goods'), $count, $page, $size); $pager['sort'] = $sort; $pager['order'] = $order; return array('pager' => $pager, 'virtual_goods' => $virtual_goods); }
$rec_id = _POST('rec_id', 0); $add = ''; if ($rec_id) { $add = " AND rec_id < {$rec_id} "; } $record_count = $db->getOne("SELECT COUNT(*) FROM " . $ecs->table('collect_goods') . " WHERE user_id='{$user_id}' {$add}"); $smarty->assign('goods_list', GZ_get_collection_goods($user_id, $page['count'], $page['page'], $rec_id)); $smarty->assign('url', $ecs->url()); $smarty->assign('user_id', $user_id); $data = array(); foreach ($smarty->_var['goods_list'] as $key => $value) { $temp = API_DATA("SIMPLEGOODS", $value); $temp['rec_id'] = $value['rec_id']; $data[] = $temp; } $pager = get_pager('collection', array(), $record_count, $page['page'], $page['count']); GZ_Api::outPut($data, array("total" => $record_count, "count" => count($data), "more" => intval($pager['page_count'] > $pager['page']))); break; default: GZ_Api::outPut(101); break; } /** * 获取指定用户的收藏商品列表 * * @access public * @param int $user_id 用户ID * @param int $num 列表最大数量 * @param int $start 列表其实位置 * * @return array $arr
$smarty->assign('vote', $vote['content']); } $smarty->assign('best_goods', get_category_recommend_goods('best', $children, $brand, $price_min, $price_max, $ext)); $smarty->assign('promotion_goods', get_category_recommend_goods('promote', $children, $brand, $price_min, $price_max, $ext)); $smarty->assign('hot_goods', get_category_recommend_goods('hot', $children, $brand, $price_min, $price_max, $ext)); $count = get_cagtegory_goods_count($children, $brand, $price_min, $price_max, $ext); $max_page = $count > 0 ? ceil($count / $size) : 1; if ($page > $max_page) { $page = $max_page; } /*甜心100修改 分类页面为翻页模式*/ $page = !empty($_REQUEST['page']) && intval($_REQUEST['page']) > 0 ? intval($_REQUEST['page']) : 1; $size = !empty($_CFG['page_size']) && intval($_CFG['page_size']) > 0 ? intval($_CFG['page_size']) : 10; $goodslist = category_get_goods($children, $brand, $price_min, $price_max, $ext, $size, $page, $sort, $order); $pager['search'] = array("id" => $cat_id); $pager = get_pager('category.php', $pager['search'], $count, $page, $size); /*甜心100修改 分类页面为翻页模式*/ if ($display == 'grid') { if (count($goodslist) % 2 != 0) { $goodslist[] = array(); } } $smarty->assign('pager', $pager); $smarty->assign('goods_list', $goodslist); $smarty->assign('category', $cat_id); $smarty->assign('script_name', 'category'); } $smarty->display('category.dwt', $cache_id); /*------------------------------------------------------ */ //-- PRIVATE FUNCTION /*------------------------------------------------------ */
//shipped 待收货 //finished 历史订单 if (!in_array($type, array('await_pay', 'await_ship', 'shipped', 'finished', 'unconfirmed'))) { GZ_Api::outPut(101); } $record_count = $db->getOne("SELECT COUNT(*) FROM " . $ecs->table('order_info') . " WHERE user_id = '{$user_id}'" . GZ_order_query_sql($type)); // $order_all = $db->getAll("SELECT * FROM ".$ecs->table('order_info')." WHERE user_id='$user_id'"); // foreach ($order_all[0] as $key => $val) { // if ($order_all[0][$key] == $order_all[1][$key]) { // unset($order_all[0][$key]); // unset($order_all[1][$key]); // } // } // $sql = "SELECT COUNT(*) FROM " .$ecs->table('order_info'). " WHERE user_id = '$user_id'". GZ_order_query_sql($type); // print_r($sql);exit; $pager = get_pager('user.php', array('act' => $action), $record_count, $page, $page_parm['count']); $orders = GZ_get_user_orders($user_id, $pager['size'], $pager['start'], $type); // print_r($orders);exit; foreach ($orders as $key => $value) { unset($orders[$key]['order_status']); $orders[$key]['order_time'] = formatTime($value['order_time']); $goods_list = GZ_order_goods($value['order_id']); //$orders[$key]['ss'] = $goods_list; $goods_list_t = array(); // $goods_list = API_DATA("SIMPLEGOODS", $goods_list); foreach ($goods_list as $v) { $goods_list_t[] = array("goods_id" => $v['goods_id'], "name" => $v['goods_name'], "goods_number" => $v['goods_number'], "subtotal" => price_format($v['subtotal'], false), "formated_shop_price" => price_format($v['goods_price'], false), "img" => array('small' => API_DATA('PHOTO', $v['goods_thumb']), 'thumb' => API_DATA('PHOTO', $v['goods_img']), 'url' => API_DATA('PHOTO', $v['original_img']))); } $orders[$key]['goods_list'] = $goods_list_t; $order_detail = get_order_detail($value['order_id'], $user_id); $orders[$key]['formated_integral_money'] = $order_detail['formated_integral_money'];
* $Author: liubo $ * $Id: user.php 16643 2009-09-08 07:02:13Z liubo $ */ session_start(); define('IN_ECS', true); require dirname(__FILE__) . '/includes/init.php'; /* 载入语言文件 */ require_once ROOT_PATH . 'languages/' . $_CFG['lang'] . '/user.php'; if ($_SESSION['user_id'] > 0) { $smarty->assign('user_name', $_SESSION['user_name']); } include_once ROOT_PATH . 'includes/lib_clips.php'; $page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1; $user_id = $_SESSION['user_id']; $record_count = $db->getOne("SELECT COUNT(*) FROM " . $ecs->table('collect_goods') . " WHERE user_id='{$user_id}' ORDER BY add_time DESC"); $pager = get_pager('favorites.php', array(), $record_count, $page); $smarty->assign('pager', $pager); $smarty->assign('goods_list', get_collection_goods($user_id, $pager['size'], $pager['start'])); $username = isset($_POST['username']) ? trim($_POST['username']) : ''; $smarty->assign('shop_name', $GLOBALS['_CFG']['shop_name']); $smarty->assign('shop_address', $GLOBALS['_CFG']['shop_address']); $smarty->assign('qq', $GLOBALS['_CFG']['qq']); $smarty->assign('ww', $GLOBALS['_CFG']['ww']); $smarty->assign('skype', $GLOBALS['_CFG']['skype']); $smarty->assign('ym', $GLOBALS['_CFG']['ym']); $smarty->assign('msn', $GLOBALS['_CFG']['msn']); $smarty->assign('service_email', $GLOBALS['_CFG']['service_email']); $smarty->assign('service_phone', $GLOBALS['_CFG']['service_phone']); $act = isset($_GET['act']) ? $_GET['act'] : ''; /* 用户中心 */ if ($_SESSION['user_id'] > 0) {
public function message_list () { global $ecs,$db; checkLogin(); include_once('includes/lib_clips.php'); $user_id = intval($_SESSION['user_id']); $page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1; $sql = "SELECT COUNT(*) FROM " .$ecs->table('feedback')." WHERE parent_id = 0 AND user_id = '$user_id' AND order_id=0"; $record_count = $db->getOne($sql); $pager = get_pager('user.php',$_GET, $record_count, $page, 3); $message_list = zy_get_message_list($user_id,$pager['size'], $pager['start']); if(empty($message_list)) { $msg = rpcLang('user.php', 'no_message_list'); jsonExit("{\"status\":\"$msg\"}"); }else { $message_list_arr = array('pager'=>$pager,'messagelist'=>$message_list); jsonExit($message_list_arr); } }
$page = intval($page) < 1 ? 1 : intval($page); $start = ($page - 1) * $limit; $data['list'][] = lazy_get_line("SELECT * FROM `app_iforum_posts` WHERE id = '{$id}' AND `is_active` = 1 AND `parent_id` = '0' LIMIT 1"); if (!$data['list']) { info_page('错误的文章id'); } $data['forum'] = lazy_get_line("SELECT * from `app_iforum_status` where `id` = '{$data['list'][0]['fid']}' and `is_active` = '1' limit 1"); if (!$data['forum']) { info_page('错误的论坛id'); } $data['ci_top_title'] = $data['list'][0]['title']; $extra = lazy_get_data("SELECT sql_calc_found_rows * FROM `app_iforum_posts` WHERE `is_active` = 1 AND `parent_id` ='{$id}' LIMIT {$start} , {$limit}"); if ($extra) { $data['list'] = array_merge($data['list'], $extra); } foreach ($data['list'] as $v) { $uids[$v['uid']] = $v['uid']; } $all = get_count(); $base = '/app/native/iforum/display/' . $id; $page_all = ceil($all / $limit); $data['pager'] = get_pager($page, $page_all, $base, $data['return_page']); $data['names'] = iforum_get_names($uids); lazy_run_sql("update `app_iforum_posts` set `hit` = `hit` + 1 WHERE id = '{$id}' AND `is_active` = 1 LIMIT 1"); $data['tab_type'] = 'display'; $data['tab_array'] = array('display' => '浏览文章'); $data['id'] = $id; $data['page'] = $page; $data['limit'] = $limit; $data['show_del'] = is_admin() ? 1 : ($data['list'][0]['uid'] == format_uid() ? 1 : 0); layout($data, 'default', 'app');
/* 缓存id:语言 - 每页记录数 - 当前页 */ $cache_id = $_CFG['lang'] . '-' . $size . '-' . $page; $cache_id = sprintf('%X', crc32($cache_id)); } else { /* 缓存id:语言 */ $cache_id = $_CFG['lang']; $cache_id = sprintf('%X', crc32($cache_id)); } /* 如果没有缓存,生成缓存 */ if (!$smarty->is_cached('auction_list.dwt', $cache_id)) { if ($count > 0) { /* 取得当前页的拍卖活动 */ $auction_list = auction_list($size, $page); $smarty->assign('auction_list', $auction_list); /* 设置分页链接 */ $pager = get_pager('auction.php', array('act' => 'list'), $count, $page, $size); $smarty->assign('pager', $pager); } /* 模板赋值 */ $smarty->assign('cfg', $_CFG); assign_template(); $position = assign_ur_here(); $smarty->assign('page_title', $position['title']); // 页面标题 $smarty->assign('ur_here', $position['ur_here']); // 当前位置 $smarty->assign('categories', get_categories_tree()); // 分类树 $smarty->assign('helps', get_shop_help()); // 网店帮助 $smarty->assign('top_goods', get_top10());
public function search () { /** * 参数描述: * @var id 分类id. * @var page 当前页. * @var brand 品牌id. * @var price_max 最高价格. * @var price_min 最低价格. * @var order 排序方式. @enum.<'ASC', 'DESC'> * @var sort 排序字段.@enum.<'goods_id', 'shop_price', 'last_update'> * @var filter_attr table goods_attr 中goods_attr_id使用"."连接。例如9.10.11 */ global $_CFG,$ecs,$db; $cat_id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; if (!$cat_id) { $result = rpcLang('category.php', 'goodslist_failure'); jsonExit("{\"status\":\"$result\"}"); } $cat = get_cat_info($cat_id); // 获得分类的相关信息 if (empty($cat)) { $result = rpcLang('category.php', 'search_cat_failure'); jsonExit("{\"status\":\"$result\"}"); } $page = isset($_REQUEST['page']) && intval($_REQUEST['page']) > 0 ? intval($_REQUEST['page']) : 1; // $size = isset($_CFG['page_size']) && intval($_CFG['page_size']) > 0 ? intval($_CFG['page_size']) : 1; $size = 10; //品牌筛选. $brand = isset($_REQUEST['brand']) && intval($_REQUEST['brand']) > 0 ? intval($_REQUEST['brand']) : 0; //价格区间 $price_max = isset($_REQUEST['price_max']) && intval($_REQUEST['price_max']) > 0 ? intval($_REQUEST['price_max']) : 0; $price_min = isset($_REQUEST['price_min']) && intval($_REQUEST['price_min']) > 0 ? intval($_REQUEST['price_min']) : 0; //属性筛选.格式1.2.3 / attr_id使用.分割 $filter_attr_str = isset($_REQUEST['filter_attr']) ? htmlspecialchars(trim($_REQUEST['filter_attr'])) : '0'; $filter_attr_str = urldecode($filter_attr_str); $filter_attr = empty($filter_attr_str) ? '' : explode('.', trim($filter_attr_str)); /* 排序、方式及类型 */ $default_sort_order_method = $_CFG['sort_order_method'] == '0' ? 'DESC' : 'ASC'; $default_sort_order_type = $_CFG['sort_order_type'] == '0' ? 'goods_id' : ($_CFG['sort_order_type'] == '1' ? 'shop_price' : 'last_update'); $sort = (isset($_REQUEST['sort']) && in_array(trim(strtolower($_REQUEST['sort'])), array('goods_id', 'shop_price', 'last_update'))) ? trim($_REQUEST['sort']) : $default_sort_order_type; $order = (isset($_REQUEST['order']) && in_array(trim(strtoupper($_REQUEST['order'])), array('ASC', 'DESC'))) ? trim($_REQUEST['order']) : $default_sort_order_method; $children = get_children($cat_id); //属性筛选 $ext = ''; if (!empty($filter_attr)) { $ext_sql = "SELECT DISTINCT(b.goods_id) FROM " . $ecs->table('goods_attr') . " AS a, " . $ecs->table('goods_attr') . " AS b " . "WHERE "; $ext_group_goods = array(); foreach ($filter_attr AS $k => $v)// 查出符合所有筛选属性条件的商品id */ { if (!is_numeric($v) || $v == 0) continue; $sql = $ext_sql . "b.attr_value = a.attr_value AND a.goods_attr_id = " . $v; $ext_group_goods = $db->getColCached($sql); $ext .= ' AND ' . db_create_in($ext_group_goods, 'g.goods_id'); } } $count = get_cagtegory_goods_count($children, $brand, $price_min, $price_max, $ext); $max_page = ($count> 0) ? ceil($count / $size) : 1; if ($page > $max_page) $page = $max_page; $goodslist = category_get_goods($children, $brand, $price_min, $price_max, $ext, $size, $page, $sort, $order); if (!$goodslist) { $goodslist = rpcLang('category.php', 'goodslist_empty'); } $goodslist = array_values($goodslist); $pager = get_pager('category.php', $_GET, $count, $page, $size); //print_r(array('goods_list'=>$goodslist, 'pager'=>$pager));exit; jsonExit(array('goods_list'=>$goodslist, 'pager'=>$pager)); }
$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']); // 当前位置 $smarty->assign('categories', get_categories_tree()); // 分类树 $smarty->assign('helps', get_shop_help());
$smarty->assign('ur_here', "获奖名单"); // 当前位置 $smarty->assign('winlist', getwinlist($size, $page)); $smarty->display('lottery_winlist.dwt'); } elseif ($_REQUEST['act'] == 'fetch_rewards') { $page = empty($_REQUEST['page']) ? 1 : intval($_REQUEST['page']); $size = 10; $record_count = intval(gettotallu()); $page_count = $record_count > 0 ? intval(ceil($record_count / $size)) : 1; if ($page < 1) { $page = 1; } if ($page > $page_count) { $page = $page_count; } $pager = get_pager('lottery.php', array('act' => 'view'), $record_count, $page, $size); $smarty->assign('pager', $pager); assign_template(); $smarty->assign('page_title', "ec抽奖网-抽奖总动员-免费大奖等你拿"); // 页面标题 $smarty->assign('ur_here', "提交获奖感言"); // 当前位置 $smarty->assign('winlist', getwinlist($size, $page)); $id = empty($_REQUEST['id']) ? 0 : intval($_REQUEST['id']); if ($id > 0) { $user_id = $_SESSION['user_id']; $sql = "select * from " . $GLOBALS['ecs']->table('lottery_user') . " where id='{$id}' and user_id='{$user_id}' and applystatus=0"; $row = $GLOBALS['db']->getRow($sql); if ($row) { $sql = "select lu.*,l.shop_price,l.goods_id,(select goods_name from " . $GLOBALS['ecs']->table('goods') . " as g where g.goods_id=l.goods_id) as goods_name " . ",(select goods_thumb from " . $GLOBALS['ecs']->table('goods') . " as g where g.goods_id=l.goods_id) as goods_thumb " . ",(select user_name from " . $GLOBALS['ecs']->table('users') . " as u where u.user_id=lu.user_id) as user_name " . " from " . $GLOBALS['ecs']->table('lottery_user') . "as lu left join " . $GLOBALS['ecs']->table('lottery') . " as l on l.id=lu.lid where lu.id='{$id}' limit 1"; $row = $GLOBALS['db']->getRow($sql);
/* 缓存id:语言 */ $cache_id = $_CFG['lang']; $cache_id = sprintf('%X', crc32($cache_id)); } /* 如果没有缓存,生成缓存 */ if (!$smarty->is_cached('group_buy_list.dwt', $cache_id)) { if ($count > 0) { /* 取得当前页的团购活动 */ $gb_list = group_buy_list($size, $page); $smarty->assign('gb_list', $gb_list); /* 设置分页链接 */ $pager = get_pager('group_buy.php', array('act' => 'list'), $count, $page, $size); $smarty->assign('pager', $pager); } /* 模板赋值 */ $smarty->assign('cfg', $_CFG); assign_template(); $position = assign_ur_here(); $smarty->assign('page_title', $position['title']); // 页面标题 $smarty->assign('ur_here', $position['ur_here']); // 当前位置 $smarty->assign('categories', get_categories_tree()); // 分类树 $smarty->assign('helps', get_shop_help()); // 网店帮助 $smarty->assign('top_goods', get_top10()); // 销售排行 $smarty->assign('promotion_info', get_promotion_info()); $smarty->assign('feed_url', ($_CFG['rewrite'] == 1) ? "feed-typegroup_buy.xml" : 'feed.php?type=group_buy'); // RSS URL
function action_tg_order() { $user = $GLOBALS['user']; $_CFG = $GLOBALS['_CFG']; $_LANG = $GLOBALS['_LANG']; $smarty = $GLOBALS['smarty']; $db = $GLOBALS['db']; $ecs = $GLOBALS['ecs']; $user_id = $GLOBALS['user_id']; $page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1; $record_count = $db->getOne("SELECT COUNT(*) FROM " . $ecs->table('takegoods_order') . " WHERE user_id = '{$user_id}'"); $pager = get_pager('user.php', array('act' => $action), $record_count, $page, 10); $orders = get_takegoods_orders($user_id, $pager['size'], $pager['start']); $smarty->assign('pager', $pager); $smarty->assign('orders', $orders); $smarty->display('user_transaction.dwt'); }
$res = $db->query($sql); $record_count = 0; while ($item = $db->fetch_array($res)) { $shipping = get_shipping_object($item['shipping_id']); if (method_exists($shipping, 'query')) { $query_link = $shipping->query($item['invoice_no']); } else { $query_link = $item['invoice_no']; } if ($query_link != $item['invoice_no']) { $item['query_link'] = $query_link; $orders[] = $item; $record_count += 1; } } $pager = get_pager('user.php', array('act' => $action), $record_count, $page); $smarty->assign('pager', $pager); $smarty->assign('orders', $orders); $smarty->display('user_transaction.dwt'); } else { if ($action == 'order_query') { $_GET['order_sn'] = trim(substr($_GET['order_sn'], 1)); $order_sn = empty($_GET['order_sn']) ? '' : addslashes($_GET['order_sn']); include_once ROOT_PATH . 'includes/cls_json.php'; $json = new JSON(); $result = array('error' => 0, 'message' => '', 'content' => ''); if (isset($_SESSION['last_order_query'])) { if (time() - $_SESSION['last_order_query'] <= 10) { $result['error'] = 1; $result['message'] = $_LANG['order_query_toofast']; die($json->encode($result));
$res = $db->query($sql); $record_count = 0; while ($item = $db->fetch_array($res)) { $shipping = get_shipping_object($item['shipping_id']); if (method_exists($shipping, 'query')) { $query_link = $shipping->query($item['invoice_no']); } else { $query_link = $item['invoice_no']; } if ($query_link != $item['invoice_no']) { $item['query_link'] = $query_link; $orders[] = $item; $record_count += 1; } } $pager = get_pager($user_link, array('act' => $action), $record_count, $page); $smarty->assign('pager', $pager); $smarty->assign('orders', $orders); $smarty->display('user_transaction.dwt'); } else { if ($action == 'order_query') { $_GET['order_sn'] = trim(substr($_GET['order_sn'], 1)); $order_sn = empty($_GET['order_sn']) ? '' : addslashes($_GET['order_sn']); include_once ROOT_PATH . 'includes/cls_json.php'; $json = new JSON(); $result = array('error' => 0, 'message' => '', 'content' => ''); if (isset($_SESSION['last_order_query'])) { if (time() - $_SESSION['last_order_query'] <= 10) { $result['error'] = 1; $result['message'] = $_LANG['order_query_toofast']; die($json->encode($result));