Exemple #1
0
    //没有选择商城,则默认全部商城被选中
    $mallStr .= "<a href=\"./index.php?id=" . $c_id . "\" class=\"curcateitem\"><span class=\"curcateitemword\">全部</span></a>";
} else {
    $mallStr .= "<a href=\"./index.php?id=" . $c_id . "\" class=\"cateitem\"><span class=\"cateitemword\">全部</span></a>";
}
for ($i = 0; $i < count($sources); $i++) {
    if ($mall_id == $i + 1) {
        //商城id对应则显示该分类被选中
        $mallStr .= "<a href=\"./index.php?id=" . $c_id . "&mall_id=" . ($i + 1) . "\" class=\"curcateitem\"><span class=\"curcateitemword\">" . $sources[$i]['mallName'] . "</span></a>";
    } else {
        $mallStr .= "<a href=\"./index.php?id=" . $c_id . "&mall_id=" . ($i + 1) . "\" class=\"cateitem\"><span class=\"cateitemword\">" . $sources[$i]['mallName'] . "</span></a>";
    }
}
$_SESSION['uri'] = $_SERVER['REQUEST_URI'];
//接受商品列表显示页码
$page = isset($_GET['page']) ? $_GET['page'] : 1;
$pagecount = $config['pagecount'];
//获取该类商品的总记录数
$goods = new Goods();
$counts = $goods->getCartGoodsCounts($c_id)['c'];
$pages = ceil($counts / $pagecount);
//对用户传递$page进行判断
if (!is_numeric($page) || $page > $pages || $page < 1) {
    $page = 1;
}
$cartGoods = $goods->getGoodsByCartId($c_id, $page, $pagecount);
//分页显示
//分页链接字符串
$pageString = Page::getPageStr('index.php', 'index', $counts, $page, $pagecount, $c_id);
//加载首页显示模板
include_once YIMAI_TEMP . 'index.html';