is_number($_REQUEST['u']) ? $_REQUEST['u'] : false; $sql = "SELECT company,site_logo FROM " . $dou->table('admin') . " WHERE user_id = '$uid'"; $query = $dou->query($sql); $about = $dou->fetch_array($query); //print_r($uid); if(!is_array($about)||empty($uid)){ $dou->dou_msg('请不要做非法操作!', ''); exit; } $nav_middle_list = $dou->gets_nav('middle', '0', 'product_category', $cat_id, $cate_info['parent_id'],$uid,'nav'); foreach ($nav_middle_list as $key => $value) { //print_r($value[module].$key.'
'); if($value[module] == "product_category"){ $nav_middle_list[$key][cur] = '1'; } } // 验证并获取合法的ID,如果不合法将其设定为-1 $cat_id = $firewall->get_legal_id('product_category', $_REQUEST['id'], $_REQUEST['unique_id']); if ($cat_id == -1) { $dou->dou_msg($GLOBALS['_LANG']['page_wrong'], ROOT_URL); } else { $where = ' WHERE user_id = '.$uid.' && cat_id IN (' . $cat_id . $dou->dou_child_id('product_category', $cat_id) . ')'; } // 获取分页信息 $page = $check->is_number($_REQUEST['page']) ? trim($_REQUEST['page']) : 1; $limit = $dou->pager('product', ($_DISPLAY['product'] ? $_DISPLAY['product'] : 10), $page, $dou->rewrites_url('product_category', $cat_id,$uid,'nav',$page), $where); /* 获取产品列表 */ $sql = "SELECT id, cat_id, pname, price, content, image, add_time, description FROM " . $dou->table('product') . $where . " ORDER BY id DESC" . $limit; $query = $dou->query($sql); while ($row = $dou->fetch_array($query)) { $url = $dou->rewrites_url('product', $row['id'], $uid,'nav'); // 获取经过伪静态产品链接 rewrites_url($module, $value = '', $uid, $nav) $add_time = date("Y-m-d", $row['add_time']); // 如果描述不存在则自动从详细介绍中截取 $description = $row['description'] ? $row['description'] : $dou->dou_substr($row['content'], 150); // 生成缩略图的文件名 $image = explode(".", $row['image']); $thumb = ROOT_URL . $image[0] . "_thumb." . $image[1]; // 格式化价格 $price = $row['price'] > 0 ? $dou->price_format($row['price']) : $_LANG['price_discuss']; $product_list[] = array ( "id" => $row['id'], "cat_id" => $row['cat_id'], "pname" => $row['pname'], "price" => $price, "thumb" => $thumb, "add_time" => $add_time, "description" => $description, "url" => $url ); } // 获取分类信息 $sql = "SELECT * FROM " . $dou->table('product_category') . " WHERE cat_id = '$cat_id'"; $query = $dou->query($sql); $cate_info = $dou->fetch_assoc($query); $smarty->assign('company', $about['company']);//logo名称 $smarty->assign('site_logo', $about['site_logo']);//logo图片 $smarty->assign('site_url',$dou->get_nav_index($uid));//会员首页地址 // 赋值给模板-meta和title信息 $smarty->assign('page_title', $dou->page_title('product_category', $cat_id).$about['company'].'--'.$dou->page_title()); $smarty->assign('keywords', $cate_info['keywords']); $smarty->assign('description', $cate_info['description']); // 赋值给模板-导航栏 $smarty->assign('nav_top_list', $dou->get_nav('top')); $smarty->assign('nav_middle_list', $nav_middle_list);//$dou->gets_nav('middle', '0', 'product_category', $cat_id, $cate_info['parent_id'],$uid,'nav') $smarty->assign('nav_bottom_list', $dou->gets_nav('bottom', '0', 'product_category', $cat_id, $cate_info['parent_id'],$uid,'nav')); // 赋值给模板-数据 $smarty->assign('ur_here', $dou->ur_here('product_category', $cat_id,'', $uid,'nav')); $smarty->assign('cate_info', $cate_info); $smarty->assign('product_category', $dou->get_category('product_category', 0, $cat_id, $uid, 'nav')); $smarty->assign('product_list', $product_list); $smarty->assign('recommend_product', $dou->get_list('product', 'ALL', $_DISPLAY['home_product'], 'sort DESC',$uid)); $smarty->display('product_category.tpl'); ?>