Ejemplo n.º 1
0
<?php

include_once "init.php";
include_once LIB_ROOT . "Sp/View.php";
include_once LIB_ROOT . "Sp/Taobao/Goods.php";
include_once LIB_ROOT . "Sp/Taobao/Shop.php";
include_once LIB_ROOT . "Sp/Taobao/Taobaoke.php";
$sp_view = new Sp_View('utf-8');
$cache_id = 'goods|' . md5(var_export($_GET, true));
if (!$sp_view->isCached('goods.html', $cache_id)) {
    $num_iid = isset($_GET['iid']) ? $_GET['iid'] : $sp_view->out_404(true);
    /*
    $categores = Sp_Taobao_Shop::getCategoes('康美健食品专营店');
    print_r($categores);
    die();
    */
    //取商品详情
    $goods_detail = Sp_Taobao_Goods::getItemDetail($num_iid);
    //淘宝客点击url
    $url = Sp_Taobao_Taobaoke::getItemConvert($num_iid, Config::get('taoke.pid_short'));
    $cid = $goods_detail["item"]['cid'];
    $props = $goods_detail["item"]['props'];
    //商品属性
    $props = Sp_Taobao_Goods::getItemPropValues($cid, $props);
    //商品分类信息
    $catgory = Sp_Taobao_Goods::getItemcats($cid);
    //当前分类的推荐商品
    $cat_goods = Sp_Taobao_Goods::getCategoryItems($cid, 40, Config::get('taoke.pid_short'));
    //从40个商品中随机取8个
    shuffle($cat_goods['taobaoke_items']['taobaoke_item']);
    $cat_goods['taobaoke_items']['taobaoke_item'] = array_slice($cat_goods['taobaoke_items']['taobaoke_item'], 0, 8);
Ejemplo n.º 2
0
<?php

include_once "init.php";
include_once LIB_ROOT . "Sp/View.php";
include_once LIB_ROOT . "Sp/Pager.php";
include_once LIB_ROOT . "Sp/Taobao/Goods.php";
include_once LIB_ROOT . "Sp/Taobao/Shop.php";
//list-1801-0-1-10000-w!bEpA-2.html
$cache_id = 'list|' . md5(var_export($_GET, true));
$sp_view = new Sp_View('utf-8');
if (!$sp_view->isCached('list.html', $cache_id)) {
    $cid = isset($_GET['catid']) ? $_GET['catid'] : 0;
    $sort = isset($_GET['sort']) ? $_GET['sort'] : 1;
    $start_price = isset($_GET['sp']) ? $_GET['sp'] : Config::get('special.start_price');
    $end_price = isset($_GET['ep']) ? $_GET['ep'] : Config::get('special.end_price');
    $keyword = isset($_GET['sq']) ? $_GET['sq'] : '';
    $page_no = isset($_GET['page']) ? $_GET['page'] : 1;
    $page_size = 36;
    //静态编码网址转码
    if (Config::get('special.static') == '1') {
        $keyword = htmlspecialchars(url_base64_decode($keyword));
        if ($keyword != '') {
            $encode_keyword = url_base64_encode($keyword);
            $url_format = "list-{$cid}-{$sort}-{$start_price}-{$end_price}-{$encode_keyword}-%d.html";
        } else {
            $url_format = "list-{$cid}-{$sort}-{$start_price}-{$end_price}-%d.html";
        }
        //$url_format = "?catid=$cid&page=%d&sq=$keyword":"?catid=$cid&page=%d";
    } else {
        if ($keyword != '') {
            $url_format = "list.php?catid={$cid}&sortnum={$sort}&sp={$start_price}&ep={$end_price}&sq={$keyword}&page=%d";