Example #1
0
/**
 * 搜索分类信息用于帮助筛选
 */
$wd = isset($_GET['wd']) ? trim($_GET["wd"]) : "";
$catezh = isset($_GET["catezh"]) ? trim($_GET["catezh"]) : "";
if (empty($wd) && empty($catezh)) {
    output("无法获取搜索词");
}
$conn = new Table("local189");
$searchCateArr = getSearchCateArr($wd, $catezh);
if (empty($searchCateArr)) {
    output("无法获取到搜索结果");
}
$result = array();
foreach ($searchCateArr as $value) {
    $cateNav = getCateNav($value["cateid"]);
    if ($cateNav) {
        $result[] = $cateNav;
    }
}
output($result, true);
/**
 * 获取分类导航
 *
 * @Author   tianyunzi
 * @DateTime 2016-01-27T09:16:59+0800
 * @return   [type]                   [description]
 */
function getCateNav($cateid)
{
    global $conn;
Example #2
0
<?php

/**
 * 分类对应关系
 */
header("Content-type:text/html;charset=utf-8");
$conn = new Table("local189");
$mapCate = getUnmapCate();
$cateNav = getCateNav($mapCate["cid"]);
/*获取下当前末级分类的产品数量 */
$pronum = getCatePronum($mapCate["cid"]);
require_once "templates/map.phtml";
/**
 * 获取一个未对应的分类
 *
 * @Author   tianyunzi
 * @DateTime 2016-01-27T08:39:51+0800
 * @return   [type]                   [description]
 */
function getUnmapCate()
{
    global $conn;
    $result = $conn->findOne("select cid, cate, level from forbuyscateinfo.f_cate where is_leaf = 1 and is_jump = 0 and is_map = 0 limit 1");
    if (empty($result)) {
        exit("所有的分类已经对应完毕\n");
    }
    return $result;
}
/**
 * 获取末级分类下的产品数量
 *