本文整理汇总了PHP中Order::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP Order::insert方法的具体用法?PHP Order::insert怎么用?PHP Order::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Order
的用法示例。
在下文中一共展示了Order::insert方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upgradeLicense
public function upgradeLicense()
{
$upgrade_app = new Application($this->application->upgrade_app_id);
if ($upgrade_app->ok()) {
$o = new Order();
$o->app_id = $upgrade_app->id;
$o->dt = dater();
$o->first_name = $this->order->first_name;
$o->last_name = $this->order->last_name;
$o->payer_email = $this->order->payer_email;
$o->notes = "Upgrade via Shine";
$o->type = 'Upgrade';
$o->insert();
$o->generateLicense();
return $o;
}
return null;
}
示例2: createOrder
public static function createOrder($userId, Rate $rate, $type, $volume, $price)
{
$order = new Order();
$order->setUserId($userId);
$order->setRateId($rate->getId());
$order->setType($type);
$order->setPrice($price);
$order->setVolume($volume);
$order->setDate(date("Y-m-d H:i:s"));
$order->insert();
if (!self::takePrepayment($order, $rate)) {
self::$errorMessage = 'You do not have funds';
return false;
}
$deal = self::createDealForOrder($order);
self::makeDealsWith($deal);
self::refreshRatePrices($rate);
return $order->getId();
}
示例3: foreach
foreach ($order->meals as $orderMeal) {
$n = $orderMeal['Count'];
$v = $orderMeal['VegCount'];
$itemID = $orderMeal['Meal']->ItemID;
$menuID = $orderMeal['Meal']->MenuID;
if ($menuID == '3') {
$order_weekend->add_meal($itemID, (int) $n, (int) $v, '0');
} else {
$order_weekday->add_meal($itemID, (int) $n, (int) $v, '0');
}
}
# Insert the orders
if (empty($order_weekday->meals)) {
# No weekday meals, give weekend the full cost
$order_weekend->Amounts->Total = $order->Amounts->Total;
$order_weekend->insert();
$orderID = $order_weekend->OrderID;
} else {
if (empty($order_weekend->meals)) {
# No weekend meals, give weekday the full cost
$order_weekday->Amounts->Total = $order->Amounts->Total;
$order_weekday->insert();
$orderID = $order_weekday->OrderID;
} else {
# Neither are empty, give weekday the full cost and weekend zero
$order_weekday->Amounts->Total = $order->Amounts->Total;
$order_weekday->insert();
$order_weekend->Amounts->Total = new Amount(0);
$order_weekend->insert();
$orderID = $order_weekday->OrderID;
}
示例4: header
if (empty($_POST['last_name']) || empty($_POST['first_name']) || empty($_POST['payment_gross']) || empty($_POST['transaction_id'])) {
header("HTTP/1.1 400 Missing parameter");
error_log("Incomplete POST variables – exiting.");
exit;
}
//
$app = new Application();
$app->select(7);
if (!$app->ok()) {
header("HTTP/1.1 400 Missing parameter");
error_log("Application not found!");
exit;
}
//
$o = new Order();
$o->app_id = $app->id;
$o->item_name = $app->name;
$o->dt = dater();
$o->type = 'MUPromo';
$o->first_name = $_POST['first_name'];
$o->last_name = $_POST['last_name'];
$o->payer_email = $_POST['email'];
$o->txn_id = $_POST['transaction_id'];
$o->payment_gross = preg_replace('/[^0-9.]/', '', $_POST['payment_gross']);
// custom
$o->insert();
$o->generateLicense();
//$o->emailLicense();
// return the URL
header('Content-type: text/plain', TRUE);
echo "http://updates.basil-salad.com/shine/order-retrieve.php?order_id=" . urlencode($o->id) . "&email=" . urlencode($o->payer_email) . "\n";
示例5: process
//.........这里部分代码省略.........
$objOrder->billing_firstname($_SESSION['shop']['firstname']);
$objOrder->billing_lastname($_SESSION['shop']['lastname']);
$objOrder->billing_company($_SESSION['shop']['company']);
$objOrder->billing_address($_SESSION['shop']['address']);
$objOrder->billing_city($_SESSION['shop']['city']);
$objOrder->billing_zip($_SESSION['shop']['zip']);
$objOrder->billing_country_id($_SESSION['shop']['countryId']);
$objOrder->billing_phone($_SESSION['shop']['phone']);
$objOrder->billing_fax($_SESSION['shop']['fax']);
$objOrder->billing_email($_SESSION['shop']['email']);
$objOrder->currency_id($_SESSION['shop']['currencyId']);
$objOrder->sum($_SESSION['shop']['grand_total_price']);
$objOrder->date_time(date(ASCMS_DATE_FORMAT_INTERNATIONAL_DATETIME));
$objOrder->status(0);
$objOrder->company($_SESSION['shop']['company2']);
$objOrder->gender($_SESSION['shop']['gender2']);
$objOrder->firstname($_SESSION['shop']['firstname2']);
$objOrder->lastname($_SESSION['shop']['lastname2']);
$objOrder->address($_SESSION['shop']['address2']);
$objOrder->city($_SESSION['shop']['city2']);
$objOrder->zip($_SESSION['shop']['zip2']);
$objOrder->country_id($_SESSION['shop']['countryId2']);
$objOrder->phone($_SESSION['shop']['phone2']);
$objOrder->vat_amount($_SESSION['shop']['vat_price']);
$objOrder->shipment_amount($_SESSION['shop']['shipment_price']);
$objOrder->shipment_id($shipper_id);
$objOrder->payment_id($payment_id);
$objOrder->payment_amount($_SESSION['shop']['payment_price']);
$objOrder->ip($customer_ip);
$objOrder->host($customer_host);
$objOrder->lang_id(FRONTEND_LANG_ID);
$objOrder->browser($customer_browser);
$objOrder->note($_SESSION['shop']['note']);
if (!$objOrder->insert()) {
// $order_id is unset!
return \Message::error($_ARRAYLANG['TXT_SHOP_ORDER_ERROR_STORING']);
}
$order_id = $objOrder->id();
$_SESSION['shop']['order_id'] = $order_id;
// The products will be tested one by one below.
// If any single one of them requires delivery, this
// flag will be set to true.
// This is used to determine the order status at the
// end of the shopping process.
$_SESSION['shop']['isDelivery'] = false;
// Try to redeem the Coupon, if any
$coupon_code = isset($_SESSION['shop']['coupon_code']) ? $_SESSION['shop']['coupon_code'] : null;
//\DBG::log("Cart::update(): Coupon Code: $coupon_code");
$items_total = 0;
// Suppress Coupon messages (see Coupon::available())
\Message::save();
foreach (Cart::get_products_array() as $arrProduct) {
$objProduct = Product::getById($arrProduct['id']);
if (!$objProduct) {
unset($_SESSION['shop']['order_id']);
return \Message::error($_ARRAYLANG['TXT_ERROR_LOOKING_UP_ORDER']);
}
$product_id = $arrProduct['id'];
$name = $objProduct->name();
$priceOptions = !empty($arrProduct['optionPrice']) ? $arrProduct['optionPrice'] : 0;
$quantity = $arrProduct['quantity'];
$price = $objProduct->get_custom_price(self::$objCustomer, $priceOptions, $quantity);
$item_total = $price * $quantity;
$items_total += $item_total;
$productVatId = $objProduct->vat_id();
$vat_rate = $productVatId && Vat::getRate($productVatId) ? Vat::getRate($productVatId) : '0.00';
示例6: Order
<?php
switch ($_POST['type']) {
case 0:
include_once '../admin/classes/order.class.php';
$order = new Order();
echo $order->insert($_POST['user_id']);
break;
case 1:
include_once '../admin/classes/menuorder.class.php';
$menuOrder = new MenuOrder();
$menuOrder->insert($_POST['order_id'], $_POST['menu_id'], $_POST['qty']);
echo true;
break;
}
// print_r($_POST);
示例7: user
// it will be deleted when in line 15
$_SESSION['uid'] = 2;
if (isset($_SESSION['uid'])) {
if (isset($_GET['id'])) {
$user = new user($_SESSION['uid']);
$totalPrice = $order->OrdersPrice($_SESSION['uid']);
$product = new Product($_GET['id']);
$order = new Order();
$reminder = $user->credite - ($totalPrice['sum'] + $product->price);
if ($reminder >= 0) {
$order->user_id = $_SESSION['uid'];
$order->num_items = $order->num_items + 1;
$order->desc = $product->descr;
$order->total_price = $product->price;
$order->pid = $_GET['id'];
$order->insert();
// $Q=$product->quantity - $_session['quentity'];
$Q = $product->quantity - 1;
$product->updateQ($Q);
$totalPrice = $order->OrdersPrice($_SESSION['uid']);
$_SESSION['sum'] = $totalPrice['sum'];
} else {
//make pop up window to show that user don`t have enough credite
echo "<script>alert('sorry,You don\\'t have enough credit.')</script>";
}
}
$demand = $order->userOrder($_SESSION['uid']);
//updateCart(count($demand));
}
?>
示例8: substr
$old_order = Order::select(array('menu_item_id' => substr($key, 5), 'user_id' => $order->user_id, 'date' => today()));
$menu_item = MenuItem::select(array('id' => $order->menu_item_id));
// IF THE SAME ITEM HAS BEEN ORDERED TODAY, UPDATE THE ORDER
if (is_object($old_order)) {
$old_order->quantity += $value;
//echo "<script>alert('update')</script>";
if ($old_order->update()) {
$alertArray['success'] = 'The order has been updated!';
// ADD THE COST TO TOTAL COST
$total_cost = $value * $menu_item->cost;
} else {
$alertArray['error'] = 'The items could not be ordered!';
}
} else {
//echo "<script>alert('update')</script>";
if ($order->insert()) {
$alertArray['success'] = 'The items have been added to your orders';
$total_cost = $value * $menu_item->cost;
} else {
$alertArray['error'] = 'The items could not be ordered!';
}
}
if ($total_cost != 0) {
$user = Employee::select(array('user_id' => $session->user_id));
$user->balance += $total_cost;
$user->update('user_id');
}
}
}
}
}
示例9: saveOrder
public function saveOrder()
{
$inputShipFrom = Input::get('shipFrom');
$inputShipFrom = $this->jsonToInputArray($inputShipFrom);
$inputshipTo = Input::get('shipTo');
$inputshipTo = $this->jsonToInputArray($inputshipTo);
$inputItem = Input::get('itemDetail');
$inputItem = $this->jsonToInputArray($inputItem);
$inputCompany = Input::get('companyInfo');
$inputCompany = $this->jsonToInputArray($inputCompany);
$result = array('errors' => '', 'result' => '');
$foundErrors = false;
//validate ship from info.
$shipFrom = new ShipFrom();
if ($shipFrom->validate($inputShipFrom) === false) {
$foundErrors = true;
$messages = $shipFrom->messages();
if (count($messages)) {
foreach ($messages as $message) {
$result['errors'] .= "<li>{$message}</li>";
}
}
}
//validate ship to information
$shipTo = new ShipTo();
if ($shipTo->validate($inputshipTo) === false) {
$foundErrors = true;
$messages = $shipTo->messages();
if (count($messages)) {
foreach ($messages as $message) {
$result['errors'] .= "<li>{$message}</li>";
}
}
}
//validate item information
$item = new Item();
if ($item->validate($inputItem) === false) {
$foundErrors = true;
$messages = $item->messages();
if (count($messages)) {
foreach ($messages as $message) {
$result['errors'] .= "<li>{$message}</li>";
}
}
}
//validate company information
$company = new Company();
if ($company->validate($inputCompany) === false) {
$foundErrors = true;
$messages = $company->messages();
if (count($messages)) {
foreach ($messages as $message) {
$result['errors'] .= "<li>{$message}</li>";
}
}
}
if ($foundErrors == true) {
echo json_encode($result);
return;
}
$data = array('shipFrom' => $inputShipFrom, 'shipTo' => $inputshipTo, 'item' => $inputItem, 'company' => $inputCompany);
$action = Input::get('action');
if ($action == 'update') {
$orderId = Input::get('order_id');
if (Order::update($orderId, $data) == true) {
$result['result'] = 'success';
} else {
$result['errors'] = "<li>There was a problem with record update.Please try later.</li>";
}
} else {
//create new order
$newOrderId = Order::insert($data);
if (is_numeric($newOrderId) && $newOrderId > 0) {
$result['result'] = 'success';
}
}
echo json_encode($result);
}
示例10:
// var_dump($duser);die();
$credit = $duser['credit_limit'];
// echo $credit;die();
$pric = $sprod['unit_price'];
$Upric = $pric * $qnum;
$ll = $id_product;
if ($credit >= $Upric) {
$fq = $sprod['quantity'];
// echo $fq;
// echo $qnum ;die();
if ($fq >= $qnum) {
$rescrit = $credit - $Upric;
$rem = $fq - $qnum;
$query = "update product set quantity={$rem} where id_product='{$id_product}'";
mysqli_query($conn, $query);
$query_user = "update user set credit_limit={$rescrit} where id_user='{$id_user}'";
mysqli_query($conn, $query_user);
$order->id_product = $id_product;
$order->id_user = $id_user;
$order->quantity = $qnum;
$order->unit_price = $pric;
$id_order = $order->insert();
// var_dump($order);die();
// echo "<meta http-equiv='Refresh' content='0;url=true_buy.php?img_num=$id_user' />";
echo "<meta http-equiv='Refresh' content='0;url=true_buy.php?tuser={$id_user}' />";
} else {
echo "<meta http-equiv='Refresh' content='0;url=false_credit.php?img_num={$ll}' />";
}
} else {
echo "<meta http-equiv='Refresh' content='0;url=false_buy.php?img_num={$ll}' />";
}
示例11: explode
}
if (isset($_POST["txtUpdProId"])) {
$updProId = explode(',', $_POST["txtUpdProId"]);
$q = explode(',', $_POST["txtUpdQ"]);
for ($i = 0; $i < count($updProId); $i++) {
Cart::updateItem($updProId[$i], $q[$i]);
}
}
if (isset($_POST["btnCheckout"])) {
require_once 'helper/Context.php';
$total = $_POST["txtTotal"];
$ord = new Order();
$ord->setOrderDate(new DateTime());
$ord->setTotal($total);
$ord->setUser(new User(Context::getCurrentUser()["userID"]));
$ord->insert();
foreach ($_SESSION["Cart"] as $proId => $quantity) {
$pro = Product::loadProductByProID($proId);
$amount = $pro->getPrice() * $quantity;
$detail = new OrderDetail(-1, $pro, $ord, $pro->getPrice(), $quantity, $amount);
$detail->insert();
//Cap nhap lai so luong ton
$inStock = $pro->getInStock() - $quantity;
$pro->setInStock($inStock);
$pro->updateInStock();
//Cap nhap lai so luong ban
$onOrder = $pro->getOnOrder() + $quantity;
$pro->setOnOrder($onOrder);
$pro->updateOnOrder();
}
$insert = true;
示例12: user
$customer = new user($_SESSION['user']);
if ($customer->cridetLimit >= trim($_GET['total'])) {
$err = false;
$conn = new mysqli('localhost', 'root', 'iti', 'eShop');
mysqli_autocommit($conn, false);
foreach ($_SESSION['cart'] as $pID => $q) {
$product = new Product($pID);
if ($product->pQuantity < $q) {
echo $responce = "no enough amount of " . $product->pName . " we have only " . $product->pQuantity . " of it. We are sorry for that.";
exit;
}
}
$order = new Order();
$order->uID = $_SESSION['user'];
$order->oDate = date("Y-m-d");
$oID = $order->insert();
if ($oID == false) {
$err = true;
}
$orderItem = new OrderItems();
foreach ($_SESSION['cart'] as $pID => $q) {
$orderItem->oID = $oID;
$orderItem->pID = $pID;
$orderItem->quantity = $q;
$orderItem->insert();
if ($orderItem == false) {
$err = true;
}
$product = new product($pID);
$product->pQuantity = $product->pQuantity - $q;
$product->update($pID);