/** * 商品分类列表 */ public function indexOp() { Language::read('home_goods_class_index'); $lang = Language::getLangContent(); //分页 $page = new Page(); /* ectap触屏模板修改开始 */ $page->setEachNum(EditionSwitch::isMobile() ? 10 : 40); /* ectap触屏模板修改结束 */ $page->setStyle('admin'); $model_goods_class = Model('goods_class'); $keyword = trim($_GET['keyword']); if ($keyword != '') { if (C('fullindexer.open')) { $data['goods_id_str'] = $this->full_search($keyword); $search_key = ''; } else { $search_key = $keyword; } //显示左侧商品分类,存入goods_class_array下标 $data['goods_class_array'] = $this->left_category($keyword); } elseif (is_numeric($_GET['cate_id'])) { $data = $this->get_goods_info_by_attr(); } else { //无关键词时,显示一级商品分类 if (!($category = F('goods_class'))) { $category = H('goods_class', true, 'file'); } if (is_array($category) && !empty($category)) { foreach ($category as $v) { if ($v['gc_parent_id'] != '0') { break; } $data['goods_class_array']['child'][] = array('gc_id' => $v['gc_id'], 'gc_name' => $v['gc_name']); } } } //得到查询价格 if (!empty($_GET['price'])) { $price = explode('-', $_GET['price']); if (intval($price[0]) > 0 || intval($price[1]) > 0) { $price_interval[0] = empty($price[0]) ? 0 : $price[0]; $price_interval[1] = empty($price[1]) ? 0 : $price[1]; } Tpl::output('price_interval', $price_interval); } //得到排序方式 if (!empty($_GET['key'])) { $order_tmp = trim($_GET['key']); $order = ''; switch ($order_tmp) { case 'sales': //销量 $order = 'salenum'; break; case 'credit': //信用 $order = 'store_credit'; break; case 'price': //价格升序 $order = 'goods_store_price'; break; case 'click': //浏览量 $order = 'goods_click'; break; } $order .= ' ' . trim($_GET['order']); } $ext_order = C('promotion_allow') ? ' xianshi_flag desc,goods_starttime desc' : ' goods_starttime desc'; $order = $order ? $order . ', goods_starttime desc' : $ext_order; //成色筛选 if (isset($_GET['form'])) { switch (intval($_GET['form'])) { case 1: $form = $lang['goods_class_form_new']; $goods_form = 1; break; case 2: $form = $lang['goods_class_form_used']; $goods_form = 2; break; } Tpl::output('form', $form); } //筛选类型 $xianshi_flag = 0; $group_flag = 0; if (!empty($_GET['promotion'])) { //当前选项 $promotion = ''; switch ($_GET['promotion']) { case 'xianshi': $promotion = $lang['nc_xianshi']; $xianshi_flag = 1; break; case 'groupbuy': $promotion = $lang['goods_class_index_groupbuy']; $group_flag = 1; break; } } Tpl::output('promotion', $promotion); $model_goods = Model('goods'); // 直通车 if (C('gold_isuse') && C('ztc_isuse')) { $fieldstr = " goods.goods_id,goods.goods_name,goods.goods_subtitle,goods.gc_id,goods.gc_name,goods.store_id,goods.goods_image,goods.goods_store_price,goods.goods_transfee_charge,\r\n\t\t\t\t\t\tgoods.goods_click,goods.goods_state,goods.goods_commend,goods.commentnum,goods.salenum,goods.goods_goldnum,goods.goods_isztc,\r\n\t\t\t\t\t\tgoods.goods_ztcstartdate,goods.goods_ztclastdate,store.store_desccredit"; $ztc_list = $model_goods->getGoods(array('gc_id_in' => $data['gc_id_str'], 'goods_show' => '1', 'goods_isztc' => '1', 'goods_ztcopen' => '1', 'limit' => '4', 'order' => rand(1, 5)), '', $fieldstr, 'store'); Tpl::output('ztc_list', $ztc_list); } //商品列表 $fieldstr = " goods.goods_id,goods.goods_name,goods.goods_subtitle,goods.gc_id,goods.gc_name,goods.store_id,goods.goods_image,goods.goods_image_more,goods.spec_id,goods.goods_store_price,goods.goods_spec,\r\n\t\tgoods.goods_click,goods.goods_state,goods.goods_commend,goods.commentnum,goods.salenum,goods.goods_goldnum,goods.goods_isztc,\r\n\t\tgoods.goods_ztcstartdate,goods.goods_ztclastdate,goods.group_flag,goods.group_price,goods.xianshi_flag,goods.xianshi_discount,\r\n\t\tgoods.city_id,goods.province_id,goods.kd_price,goods.py_price,goods.es_price,\r\n\t\tstore.store_name,store.grade_id,store.store_domain,store.store_credit,store.praise_rate,store.store_desccredit"; $goods_list = $model_goods->getGoods(array('goods_id_in' => $data['goods_id_str'], 'price' => $price_interval, 'group_flag' => $group_flag, 'xianshi_flag' => $xianshi_flag, 'keyword' => $search_key, 'province_id' => is_numeric($_GET['area_id']) && $_GET['area_id'] > 0 ? $_GET['area_id'] : '', 'goods_show' => '1', 'goods_form' => $goods_form, 'order' => $order), $page, $fieldstr, 'store', $extend); Tpl::output('goods_list', $goods_list); Tpl::output('show_page', $page->show()); if (is_array($goods_list)) { //得到商品数 $goods_count = $page->getTotalNum(); Tpl::output('goods_count', $goods_count); } Tpl::output('goods_class_array', $data['goods_class_array']); //地区 $area_url = BasePath . DS . 'data' . DS . 'area' . DS . 'area.php'; if (file_exists($area_url)) { include_once $area_url; } if (strtoupper(CHARSET) == 'GBK') { $area_array = Language::getGBK($area_array); } Tpl::output('area_array', $area_array); //展示形式,默认以方格展示 Tpl::output('display_mode', $_COOKIE['goodsDisplayMode'] ? $_COOKIE['goodsDisplayMode'] : 'squares'); //SEO $seo_class_name = @$data['goods_class_array']['gc_name']; if (is_numeric($_GET['cate_id'])) { $seo_info = $model_goods_class->getKeyWords(intval($_GET['cate_id'])); if (empty($seo_info[1])) { $seo_info[1] = C('site_name') . ' - ' . $seo_class_name; } Model('seo')->type($seo_info)->param(array('name' => $seo_class_name))->show(); } elseif (is_scalar($_GET['keyword'])) { Tpl::output('html_title', (empty($_GET['keyword']) ? '' : $_GET['keyword'] . ' - ') . C('site_name') . $lang['nc_common_search']); } //当前位置导航 $nav_link_list = $model_goods_class->getGoodsClassNav(intval($_GET['cate_id'])); Tpl::output('nav_link_list', $nav_link_list); //得到自定义导航信息 $nav_id = intval($_GET['nav_id']) ? intval($_GET['nav_id']) : 0; Tpl::output('index_sign', $nav_id); /* ectap触屏模板修改开始 */ $this->_assignMobileData($page); /* ectap触屏模板修改结束 */ Tpl::showpage('search'); }
/** * 订单 * * @param * @return */ public function orderOp() { /** * 读取语言包 */ Language::read('member_member_index'); $lang = Language::getLangContent(); /** * 实例化订单模型 */ $model_order = Model('order'); /** * 订单分页 */ $page = new Page(); /* ectap触屏模板修改开始 */ $page->setEachNum(EditionSwitch::isMobile() ? 5 : 10); /* ectap触屏模板修改结束 */ $page->setStyle('admin'); /** * 实例化买家订单模型 */ $model_my_order = Model('my_order'); /*搜索条件*/ $array = array(); $array['order_sn'] = trim($_GET['order_sn']); $array['order_state'] = in_array(trim($_GET['state_type']), array('order_pay', 'order_submit', 'order_pay_confirm', 'order_no_shipping', 'order_shipping', 'order_finish', 'order_cancal', 'order_refer', 'order_confirm')) ? trim($_GET['state_type']) : ''; if ($_GET['state_type'] == 'noeval') { $array['order_evalbuyer_able'] = '1'; } $array['add_time_from'] = strtotime($_GET['add_time_from']); $array['add_time_to'] = strtotime($_GET['add_time_to']); if ($array['add_time_to'] > 0) { $array['add_time_to'] += 86400; } $order_list = $model_my_order->myOrderList($array, $page, 'order_id,store_id'); /** * 订单下的商品 */ if (is_array($order_list) && !empty($order_list)) { $order_id_array = array(); $store_id_array = array(); $store_array = array(); //店铺信息 $refund_array = array(); //退款信息 $return_array = array(); //退货信息 $model_store = Model('store'); foreach ($order_list as $v) { $order_id_array[] = $v['order_id']; if (!in_array($v['store_id'], $store_id_array)) { $store_id_array[] = $v['store_id']; } } $order_list = array(); $order_list = $model_my_order->myOrderGoodsList(array('order_id_string' => "'" . implode("','", $order_id_array) . "'")); $store_list = $model_store->getStoreList(array('store_id_in' => "'" . implode("','", $store_id_array) . "'")); //获得订单店铺信息 if (is_array($store_list) && !empty($store_list)) { foreach ($store_list as $val) { $store_array[$val['store_id']] = $val; } } /** * 实例化退款模型 */ $model_refund = Model('refund'); $condition = array(); $condition['buyer_id'] = $_SESSION['member_id']; $condition['order_ids'] = "'" . implode("','", $order_id_array) . "'"; $condition['refund_type'] = '1'; $refund_list = $model_refund->getList($condition); if (is_array($refund_list) && !empty($refund_list)) { foreach ($refund_list as $val) { $refund_array[$val['order_id']] = $val; } } /** * 实例化退货模型 */ $model_return = Model('return'); $condition = array(); $condition['buyer_id'] = $_SESSION['member_id']; $condition['order_ids'] = "'" . implode("','", $order_id_array) . "'"; $condition['return_type'] = '1'; $return_list = $model_return->getList($condition); if (is_array($return_list) && !empty($return_list)) { foreach ($return_list as $val) { $return_array[$val['order_id']] = $val; } } $order_array = array(); if (is_array($order_list) && !empty($order_list)) { $store_id = 0; $store = array(); foreach ($order_list as $val) { $order_id = $val['order_id']; if (is_array($refund_array[$order_id]) && !empty($refund_array[$order_id])) { $val['refund'] = $refund_array[$order_id]; } if (is_array($return_array[$order_id]) && !empty($return_array[$order_id])) { $val['return'] = $return_array[$order_id]; } $val['spec_info_arr'] = ''; if (!empty($val['spec_info'])) { $val['spec_info_arr'] = unserialize($val['spec_info']); } $val['state_info'] = orderStateInfo($val['order_state'], $val['refund_state']); $store_id = $val['store_id']; $store = $store_array[$store_id]; /** * 获得联系方式 */ $val['member_id'] = $store['member_id']; $val['member_name'] = $store['member_name']; $val['store_qq'] = $store['store_qq']; $val['store_ww'] = $store['store_ww']; unset($store); //1.交易成功超过十五天双方都未评价时评价关闭2.一方评价后超过十五天评价结束 if ($val['evaluation_status'] == 1) { //买家已经评价 $val['able_evaluate'] = false; } else { $val['able_evaluate'] = true; } if ($val['able_evaluate'] && $val['evalseller_status'] == 0 && intval($val['finnshed_time']) + 60 * 60 * 24 * 15 < time()) { $val['able_evaluate'] = false; } elseif ($val['able_evaluate'] && $val['evalseller_status'] == 1 && intval($val['evalseller_time']) + 60 * 60 * 24 * 15 < time()) { $val['able_evaluate'] = false; } $order_array[$val['order_id']][] = $val; } } } Tpl::output('order_array', $order_array); Tpl::output('show_page', $page->show()); //输出投诉失效变量 Tpl::output('complain_time_limit', $GLOBALS['setting_config']['complain_time_limit']); //查询会员信息 $this->get_member_info(); self::profile_menu('member_order', 'member_order'); Tpl::output('menu_sign', 'myorder'); Tpl::output('menu_sign_url', 'index.php?act=member&op=order'); Tpl::output('menu_sign1', 'myorder_list'); /* ectap触屏模板修改开始 */ $this->_assignMobileData($page); /* ectap触屏模板修改结束 */ Tpl::showpage('member_order'); }
/** * 全部商品 */ public function goods_allOp() { /** * 读取语言包 */ Language::read('store_show_store_index'); $lang = Language::getLangContent(); /** * 实例化模型 */ $store_navigation_partner_class = Model('store_navigation_partner'); $goods_class = Model('goods'); /** * 获得店铺ID */ $store_id = intval($_GET['id']); if ($store_id == 0) { showMessage($lang['show_store_index_store_not_exists'], '', 'html', 'error'); } //获取店铺详细信息 $store_info = $this->getStoreInfo($store_id); /** * 得到店铺页面seo信息 */ $seo_keywords = $store_info['store_keywords']; $seo_description = $store_info['store_description']; Tpl::output('seo_keywords', $seo_keywords); Tpl::output('seo_description', $seo_description); /** * 得到友情链接信息 */ $store_partner_list = $store_navigation_partner_class->getPartnerList(array('sp_store_id' => $store_info['store_id'])); Tpl::output('store_partner_list', $store_partner_list); /** * 分页信息 */ $page = new Page(); /* ectap触屏模板修改开始 */ $page->setEachNum(EditionSwitch::isMobile() ? 10 : 24); /* ectap触屏模板修改开始 */ $page->setStyle('admin'); $conditionArr = array(); $conditionArr['store_id'] = $store_info['store_id']; $conditionArr['goods_state'] = 0; $conditionArr['goods_show'] = 1; $conditionArr['keyword'] = trim($_GET['keyword']); $conditionArr['start_price'] = floatval($_GET['start_price']); $conditionArr['end_price'] = floatval($_GET['end_price']); if (trim($_GET['order'] != 'asc')) { $_GET['order'] = 'desc'; } // 排序 switch (trim($_GET['key'])) { case 'price': $conditionArr['order'] = 'goods.goods_store_price ' . $_GET['order']; break; case 'sale': $conditionArr['order'] = 'goods.salenum ' . $_GET['order']; break; case 'click': $conditionArr['order'] = 'goods.goods_click ' . $_GET['order']; break; case 'collect': $conditionArr['order'] = 'goods.goods_collect ' . $_GET['order']; break; case 'new': $conditionArr['order'] = 'goods.goods_starttime ' . $_GET['order']; break; default: $conditionArr['order'] = 'goods.goods_starttime desc'; break; } //查询分类下的子分类 if ($_GET['stc_id']) { $model_store_class = Model('my_goods_class'); $stc_id_arr = $model_store_class->getChildAndSelfClass(intval($_GET['stc_id']), '1'); if (is_array($stc_id_arr) && count($stc_id_arr) > 0) { $conditionArr['stc_id_in'] = implode(',', $stc_id_arr); } else { $conditionArr['stc_id'] = $stc_id_arr; } $recommended_goods_list = $goods_class->getGoods($conditionArr, $page, 'goods.*', 'stc'); } else { $recommended_goods_list = $goods_class->getGoods($conditionArr, $page, 'goods.*', 'goods'); } if (!empty($recommended_goods_list) && is_array($recommended_goods_list)) { foreach ($recommended_goods_list as $key => $value) { /** * 格式化价格显示 */ $recommended_goods_list[$key]['goods_price'] = ncPriceFormat($value['goods_price']); /** * 图片链接 */ } } //查询店铺动态评价 $this->show_storeeval($store_id); //输出分页 Tpl::output('show_page', $page->show()); $stc_class = Model('store_goods_class'); $stc_info = $stc_class->getOneById(intval($_GET['stc_id'])); Tpl::output('stc_name', $stc_info['stc_name']); Tpl::output('page', 'index'); Tpl::output('recommended_goods_list', $recommended_goods_list); /* ectap触屏模板修改开始 */ $this->_assignMobileData($page); /* ectap触屏模板修改开始 */ Tpl::showpage('goods_list'); }