本文整理汇总了PHP中Products::listProducts方法的典型用法代码示例。如果您正苦于以下问题:PHP Products::listProducts方法的具体用法?PHP Products::listProducts怎么用?PHP Products::listProducts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Products
的用法示例。
在下文中一共展示了Products::listProducts方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
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: json_encode
<?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: array
<?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);
}
?>