Beispiel #1
0
<?php

//产品详情
$item_id = isset($_GET['item_id']) ? (int) $_GET['item_id'] : 0;
if ($item_id) {
    $info = ProductsItem::getData($item_id);
    $status = isset($info['status']) ? (int) $info['status'] : 0;
    if (!$info || !$status) {
        header("Location: /html/404.html?001");
        exit;
    }
    $item = isset($info['item']) ? $info['item'] : '';
    $sku = ProductsSku::getItemFirstSku($item);
    $skuid = isset($sku['id']) ? (int) $sku['id'] : 0;
    if (!$skuid) {
        header("Location: /html/404.html?002");
        exit;
    }
    header("Location: /product/?id={$skuid}");
    exit;
} else {
    $id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
    if (!$id) {
        header("Location: /html/404.html?003");
        exit;
    }
    $sku = ProductsSku::getData($id);
    if (!$sku) {
        header("Location: /html/404.html?004");
        exit;
    }