本文整理匯總了PHP中Orders::findAll方法的典型用法代碼示例。如果您正苦於以下問題:PHP Orders::findAll方法的具體用法?PHP Orders::findAll怎麽用?PHP Orders::findAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Orders
的用法示例。
在下文中一共展示了Orders::findAll方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: get_orders
/**
* Retrieves all orders (if the authenticated user is an admin) or orders
* of a certain customer (if the authenticated user is a customer) from the
* database as well as their products. Displays the order list.
*/
public static function get_orders()
{
$orders = array();
$user = self::get_user_logged_in();
if ($user) {
if ($user->username == 'admin') {
$orders = Orders::findAll();
} else {
$orders = Orders::findByUser($user->id);
}
}
foreach ($orders as $order) {
$order_products = OrderProduct::findByOrder($order->id);
foreach ($order_products as $index => $order_product) {
$order->products[$index] = json_decode($order_product->product_info);
}
$order->user_info = json_decode($order->user_info);
}
View::make('order/list.html', array('orders' => $orders));
}
示例2: actionIndex
/**
* 首頁
*
*/
public function actionIndex()
{
$model = new Orders();
$criteria = new CDbCriteria();
$condition = "1=1";
$username = trim($this->_request->getParam('username'));
$order_code = trim($this->_request->getParam('order_code'));
$status = intval($this->_request->getParam('status'));
$username && ($condition .= ' AND username LIKE \'%' . $username . '%\'');
$order_code && ($condition .= ' AND order_code like \'%' . $order_code . '%\'');
$status && ($condition .= ' AND status= ' . $status);
$criteria->condition = $condition;
$criteria->order = 'id DESC';
$count = $model->count($criteria);
$pages = new CPagination($count);
$pages->pageSize = 10;
//根據goods_name,catelogId查詢
$pageParams = $this->buildCondition($_GET, array('username', 'order_code', 'status'));
$pages->params = is_array($pageParams) ? $pageParams : array();
$criteria->limit = $pages->pageSize;
$criteria->offset = $pages->currentPage * $pages->pageSize;
$result = $model->findAll($criteria);
$this->render('index', array('datalist' => $result, 'pagebar' => $pages));
}
示例3: Pages
<?php
/**
* [PHPB2B] Copyright (C) 2007-2099, Ualink Inc. All Rights Reserved.
* The contents of this file are subject to the License; you may not use this file except in compliance with the License.
*
* @version $Revision: 2075 $
*/
require "../libraries/common.inc.php";
require "room.share.php";
require PHPB2B_ROOT . './libraries/page.class.php';
uses("order");
$page = new Pages();
$page->displaypg = 25;
$options = cache_read("typeoption");
setvar("pay_status", $options['common_option']);
setvar("order_status", $options['common_status']);
$conditions[] = "member_id=" . $the_memberid;
if (isset($_GET['action'])) {
$action = trim($_GET['action']);
if ($action == "cancel" && !empty($_GET['tradeno'])) {
$pdb->Execute("DELETE FROM " . $tb_prefix . "orders WHERE trade_no='" . $_GET['tradeno'] . "' AND member_id='" . $the_memberid . "' AND pay_status='0'");
}
}
$order = new Orders();
$amount = $order->findCount(null, $conditions);
$page->setPagenav($amount);
$result = $order->findAll("*", null, $conditions, " id desc", $page->firstcount, $page->displaypg);
setvar("ByPages", $page->pagenav);
setvar("datas", $result);
vtemplate("order");
示例4: explode
}
}
$tpl_file = "order.goods";
$result = $pdb->GetArray($sql);
if (!empty($result)) {
$total_price = 0;
for ($i = 0; $i < count($result); $i++) {
$tmp_str = explode("|", $result[$i]['content']);
if ($result[$i]['goods_id'] == "2" && strpos($result[$i]['content'], "|") === false) {
$total_price = $result[$i]['total_price'];
$result[$i]['price'] = $result[$i]['total_price'];
$result[$i]['charge'] = 1;
} else {
$total_price += $result[$i]['price'] * $result[$i]['amount'];
}
}
setvar("Items", $result);
setvar("TotalPrice", $total_price);
}
template($tpl_file);
exit;
}
}
}
$joins[] = "LEFT JOIN {$tb_prefix}members m ON m.id=Orders.member_id LEFT JOIN {$tb_prefix}memberfields mf ON mf.member_id=Orders.member_id";
$amount = $order->findCount($joins, null, "Orders.id");
$page->setPagenav($amount);
$result = $order->findAll("Orders.*,m.username,mf.first_name,mf.last_name as true_name", $joins, $conditions, " Orders.id DESC", $page->firstcount, $page->displaypg);
setvar("Items", $result);
setvar("ByPages", $page->pagenav);
template($tpl_file);