public function rsale() { $GLOBALS['tmpl']->assign("rtype", "rsale"); $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['SALE_LIST']); $GLOBALS['tmpl']->caching = true; $cache_id = md5(MODULE_NAME . ACTION_NAME . $GLOBALS['deal_city']['id']); if (!$GLOBALS['tmpl']->is_cached('rec_list.html', $cache_id)) { //输出商城分类 $cate_tree = get_cate_tree(); $GLOBALS['tmpl']->assign("cate_tree", $cate_tree); } $GLOBALS['tmpl']->display("rec_list.html", $cache_id); }
public function index() { $GLOBALS['tmpl']->caching = true; $cache_id = md5(MODULE_NAME . ACTION_NAME . trim($_REQUEST['id']) . $GLOBALS['deal_city']['id']); if (!$GLOBALS['tmpl']->is_cached('goods_list.html', $cache_id)) { $id = intval($_REQUEST['id']); if ($id == 0) { $uname = addslashes(trim($_REQUEST['id'])); } $cate_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_cate where id = " . $id . " or (uname = '" . $uname . "' and uname <> '')"); $GLOBALS['tmpl']->assign("cate_id", $cate_item['id']); //输出商城分类 $cate_tree = get_cate_tree($cate_item['id']); $GLOBALS['tmpl']->assign("cate_tree", $cate_tree); //开始输出当前的site_nav $cates = array(); $cate = $cate_item; do { $cates[] = $cate; $pid = intval($cate['pid']); $cate = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_cate where is_effect =1 and is_delete =0 and id = " . $pid); } while ($pid != 0); foreach ($cates as $cate_row) { $page_title .= $cate_row['name'] . " - "; $page_kd .= $cate_row['name'] . ","; } $page_title = substr($page_title, 0, -3); krsort($cates); $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => APP_ROOT . "/"); if ($cate_item) { foreach ($cates as $cate_row) { if ($cate_row['uname'] != "") { $curl = url("shop", "cate#index", array("id" => $cate_row['uname'])); } else { $curl = url("shop", "cate#index", array("id" => $cate_row['id'])); } $site_nav[] = array('name' => $cate_row['name'], 'url' => $curl); } } else { $site_nav[] = array('name' => $GLOBALS['lang']['GOODS_CATE'], 'url' => url("shop", "cate#index")); } $GLOBALS['tmpl']->assign("site_nav", $site_nav); //输出当前的site_nav $GLOBALS['tmpl']->assign("page_title", $page_title); $GLOBALS['tmpl']->assign("page_keyword", $page_kd); $GLOBALS['tmpl']->assign("page_description", $page_kd); } $GLOBALS['tmpl']->display("goods_list.html", $cache_id); }
public function index() { $preview = intval($_REQUEST['preview']); $id = intval($_REQUEST['id']); if ($preview > 0) { $goods = get_goods($id, $preview); if ($goods['buy_type'] == 0) { app_redirect(url("shop", "goods", array("id" => $goods['id'], "preview" => $preview))); } $adm_session = es_session::get(md5(app_conf("AUTH_KEY"))); $adm_name = $adm_session['adm_name']; $adm_id = intval($adm_session['adm_id']); if ($adm_id == 0) { //验证是否当前的商家(不是后台管理员) $s_account_info = es_session::get("account_info"); if ($s_account_info) { foreach ($s_account_info['location_ids'] as $id) { $location = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location where id = " . $id); if ($location) { $locations[] = $location; } } $deal_test = $GLOBALS['db']->getRow("select d.* from " . DB_PREFIX . "deal as d left join " . DB_PREFIX . "deal_location_link as l on l.deal_id = d.id where d.id = " . intval($goods['id']) . " and d.is_shop = 1 and d.publish_wait = 1 and l.location_id in (" . implode(",", $s_account_info['location_ids']) . ")"); if (!$deal_test) { showErr("产品不存在或者没有预览该产品的权限", 0, APP_ROOT . "/"); } } else { showErr("您不是系统管理员或者商家会员,无法预览", 0, APP_ROOT . "/"); } } } $GLOBALS['tmpl']->caching = true; $cache_id = md5(MODULE_NAME . ACTION_NAME . trim($_REQUEST['id']) . $GLOBALS['deal_city']['id']); if (!$GLOBALS['tmpl']->is_cached('score_info.html', $cache_id)) { //获取当前页的团购商品 $id = intval($_REQUEST['id']); $uname = addslashes(trim($_REQUEST['id'])); if ($id == 0 && $uname == '') { app_redirect(APP_ROOT . "/"); } elseif ($id == 0 && $uname != '') { $id = $GLOBALS['db']->getOne("select id from " . DB_PREFIX . "deal where uname = '" . $uname . "'"); } //获取当前页的团购商品 if ($preview > 0) { $goods = get_goods($id, $preview); } else { $goods = get_goods($id); } //输出商城分类 $cate_tree = get_cate_tree($goods['shop_cate_id']); $GLOBALS['tmpl']->assign("cate_id", $goods['shop_cate_id']); $GLOBALS['tmpl']->assign("cate_tree", $cate_tree); jump_deal($goods, MODULE_NAME); if (!$goods || $goods['buy_type'] != 1) { app_redirect(APP_ROOT . "/"); } $GLOBALS['tmpl']->assign("goods", $goods); //开始输出当前的site_nav $cates = array(); $cate = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "shop_cate where id = " . $goods['shop_cate_id']); do { $cates[] = $cate; $pid = intval($cate['pid']); $cate = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "shop_cate where is_effect =1 and is_delete =0 and id = " . $pid); } while ($pid != 0); $page_title = substr($page_title, 0, -3); krsort($cates); $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => APP_ROOT . "/"); if ($cates) { foreach ($cates as $cate_row) { if ($cate_row['uname'] != "") { $curl = url("shop", "score#index", array("id" => $cate_row['uname'])); } else { $curl = url("shop", "score#index", array("id" => $cate_row['id'])); } $site_nav[] = array('name' => $cate_row['name'], 'url' => $curl); } } if ($goods['uname'] != "") { $gurl = url("shop", "exchange#index", array("id" => $goods['uname'])); } else { $gurl = url("shop", "exchange#index", array("id" => $goods['id'])); } $site_nav[] = array('name' => $goods['name'], 'url' => $gurl); $GLOBALS['tmpl']->assign("site_nav", $site_nav); //输出当前的site_nav $seo_title = $goods['seo_title'] != '' ? $goods['seo_title'] : $goods['name']; $GLOBALS['tmpl']->assign("page_title", $seo_title); $seo_keyword = $goods['seo_keyword'] != '' ? $goods['seo_keyword'] : $goods['name']; $GLOBALS['tmpl']->assign("page_keyword", $seo_keyword . ","); $seo_description = $goods['seo_description'] != '' ? $goods['seo_description'] : $goods['name']; $GLOBALS['tmpl']->assign("page_description", $seo_description . ","); if (!$GLOBALS['user_info']) { $GLOBALS['tmpl']->assign("message_login_tip", sprintf($GLOBALS['lang']['MESSAGE_LOGIN_TIP'], url("shop", "user#login"), url("shop", "user#register"))); } } $GLOBALS['tmpl']->display("score_info.html", $cache_id); }
</td> <td class="bold" width="180"><?php echo __('show_cate_position'); ?> </td> <td align="center" class="bold"><?php echo __('file_num'); ?> </td> <td align="right" width="100" class="bold"><?php echo __('operation'); ?> </td> </tr> <?php echo get_cate_tree(); ?> <?php } else { ?> <tr> <td colspan="6" align="center"><?php echo __('category_not_found'); ?> </td> </tr> <?php } ?> <tr>
public function index() { $GLOBALS['tmpl']->caching = true; $cache_id = md5(MODULE_NAME . ACTION_NAME . trim($_REQUEST['id']) . $GLOBALS['deal_city']['id']); if (!$GLOBALS['tmpl']->is_cached('score_info.html', $cache_id)) { //获取当前页的团购商品 $id = intval($_REQUEST['id']); $uname = addslashes(trim($_REQUEST['id'])); if ($id == 0 && $uname == '') { app_redirect(APP_ROOT . "/"); } elseif ($id == 0 && $uname != '') { $id = $GLOBALS['db']->getOne("select id from " . DB_PREFIX . "deal where uname = '" . $uname . "'"); } //获取当前页的团购商品 $goods = get_goods($id); //输出商城分类 $cate_tree = get_cate_tree($goods['shop_cate_id']); $GLOBALS['tmpl']->assign("cate_id", $goods['shop_cate_id']); $GLOBALS['tmpl']->assign("cate_tree", $cate_tree); jump_deal($goods, MODULE_NAME); if (!$goods || $goods['buy_type'] != 1) { app_redirect(APP_ROOT . "/"); } $GLOBALS['tmpl']->assign("goods", $goods); //开始输出当前的site_nav $cates = array(); $cate = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "shop_cate where id = " . $goods['shop_cate_id']); do { $cates[] = $cate; $pid = intval($cate['pid']); $cate = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "shop_cate where is_effect =1 and is_delete =0 and id = " . $pid); } while ($pid != 0); $page_title = substr($page_title, 0, -3); krsort($cates); $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => APP_ROOT . "/"); if ($cates) { foreach ($cates as $cate_row) { if ($cate_row['uname'] != "") { $curl = url("shop", "score#index", array("id" => $cate_row['uname'])); } else { $curl = url("shop", "score#index", array("id" => $cate_row['id'])); } $site_nav[] = array('name' => $cate_row['name'], 'url' => $curl); } } if ($goods['uname'] != "") { $gurl = url("shop", "exchange#index", array("id" => $goods['uname'])); } else { $gurl = url("shop", "exchange#index", array("id" => $goods['id'])); } $site_nav[] = array('name' => $goods['name'], 'url' => $gurl); $GLOBALS['tmpl']->assign("site_nav", $site_nav); //输出当前的site_nav $seo_title = $goods['seo_title'] != '' ? $goods['seo_title'] : $goods['name']; $GLOBALS['tmpl']->assign("page_title", $seo_title); $seo_keyword = $goods['seo_keyword'] != '' ? $goods['seo_keyword'] : $goods['name']; $GLOBALS['tmpl']->assign("page_keyword", $seo_keyword . ","); $seo_description = $goods['seo_description'] != '' ? $goods['seo_description'] : $goods['name']; $GLOBALS['tmpl']->assign("page_description", $seo_description . ","); if (!$GLOBALS['user_info']) { $GLOBALS['tmpl']->assign("message_login_tip", sprintf($GLOBALS['lang']['MESSAGE_LOGIN_TIP'], url("shop", "user#login"), url("shop", "user#register"))); } } $GLOBALS['tmpl']->display("score_info.html", $cache_id); }
public function index() { $preview = intval($_REQUEST['preview']); $id = intval($_REQUEST['id']); if (isset($_GET['plat'])) { $plat = $_GET['plat']; } if ($preview > 0) { $goods = get_goods($id, $preview); if ($goods['buy_type'] == 1) { app_redirect(url("shop", "exchange", array("id" => $goods['id'], "preview" => $preview))); } $adm_session = es_session::get(md5(app_conf("AUTH_KEY"))); $adm_name = $adm_session['adm_name']; $adm_id = intval($adm_session['adm_id']); if ($adm_id == 0) { //验证是否当前的商家(不是后台管理员) $s_account_info = es_session::get("account_info"); if ($s_account_info) { foreach ($s_account_info['location_ids'] as $id) { $location = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location where id = " . $id); if ($location) { $locations[] = $location; } } $deal_test = $GLOBALS['db']->getRow("select d.* from " . DB_PREFIX . "deal as d left join " . DB_PREFIX . "deal_location_link as l on l.deal_id = d.id where d.id = " . intval($goods['id']) . " and d.is_shop = 1 and d.publish_wait = 1 and l.location_id in (" . implode(",", $s_account_info['location_ids']) . ")"); if (!$deal_test) { showErr("产品不存在或者没有预览该产品的权限", 0, APP_ROOT . "/"); } } else { showErr("您不是系统管理员或者商家会员,无法预览", 0, APP_ROOT . "/"); } } } $GLOBALS['tmpl']->caching = true; $cache_id = md5(MODULE_NAME . ACTION_NAME . trim($_REQUEST['id']) . $GLOBALS['deal_city']['id'] . $preview); $GLOBALS['tmpl']->is_cached('goods_info.html', $cache_id); if (!$GLOBALS['tmpl']->is_cached('goods_info.html', $cache_id) || $plat == APP_PLAT) { $id = intval($_REQUEST['id']); //获取当前页的团购商品 $uname = addslashes(trim($_REQUEST['id'])); if ($id == 0 && $uname == '') { app_redirect(url("shop", "index")); } elseif ($id == 0 && $uname != '') { $id = $GLOBALS['db']->getOne("select id from " . DB_PREFIX . "deal where uname = '" . $uname . "'"); } //获取当前页的团购商品 if ($preview > 0) { $goods = get_goods($id, $preview); } else { $goods = get_goods($id); } //输出促销 if ($goods['allow_promote'] == 1) { $promote = load_auto_cache("cache_promote"); $GLOBALS['tmpl']->assign("promote", $promote); } //输出商城分类 $cate_tree = get_cate_tree($goods['shop_cate_id']); $GLOBALS['tmpl']->assign("cate_id", $goods['shop_cate_id']); $GLOBALS['tmpl']->assign("cate_tree", $cate_tree); if (!$goods || $goods['buy_type'] == 1) { app_redirect(url("shop", "mall")); } /** if($plat == APP_PLAT){ echo json_encode($goods);exit; } */ //判断is_shop自动跳转 jump_deal($goods, MODULE_NAME); //输出规格库存的配置 $attr_stock = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "attr_stock where deal_id = " . $goods['id'] . " order by id asc"); $attr_cfg_json = "{"; $attr_stock_json = "{"; foreach ($attr_stock as $k => $v) { $attr_cfg_json .= $k . ":" . "{"; $attr_stock_json .= $k . ":" . "{"; foreach ($v as $key => $vvv) { if ($key != 'attr_cfg') { $attr_stock_json .= "\"" . $key . "\":" . "\"" . $vvv . "\","; } } $attr_stock_json = substr($attr_stock_json, 0, -1); $attr_stock_json .= "},"; $attr_cfg_data = unserialize($v['attr_cfg']); foreach ($attr_cfg_data as $attr_id => $vv) { $attr_cfg_json .= $attr_id . ":" . "\"" . $vv . "\","; } $attr_cfg_json = substr($attr_cfg_json, 0, -1); $attr_cfg_json .= "},"; } if ($attr_stock) { $attr_cfg_json = substr($attr_cfg_json, 0, -1); $attr_stock_json = substr($attr_stock_json, 0, -1); } $attr_cfg_json .= "}"; $attr_stock_json .= "}"; $GLOBALS['tmpl']->assign("attr_cfg_json", $attr_cfg_json); $GLOBALS['tmpl']->assign("attr_stock_json", $attr_stock_json); // if($plat == APP_PLAT){ // if($goods['brand_id']>0){ // $goods['brand_name']=$GLOBALS['db']->getOne('select name from '.DB_PREFIX.'brand where id ='.$goods['brand_id']); // }else{ // $goods['brand_name'] =""; // } // array_recursive($goods, 'strval'); // echo json_encode($goods); // exit; // } // $GLOBALS['tmpl']->assign("goods", $goods); //开始输出当前的site_nav $cates = array(); $cate = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "shop_cate where id = " . $goods['shop_cate_id']); do { $cates[] = $cate; $pid = intval($cate['pid']); $cate = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "shop_cate where is_effect =1 and is_delete =0 and id = " . $pid); } while ($pid != 0); $page_title = substr($page_title, 0, -3); krsort($cates); $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => APP_ROOT . "/"); $site_nav[] = array('name' => $GLOBALS['lang']['SHOP_HOME'], 'url' => url("shop", "mall#index", '')); if ($cates) { foreach ($cates as $cate_row) { if ($cate_row['uname'] != "") { $curl = url("shop", "cate#index", array("id" => $cate_row['uname'])); } else { $curl = url("shop", "cate#index", array("id" => $cate_row['id'])); } $site_nav[] = array('name' => $cate_row['name'], 'url' => $curl); } } if ($goods['uname'] != "") { $gurl = url("shop", "goods#index", array("id" => $goods['uname'])); } else { $gurl = url("shop", "goods#index", array("id" => $goods['id'])); } $site_nav[] = array('name' => $goods['name'], 'url' => $gurl); $GLOBALS['tmpl']->assign("site_nav", $site_nav); //输出当前的site_nav $seo_title = $goods['seo_title'] != '' ? $goods['seo_title'] : $goods['name']; $GLOBALS['tmpl']->assign("page_title", $seo_title); $seo_keyword = $goods['seo_keyword'] != '' ? $goods['seo_keyword'] : $goods['name']; $GLOBALS['tmpl']->assign("page_keyword", $seo_keyword . ","); $seo_description = $goods['seo_description'] != '' ? $goods['seo_description'] : $goods['name']; $GLOBALS['tmpl']->assign("page_description", $seo_description . ","); if (!$GLOBALS['user_info']) { $GLOBALS['tmpl']->assign("message_login_tip", sprintf($GLOBALS['lang']['MESSAGE_LOGIN_TIP'], url("shop", "user#login"), url("shop", "user#register"))); } //输出关联商品 $relate_list = get_goods_list(intval(app_conf("RELATE_GOODS_LIMIT")), $goods['shop_cate_id'], ' buy_type <> 1 and is_shop = 1 and id <> ' . $goods['id'], '', true); $shop_cate_uname = $GLOBALS['db']->getOne("select uname from " . DB_PREFIX . "shop_cate where id = " . $goods['shop_cate_id']); if ($shop_cate_uname != "") { $curl = url("shop", "cate#index", array("id" => $shop_cate_uname)); } else { $curl = url("shop", "cate#index", array("id" => $goods['shop_cate_id'])); } $GLOBALS['tmpl']->assign("relate_list", array('title' => $GLOBALS['lang']['RELATE_LIST'], 'list' => $relate_list['list'], 'url' => $curl)); //供应商的地址列表 //定义location_id $locations = $GLOBALS['db']->getAll("select a.* from " . DB_PREFIX . "supplier_location as a left join " . DB_PREFIX . "deal_location_link as b on a.id = b.location_id where a.is_effect = 1 and b.deal_id = " . intval($goods['id'])); $json_location = array(); $location_ids = array(0); foreach ($locations as $litem) { $location_ids[] = $litem['id']; $arr = array(); $arr['title'] = $litem['name']; $arr['address'] = $litem['address']; $arr['tel'] = $litem['tel']; $arr['lng'] = $litem['xpoint']; $arr['lat'] = $litem['ypoint']; $json_location[] = $arr; } $GLOBALS['tmpl']->assign("json_location", json_encode($json_location)); $GLOBALS['tmpl']->assign("locations", $locations); // 判断该商品所属类型是否允许购买 $is_can_buy = is_can_buy($goods['shop_cate_id']); $GLOBALS['tmpl']->assign("is_can_buy", $is_can_buy); // 输出套餐内容 $sql = "select * from " . DB_PREFIX . "set_meal where deal_id=" . $id; $set_meal = $GLOBALS['db']->getAll($sql); $GLOBALS['tmpl']->assign("set_meal", $set_meal); } if ($_REQUEST['plat'] == APP_PLAT) { $GLOBALS['tmpl']->display("goods_app_info.html"); } else { $GLOBALS['tmpl']->display("goods_info.html", $cache_id); } }
public function index() { $GLOBALS['tmpl']->caching = true; $cache_id = md5(MODULE_NAME . ACTION_NAME . $GLOBALS['deal_city']['id']); if (!$GLOBALS['tmpl']->is_cached('mall.html', $cache_id)) { //输出商城分类 $cate_tree = get_cate_tree(0, 1); $top_count = 0; foreach ($cate_tree as $k => $v) { if ($v['level'] == 0) { $top_count++; } // if($top_count>6) // { // $cate_tree[$k]['is_hide'] = 1; // } } $GLOBALS['tmpl']->assign("cate_tree", $cate_tree); //获取推荐 $hot_list = get_goods_list(intval(app_conf("REC_HOT_LIMIT")), 0, " is_hot = 1 and buy_type <> 1", "", false); $best_list = get_goods_list(intval(app_conf("REC_BEST_LIMIT")), 0, " is_best = 1 and buy_type <> 1 ", "", false); $new_list = get_goods_list(intval(app_conf("REC_NEW_LIMIT")), 0, " is_new = 1 and buy_type <> 1 ", "", false); $GLOBALS['tmpl']->assign("inc_var", array('title' => $GLOBALS['lang']['HOT_LIST'], 'list' => $hot_list['list'], 'url' => url("shop", "rec#rhot"))); $hot_span_goods_html = $GLOBALS['tmpl']->fetch("inc/span_goods.html"); $GLOBALS['tmpl']->assign("hot_span_goods_html", $hot_span_goods_html); $GLOBALS['tmpl']->assign("inc_var", array('title' => $GLOBALS['lang']['BEST_LIST'], 'list' => $best_list['list'], 'url' => url("shop", "rec#rbest"))); $best_span_goods_html = $GLOBALS['tmpl']->fetch("inc/span_goods.html"); $GLOBALS['tmpl']->assign("best_span_goods_html", $best_span_goods_html); $GLOBALS['tmpl']->assign("inc_var", array('title' => $GLOBALS['lang']['NEW_LIST'], 'list' => $new_list['list'], 'url' => url("shop", "rec#rnew"))); $new_span_goods_html = $GLOBALS['tmpl']->fetch("inc/span_goods.html"); $GLOBALS['tmpl']->assign("new_span_goods_html", $new_span_goods_html); $recommend_cate = $GLOBALS['db']->getAll("select id,name,uname from " . DB_PREFIX . "shop_cate where grade = 0 order by sort desc"); //输出分类商品 $recommend_cate_html = ""; foreach ($recommend_cate as $cate => $catev) { require_once APP_ROOT_PATH . "system/utils/child.php"; $ids_util = new child("shop_cate"); $ids = $ids_util->getChildIds($catev['id']); $ids[] = $catev['id']; $brand_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "brand where shop_cate_id in (" . implode(",", $ids) . ") limit 8"); foreach ($brand_list as $kk => $brand_item) { $brand_list[$kk]['url'] = url("shop", "brand#index", array("id" => $brand_item['id'])); } //商城推荐分类列表 $time = get_gmtime(); $count_sql = "select count(*) from " . DB_PREFIX . "deal where is_effect = 1 and is_delete = 0 and p_shop_cate_id=" . $catev['id']; $sql = "select * from " . DB_PREFIX . "deal where is_effect = 1 and is_delete = 0 and p_shop_cate_id=" . $catev['id']; $city = get_current_deal_city(); $city_id = $city['id']; if ($city_id > 0) { $ids = load_auto_cache("deal_city_belone_ids", array("city_id" => $city_id)); if ($ids) { $sql .= " and city_id in (" . implode(",", $ids) . ")"; $count_sql .= " and city_id in (" . implode(",", $ids) . ")"; } } $sql .= " and buy_type <> 1 "; $count_sql .= " and buy_type <> 1 "; $sql .= " order by sort desc limit 10 "; $deals = $GLOBALS['db']->getAll($sql); $deals_count = $GLOBALS['db']->getOne($count_sql); if ($deals) { foreach ($deals as $k => $deal) { if ($deal['buy_type'] == 1) { $module = "exchange"; } else { $module = "goods"; } if ($deal['uname'] != '') { $durl = url("shop", $module, array("id" => $deal['uname'])); } else { $durl = url("shop", $module, array("id" => $deal['id'])); } $deal['url'] = $durl; $deals[$k] = $deal; } } $cate_list = array('list' => $deals, 'count' => $deals_count); //$cate_list=$catev['id']; //$cate_list['sd'] = get_goods_list(intval(app_conf("REC_CATE_GOODS_LIMIT")),$catev['id']," buy_type <> 1 ","",false); $cate_title = $catev['name']; if ($catev['uname'] != "") { $curl = url("shop", "cate#index", array("id" => $catev['uname'])); } else { $curl = url("shop", "cate#index", array("id" => $catev['id'])); } $GLOBALS['tmpl']->assign("inc_var", array('id' => $catev['id'], 'brand_list' => $brand_list, 'title' => $cate_title, 'list' => $cate_list['list'], 'url' => $curl)); $recommend_cate_html .= $GLOBALS['tmpl']->fetch("inc/recommend_cate_goods.html"); } $GLOBALS['tmpl']->assign("recommend_cate_html", $recommend_cate_html); $GLOBALS['tmpl']->assign("page_title", app_conf("MALL_SHOP_TITLE")); $GLOBALS['tmpl']->assign("page_keyword", app_conf("MALL_SHOP_TITLE")); $GLOBALS['tmpl']->assign("page_description", app_conf("MALL_SHOP_TITLE")); //输出商城公告 $notice_list = get_notice(0, array(0, 2)); $GLOBALS['tmpl']->assign("notice_list", $notice_list); } $GLOBALS['tmpl']->display("mall.html", $cache_id); }
public function _after_edit($data) { $where = array('post_id' => $data['id']); $ids = array(); $list = M("post_cate_re")->where($where)->select(); foreach ($list as $key => $val) { $ids[] = $val['cate_id']; } $cate_tree = $this->_get_cate_tree(get_cate_tree(M("post_cate")), $ids); $this->assign('cate_tree', $cate_tree); $this->assign("mall_index", $this->mall_mod->where(array('id' => $data['mall_id']))->getField("index")); //tag $tag_list = D("post_tag")->relation(true)->where($where)->select(); foreach ($tag_list as $key => $val) { $tags .= " " . $val['tag']['name'] . " "; } $this->assign("tags", $tags); }
public function pick() { $url_param = array("id" => addslashes(trim($_REQUEST['id'])), "b" => intval($_REQUEST['b']), "min_price" => doubleval($_REQUEST['min_price']), "max_price" => doubleval($_REQUEST['max_price']), "keyword" => addslashes(trim($_REQUEST['keyword']))); $filter_req = $_REQUEST['f']; //筛选数组 if (count($filter_req) > 0) { foreach ($filter_req as $k => $v) { $url_param['f[' . $k . ']'] = $v; } } if (intval($_REQUEST['is_redirect']) == 1) { app_redirect(url("shop", "ss#pick", $url_param)); } //输出商城分类 $cate_tree = get_cate_tree(); $all_cate_tree = get_cate_tree(0, 1); $GLOBALS['tmpl']->assign("cate_tree", $cate_tree); $GLOBALS['tmpl']->assign("all_cate_tree", $all_cate_tree); convert_req($_REQUEST); //获取当前页的团购商品列表 //分页 $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE"); $id = intval($_REQUEST['id']); if ($id == 0) { $uname = addslashes(trim($_REQUEST['id'])); } $cate_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "shop_cate where id = " . $id . " or (uname = '" . $uname . "' and uname <> '')"); $condition = " d.buy_type<>1 "; //条件 $ids = load_auto_cache("shop_sub_cate_ids", array("cate_id" => intval($cate_item['id']))); $add_title = ""; //输出品牌 $brand_id = intval($_REQUEST['b']); if ($brand_id > 0) { $condition .= " and d.brand_id = " . $brand_id; $add_title .= $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "brand where id = " . $brand_id); $GLOBALS['tmpl']->assign("brand_id", $brand_id); } $brand_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "brand order by sort desc"); $GLOBALS['tmpl']->assign("brand_list", $brand_list); //输出属性筛选 $filter_req = $_REQUEST['f']; $join_str = ""; $unicode_tags = array(); foreach ($filter_req as $k => $v) { $filter_req[$k] = trim(addslashes(urldecode($v))); if ($filter_req[$k] != '' && $filter_req[$k] != 'all') { if ($add_title != '') { $add_title .= " - "; } $add_title .= $filter_req[$k]; // //联表及条件 // $join_str.=" left join ".DB_PREFIX."deal_filter as df_".$k." on d.id=df_".$k.".deal_id and df_".$k.".filter_group_id = ".$k; // $condition.=" and df_".$k.".filter like '%".$filter_req[$k]."%' "; $unicode_tags[] = "+" . str_to_unicode_string($filter_req[$k]); } } if (count($unicode_tags) > 0) { $kw_unicode = implode(" ", $unicode_tags); //有筛选 $condition .= " and (match(d.tag_match) against('" . $kw_unicode . "' IN BOOLEAN MODE))"; } if (intval($_REQUEST['id']) != 0) { $filter_group = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "filter_group where is_effect = 1 and cate_id in (" . implode(",", $ids) . ") order by sort desc"); foreach ($filter_group as $k => $v) { $filter_group[$k]['value'] = $filter_req[$v['id']]; } $GLOBALS['tmpl']->assign("filter_group", $filter_group); } //输出价格区间 $min_price = doubleval($_REQUEST['min_price']); $max_price = doubleval($_REQUEST['max_price']); $GLOBALS['tmpl']->assign("min_price", $min_price); $GLOBALS['tmpl']->assign("max_price", $max_price); if ($min_price > 0) { $condition .= " and d.current_price >= " . $min_price; } if ($max_price > 0) { $condition .= " and d.current_price <= " . $max_price; } $sort_field = es_cookie::get("shop_sort_field") ? es_cookie::get("shop_sort_field") : "sort"; $sort_type = es_cookie::get("shop_sort_type") ? es_cookie::get("shop_sort_type") : "desc"; $GLOBALS['tmpl']->assign('sort_field', $sort_field); $GLOBALS['tmpl']->assign('sort_type', $sort_type); if (es_cookie::get("list_type") === null) { $list_type = app_conf("LIST_TYPE"); } else { $list_type = intval(es_cookie::get("list_type")); } $GLOBALS['tmpl']->assign("list_type", $list_type); $kw = addslashes(htmlspecialchars(trim($_REQUEST['keyword']))); if ($kw != '') { $GLOBALS['tmpl']->assign('keyword', $kw); if ($add_title != '') { $add_title .= "-"; } $add_title .= $kw; $kws_div = div_str($kw); foreach ($kws_div as $k => $item) { $kws[$k] = str_to_unicode_string($item); } $ukeyword = implode(" ", $kws); $condition .= " and (match(d.tag_match,d.name_match,d.locate_match,d.shop_cate_match) against('" . $ukeyword . "' IN BOOLEAN MODE))"; //$condition.=" and (d.name like '%".$kw."%' or d.sub_name like '%".$kw."%' or d.brief like '%".$kw."%' or d.description like '%".$kw."%')"; } if ($add_title != '') { $add_title .= "-"; } $add_title .= $GLOBALS['lang']['GOODS_SEARCH']; $result = search_goods_list($limit, intval($cate_item['id']), $condition, "d." . $sort_field . " " . $sort_type, false, $join_str); $GLOBALS['tmpl']->assign("list", $result['list']); $page = new Page($result['count'], app_conf("DEAL_PAGE_SIZE")); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign("cate_id", $cate_item['id']); $GLOBALS['tmpl']->assign("page_title", $add_title . $cate_item['name']); $GLOBALS['tmpl']->assign("page_keyword", $add_title . $cate_item['name'] . ","); $GLOBALS['tmpl']->assign("page_description", $add_title . $cate_item['name'] . ","); $GLOBALS['tmpl']->assign("filter", true); //显示筛选框 $GLOBALS['tmpl']->assign("show_list", true); $GLOBALS['tmpl']->display("ss_index.html"); }
public function index() { $GLOBALS['tmpl']->caching = true; $cache_id = md5(MODULE_NAME . ACTION_NAME . trim($_REQUEST['id']) . intval($_REQUEST['p']) . $GLOBALS['deal_city']['id']); if (!$GLOBALS['tmpl']->is_cached('score_list.html', $cache_id)) { //获取当前页的团购商品列表 //分页 $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE"); $id = intval($_REQUEST['id']); if ($id == 0) { $uname = addslashes(trim($_REQUEST['id'])); } $cate_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "shop_cate where id = " . $id . " or (uname = '" . $uname . "' and uname <> '')"); //输出商城分类 $cate_tree = get_cate_tree($cate_item['id']); $GLOBALS['tmpl']->assign("cate_tree", $cate_tree); $result = get_goods_list($limit, intval($cate_item['id']), 'buy_type = 1', ''); $GLOBALS['tmpl']->assign("list", $result['list']); $page = new Page($result['count'], app_conf("DEAL_PAGE_SIZE")); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); //开始输出当前的site_nav $cates = array(); $cate = $cate_item; do { $cates[] = $cate; $pid = intval($cate['pid']); $cate = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "shop_cate where is_effect =1 and is_delete =0 and id = " . $pid); } while ($pid != 0); foreach ($cates as $cate_row) { $page_title .= $cate_row['name'] . " - "; $page_kd .= $cate_row['name'] . ","; } $page_title = substr($page_title, 0, -3); krsort($cates); $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => APP_ROOT . "/"); if ($cate_item) { foreach ($cates as $cate_row) { if ($cate_row['uname'] != '') { $curl = url("shop", "score#index", array("id" => $cate_row['uname'])); } else { $curl = url("shop", "score#index", array("id" => $cate_row['id'])); } $site_nav[] = array('name' => $cate_row['name'], 'url' => $curl); } } else { $site_nav[] = array('name' => $GLOBALS['lang']['SCORE_LIST'], 'url' => url("shop", "score")); } $GLOBALS['tmpl']->assign("site_nav", $site_nav); //输出当前的site_nav $GLOBALS['tmpl']->assign("page_title", $page_title . $GLOBALS['lang']['SCORE_LIST']); $GLOBALS['tmpl']->assign("page_keyword", $page_kd . $GLOBALS['lang']['SCORE_LIST'] . ","); $GLOBALS['tmpl']->assign("page_description", $page_kd . $GLOBALS['lang']['SCORE_LIST'] . ","); if (!$result['list'] && intval($_REQUEST['p']) > 0) { $GLOBALS['tmpl']->display("score_list.html"); exit; } } $GLOBALS['tmpl']->display("score_list.html", $cache_id); }
public function modify() { $s_account_info = es_session::get("account_info"); foreach ($s_account_info['location_ids'] as $id) { $location = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location where id = " . $id); if ($location) { $locations[] = $location; } } $id = intval($_REQUEST['id']); $deal_info = $GLOBALS['db']->getRow("select d.* from " . DB_PREFIX . "deal as d left join " . DB_PREFIX . "deal_location_link as l on l.deal_id = d.id where d.id = " . $id . " and d.publish_wait = 1 and l.location_id in (" . implode(",", $s_account_info['location_ids']) . ")"); if (!$deal_info) { showErr("产品不存在或者没有编辑该产品的权限"); } $deal_info['begin_time'] = $deal_info['begin_time'] > 0 ? to_date($deal_info['begin_time'], "Y-m-d") : ""; $deal_info['end_time'] = $deal_info['end_time'] > 0 ? to_date($deal_info['end_time'], "Y-m-d") : ""; $deal_info['images'] = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_gallery where deal_id = " . $deal_info['id'] . " order by sort asc"); $GLOBALS['tmpl']->assign("deal_info", $deal_info); $GLOBALS['tmpl']->assign("page_title", "编辑产品"); $cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate where is_effect = 1 and is_delete =0 order by sort desc"); $GLOBALS['tmpl']->assign("cate_list", $cate_list); $shop_cate_list = get_cate_tree(0, 1); $GLOBALS['tmpl']->assign("shop_cate_list", $shop_cate_list); $GLOBALS['tmpl']->assign("locations", $locations); $GLOBALS['tmpl']->display("biz/biz_tuan_modify.html"); }
public function index() { $GLOBALS['tmpl']->caching = true; $GLOBALS['tmpl']->cache_lifetime = 600; //首页缓存10分钟 $cache_id = md5(MODULE_NAME . ACTION_NAME . $GLOBALS['deal_city']['id']); if (!$GLOBALS['tmpl']->is_cached('index.html', $cache_id)) { //输出商城分类 $cate_tree = get_cate_tree(0, 1); $GLOBALS['tmpl']->assign("cate_tree", $cate_tree); make_deal_cate_js(); make_deal_region_js(); $result = load_auto_cache("store_filter_nav_cache", array('city_id' => $GLOBALS['deal_city']['id'])); $GLOBALS['tmpl']->assign("cate_list", $result['cate_list']); $GLOBALS['tmpl']->assign("area_list", $result['area_list']); //获取推荐品牌 $brand_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "brand order by sort limit 24"); $GLOBALS['tmpl']->assign("brand_list", $brand_list); //输出公告 $notice_list = get_notice(0, array(0, 1)); $GLOBALS['tmpl']->assign("notice_list", $notice_list); /** //获取推荐的大分类 $bcate_list = load_dynamic_cache("INDEX_RECOMMEND_BCATE"); if($bcate_list===false) { $bcate_list = $GLOBALS['db']->getAll("select * from ".DB_PREFIX."deal_cate where is_effect = 1 and is_delete = 0 and recommend = 1 order by sort desc limit 8"); set_dynamic_cache("INDEX_RECOMMEND_BCATE",$bcate_list); } * **/ $city_id = $GLOBALS['deal_city']['id']; $shop_cates = $GLOBALS['db']->getAll("select * from tb_shop_cate where grade = 0 and recommend=1 and is_delete=0 order by sort desc"); if (!empty($shop_cates)) { foreach ($shop_cates as $index => $shop_cate) { $shop_cates[$index]['goods'] = $GLOBALS['db']->getAll("select * from tb_deal where city_id = {$city_id} and is_effect = 1 and is_delete = 0 and p_shop_cate_id = " . $shop_cate['id'] . " order by sort limit 10"); $shop_cates[$index]['sub_cates'] = $GLOBALS['db']->getAll("select * from tb_shop_cate where is_effect = 1 and is_delete = 0 and pid= " . $shop_cate['id'] . " order by sort desc limit 8"); $shop_cates[$index]['index'] = $index + 1; } $GLOBALS['tmpl']->assign("shop_cates", $shop_cates); } //输出精品商圈广告位 $sql = "select adv_id from " . DB_PREFIX . "adv where adv_id like '精品商圈广告位%'"; $adv_list = $GLOBALS['db']->getAll($sql); $GLOBALS['tmpl']->assign("adv_list", $adv_list); $city_ids = load_auto_cache("deal_city_belone_ids", array("city_id" => intval($GLOBALS['deal_city']['id']))); if ($city_ids) { $store_list = $GLOBALS['db']->getAll("SELECT * FROM " . DB_PREFIX . "supplier_location use index (search_idx1, is_verify) WHERE is_recommend=1 AND city_id in(" . implode(",", $city_ids) . ") and is_effect = 1 order by is_verify desc,sort desc limit 0," . app_conf("INDEX_SUPPLIER_COUNT")); } else { $store_list = $GLOBALS['db']->getAll("SELECT * FROM " . DB_PREFIX . "supplier_location use index (search_idx1, is_verify) WHERE is_recommend=1 AND is_effect = 1 order by is_verify desc,sort desc limit 0," . app_conf("INDEX_SUPPLIER_COUNT")); } $bcate_list = load_dynamic_cache("INDEX_RECOMMEND_BCATE"); $GLOBALS['tmpl']->assign("bcate_list", $bcate_list); $GLOBALS['tmpl']->assign("store_list", $store_list); $f_link_group = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "link_group where is_effect = 1 order by sort desc"); foreach ($f_link_group as $k => $v) { $g_links = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "link where is_effect = 1 and show_index = 1 and group_id = " . $v['id'] . " order by sort desc"); if ($g_links) { foreach ($g_links as $kk => $vv) { if (substr($vv['url'], 0, 7) == 'http://') { $g_links[$kk]['url'] = str_replace("http://", "", $vv['url']); } } $f_link_group[$k]['links'] = $g_links; } else { unset($f_link_group[$k]); } } $now = get_gmtime(); $vote = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "vote where is_effect = 1 and begin_time < " . $now . " and (end_time = 0 or end_time > " . $now . ") order by sort desc limit 1"); $GLOBALS['tmpl']->assign("vote", $vote); $GLOBALS['tmpl']->assign("f_link_data", $f_link_group); } $GLOBALS['tmpl']->display("index.html", $cache_id); }
if (substr($vv['url'], 0, 7) == 'http://') { $g_links[$kk]['url'] = str_replace("http://", "", $vv['url']); } } $f_link_group[$k]['links'] = $g_links; } else { unset($f_link_group[$k]); } } $GLOBALS['tmpl']->assign("f_link_data", $f_link_group); //输出热门关键词 $hot_kw = app_conf("SHOP_SEARCH_KEYWORD"); $hot_kw = preg_split("/[ ,]/i", $hot_kw); $GLOBALS['tmpl']->assign("hot_kw", $hot_kw); //输出商城分类 $cate_tree = get_cate_tree(); $GLOBALS['tmpl']->assign("cate_tree", $cate_tree); //获取当前页的团购商品 $id = intval($_REQUEST['id']); $uname = addslashes(trim($_REQUEST['id'])); if ($id == 0 && $uname == '') { app_redirect(APP_ROOT . "/"); } elseif ($id == 0 && $uname != '') { $id = $GLOBALS['db']->getOne("select id from " . DB_PREFIX . "deal where uname = '" . $uname . "'"); } //获取当前页的团购商品 $goods = get_goods($id, 1); if (!$goods || $goods['buy_type'] == 1) { //输出规格库存的配置 $attr_stock = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "attr_stock where deal_id = " . $goods['id'] . " order by id asc"); $attr_cfg_json = "{";
function get_cate_tree($pid = 0, $lv = 0) { global $db, $tpf; $q = $db->query("select * from {$tpf}categories order by show_order asc"); while ($rs = $db->fetch_array($q)) { $data[] = $rs; } $db->free($q); unset($rs); if (count($data)) { $html = '<tr>' . LF; foreach ($data as $v) { if ($v['pid'] == $pid) { $total = (int) @$db->result_first("select count(*) from {$tpf}files where cate_id='{$v[cate_id]}' and is_del=0"); $a_modify = urr(ADMINCP, "item=public&menu=file&action=modify_cate&cate_id={$v['cate_id']}"); $a_cate_href = urr("public", "cate_id={$v['cate_id']}"); $a_del_cate = urr(ADMINCP, "item=public&menu=file&action=del_cate&cate_id={$v['cate_id']}"); $nav_show = $v['nav_show'] ? '<span class="txtblue" title="' . __('nav_show') . '">' . __('nav_show_min') . '</span>' : '<span class="txtgray" title="' . __('nav_show') . '">' . __('nav_show_min') . '</span>'; $cate_list = $v['cate_list'] ? '<span class="txtblue" title="' . __('cate_list') . '">' . __('cate_list_min') . '</span>' : '<span class="txtgray" title="' . __('cate_list') . '">' . __('cate_list_min') . '</span>'; $share_index = $v['share_index'] ? '<span class="txtblue" title="' . __('share_index') . '">' . __('share_index_min') . '</span>' : '<span class="txtgray" title="' . __('share_index') . '">' . __('share_index_min') . '</span>'; $html .= "<td>" . LF; $html .= '<input type="text" name="show_order[]" value="' . $v['show_order'] . '" style="width:20px; text-align:center" maxlength="2" />' . LF; $html .= '<input type="hidden" name="cate_ids[]" value="' . $v['cate_id'] . '" />' . LF; $html .= str_repeat(' ', $lv * 2) . '<input type="text" name="cate_names[]" size="30" value="' . $v['cate_name'] . '" /></td>' . LF; $html .= '<td><a href="' . urr(ADMINCP, "item=public&menu=file&action=chg_cate_status&task=nav_show&cate_id={$v['cate_id']}&status={$v['nav_show']}") . '">' . $nav_show . '</a>-<a href="' . urr(ADMINCP, "item=public&menu=file&action=chg_cate_status&task=cate_list&cate_id={$v['cate_id']}&status={$v['cate_list']}") . '">' . $cate_list . '</a>-<a href="' . urr(ADMINCP, "item=public&menu=file&action=chg_cate_status&task=share_index&cate_id={$v['cate_id']}&status={$v['share_index']}") . '">' . $share_index . '</a></td>' . LF; $html .= ' <td align="center">'; $html .= ' <a href="' . $a_cate_href . '" target="_blank">' . $total . '</a>'; $html .= ' </td>' . LF; $html .= ' <td align="right">'; $html .= ' <a href="' . $a_modify . '">' . __('modify') . '</a> '; $html .= ' <a href="' . $a_del_cate . '" onclick="return confirm(\'' . __('del_category_confirm') . '\');">' . __('delete') . '</a></td>' . LF; $lv++; $html .= get_cate_tree($v['cate_id'], $lv); $lv--; } } $html .= '</tr>' . LF; return $html; } else { return ''; } }