示例#1
0
        break;
        // add to shopping cart
    // add to shopping cart
    case "add_to_cart":
        if (isset($_POST['product_id'])) {
            // we always add one piece for now
            $qt = isset($_POST['qt']) ? $_POST['qt'] : 1;
            $shopping_cart->addProduct($_POST['product_id'], $qt);
        }
        // we don't have the break here on purpose so that the code continues
        // with displaying the contents of the shopping cart
        //break;
        // shopping cart
    // we don't have the break here on purpose so that the code continues
    // with displaying the contents of the shopping cart
    //break;
    // shopping cart
    case "show_cart":
        $product_list = $shopping_cart->getContents();
        $smarty->assign("products", $product_list);
        $smarty->assign("items", $products->listProducts());
        $smarty->display("cart.tpl");
        break;
        // index page
    // index page
    default:
        $product_list = $products->listProducts();
        $smarty->assign("products", $product_list);
        $smarty->display("index.tpl");
        break;
}
示例#2
0
<?php

require_once "../helper.php";
require_once "../classes/Products.class.php";
require_once "../classes/Company.class.php";
$helper = new Helper();
$productObj = new Products();
$companyObj = new Company();
if (($result = $companyObj->checkLoggedIn()) && !isset($result['error'])) {
    $result = $productObj->listProducts($result['company_id']);
}
echo json_encode($result);
?>
	
示例#3
0
<?php

$games = array();
$items = new Products();
$games = $items->listProducts();
if (isset($_GET['id'])) {
    $document['template'] = 'game';
    $game = $items->getProduct($_GET['id']);
    $product = Gameservices::validateGame($game);
    $smarty->assign('game', $product);
} else {
    $document['template'] = 'games';
    /*********Games For View************/
    foreach ($games as $value) {
        $products[] = Gameservices::validateGameList($value);
    }
    /********************************/
    $smarty->assign('games', $products);
}
?>