Esempio n. 1
0
    if (!$item) {
        header("Location: /html/404.html?005");
        exit;
    }
    $sku['iteminfo'] = $item;
    $sku_code = $sku['sku'];
    $pics = ProductsPic::getSkuPics($sku_code, 'path', 'sort DESC LIMIT 0,3');
    $sku['pics'] = $pics;
    $sku['order_num'] = OrdersProducts::getSkuAllNum($sku_code);
    $sku['stock'] = ProductsStock::getSkuStock($sku_code);
    $skus = ProductsSku::getItemSkus($item_code, "id,sku,sku_name");
    $skus = ProductsSku::getProductsPic($skus);
    $sku['skus'] = $skus;
    $userid = isset($_SESSION['userid']) ? (int) $_SESSION['userid'] : 0;
    $history = array();
    if ($userid) {
        $history = UsersHistory::getProductViewLog($userid, $id);
    }
    if (!$history) {
        $history = ProductsSku::getRand($item_code);
    }
    $history = ProductsSku::getProductsPic($history);
    $history = ProductsSku::getProductsItemTitle($history);
    ProductsSku::increase("id={$id}", 'view_num');
    $log = array('op' => 'view', 'id' => $id, 'url' => Func::getCurrentURL());
    $log = json_encode($log);
    UsersHistory::addLog($userid, ProductsSku::$module_id, $log);
    Templates::Assign('history', $history);
    Templates::Assign('sku', $sku);
    Templates::Display('product.html');
}