本文整理汇总了PHP中order类的典型用法代码示例。如果您正苦于以下问题:PHP order类的具体用法?PHP order怎么用?PHP order使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了order类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_transaction
function add_transaction()
{
$json_trans = $_GET['trans'];
$transaction = json_decode($json_trans);
$total = $transaction->total;
$phone_number = $transaction->phoneNumber;
$phone_number = "'" . $phone_number . "'";
$product_barcodes = $transaction->productBarcode;
include_once 'transaction.php';
$obj = new transaction();
if (!$obj->connect()) {
$json = "Failed to connect to the database.";
echo $json;
}
if ($obj->add_transaction($phone_number, $total)) {
include_once 'order.php';
$order_obj = new order();
$order_obj->connect();
$trans_id = $obj->get_insert_id();
$order_obj->add_orders($trans_id, $product_barcodes);
if ($total > 500) {
// $message = "You have a 10% discount the next time you purchase.";
// send_smsgh($phone_number, $message);
}
$json = "The transaction was added.";
echo $json;
} else {
$json = "The transaction was not added.";
echo $json;
}
}
示例2: getDeliveryPrice
public function getDeliveryPrice(order $order)
{
$deliveryPrice = $this->object->price;
$minOrderPrice = $this->object->order_min_price;
if (is_null($minOrderPrice)) {
return $deliveryPrice;
}
$orderPrice = $order->getActualPrice() - $order->getDeliveryPrice();
return $orderPrice < $minOrderPrice ? $deliveryPrice : 0;
}
示例3: getDeliveryPrice
public function getDeliveryPrice(order $order)
{
$objects = umiObjectsCollection::getInstance();
$deliveryAddress = $objects->getObject($order->delivery_address);
if (!$deliveryAddress) {
return "Невозможно автоматически определить стоимость";
}
$orderPrice = $order->getActualPrice();
$weight = 0;
$items = $order->getItems();
foreach ($items as $item) {
$element = $item->getItemElement();
$itemWeight = (int) $element->getValue("weight");
if ($itemWeight != 0) {
$weight += $itemWeight * $item->getAmount();
} else {
return "Невозможно автоматически определить стоимость";
}
}
$viewPost = $objects->getObject($this->object->viewpost)->getValue("identifier");
if ($viewPost == 44 || $viewPost == 45) {
$weight = $weight / 1000;
$departureCity = $objects->getObject($this->object->departure_city);
$departureCity = $departureCity instanceof umiObject ? $departureCity->getName() : "Москва";
$city = $deliveryAddress->getValue("city");
$response = $this->calculateSumEMS($price, $departureCity, $city, $weight, $min, $max, $flag);
if ($flag == 'ok') {
$price = $response->price;
$min = $response->term->min;
$max = $response->term->max;
$flag = " {$price} руб. (займет от {$min} до {$max} дней)";
}
return $flag;
} else {
$typePost = $objects->getObject($this->object->typepost)->getValue("identifier");
$value = $this->object->setpostvalue ? ceil($order->getActualPrice()) : 0;
$zip = $deliveryAddress->getValue("index");
$url = "http://www.russianpost.ru/autotarif/Autotarif.aspx?viewPost={$viewPost}&countryCode=643&typePost={$typePost}&weight={$weight}&value1={$value}&postOfficeId={$zip}";
$content = umiRemoteFileGetter::get($url);
if (preg_match("/<input id=\"key\" name=\"key\" value=\"(\\d+)\"\\/>/i", $content, $match)) {
$key = trim($match[1]);
$content = umiRemoteFileGetter::get($url, false, array('Content-type' => 'application/x-www-form-urlencoded'), array('key' => $key));
$content = umiRemoteFileGetter::get($url);
}
if (preg_match("/span\\s+id=\"TarifValue\">([^<]+)<\\/span/i", $content, $match)) {
$price = floatval(str_replace(",", ".", trim($match[1])));
if ($price > 0) {
return $price;
} elseif (preg_match("/span\\s+id=\"lblErrStr\">([^<]+)<\\/span/i", $content, $match)) {
return $match[1];
}
}
return "Не определено. Свяжитесь с менеджером для уточнения информации.";
}
}
示例4: validateOrder
public function validateOrder(order $order)
{
$orderPrice = $order->getOriginalPrice();
if ($this->minimum && $orderPrice < $this->minimum) {
return false;
}
if ($this->maximum && $orderPrice > $this->maximum) {
return false;
}
return true;
}
示例5: delete_page
/**
* delete a page
*
* @access public
* @param integer $page_id
* @return void
*
**/
function delete_page($page_id)
{
global $admin, $database, $MESSAGE;
// Find out more about the page
$page_info = array();
$database->execute_query('SELECT `link`, `parent` FROM `' . TABLE_PREFIX . 'pages` WHERE `page_id` = ' . $page_id, true, $page_info, false);
if ($database->is_error()) {
$admin->print_error($database->get_error());
}
if (count($page_info) == 0) {
$admin->print_error($MESSAGE['PAGES_NOT_FOUND']);
}
// Get the sections that belong to the page
$all_sections = array();
$database->execute_query('SELECT `section_id`, `module` FROM `' . TABLE_PREFIX . 'sections` WHERE `page_id` = ' . $page_id, true, $all_sections);
foreach ($all_sections as &$section) {
// Set section id
$section_id = $section['section_id'];
// Include the modules delete file if it exists
if (file_exists(LEPTON_PATH . '/modules/' . $section['module'] . '/delete.php')) {
include LEPTON_PATH . '/modules/' . $section['module'] . '/delete.php';
}
}
// Update the pages table
$sql = 'DELETE FROM `' . TABLE_PREFIX . 'pages` WHERE `page_id` = ' . $page_id;
$database->query($sql);
if ($database->is_error()) {
$admin->print_error($database->get_error());
}
// Update the sections table
$sql = 'DELETE FROM `' . TABLE_PREFIX . 'sections` WHERE `page_id` = ' . $page_id;
$database->query($sql);
if ($database->is_error()) {
$admin->print_error($database->get_error());
}
// Include the ordering class or clean-up ordering
include_once LEPTON_PATH . '/framework/class.order.php';
$order = new order(TABLE_PREFIX . 'pages', 'position', 'page_id', 'parent');
$order->clean($page_info['parent']);
// Unlink the page access file and directory
$directory = LEPTON_PATH . PAGES_DIRECTORY . $page_info['link'];
$filename = $directory . PAGE_EXTENSION;
$directory .= '/';
if (file_exists($filename)) {
if (!is_writable(LEPTON_PATH . PAGES_DIRECTORY . '/')) {
$admin->print_error($MESSAGE['PAGES_CANNOT_DELETE_ACCESS_FILE']);
} else {
unlink($filename);
if (file_exists($directory) && rtrim($directory, '/') != LEPTON_PATH . PAGES_DIRECTORY && $page_info['link'][0] != '.') {
rm_full_dir($directory);
}
}
}
}
示例6: order_edit
public function order_edit()
{
$object = $this->expectObject("param0", true);
$mode = (string) getRequest('param1');
$objectId = $object->getId();
$this->setHeaderLabel("header-users-edit-" . $this->getObjectTypeMethod($object));
$this->checkSv($objectId);
$inputData = array("object" => $object, "allowed-element-types" => array('emarket', 'order'));
if ($mode == "do") {
$oldDeliveryPrice = $object->getValue('delivery_price');
$object = $this->saveEditedObjectData($inputData);
$newDeliveryPrice = $object->getValue('delivery_price');
$order = order::get($object->id);
$amounts = getRequest('order-amount-item');
$dels = getRequest('order-del-item');
$isChanged = false;
if (is_array($amounts)) {
foreach ($amounts as $itemId => $amount) {
$item = $order->getItem($itemId);
if ($item instanceof orderItem) {
if ($item->getAmount() != $amount) {
$item->setAmount($amount);
$item->commit();
$isChanged = true;
}
}
}
}
if (is_array($dels)) {
foreach ($dels as $itemId) {
$item = orderItem::get($itemId);
if ($item instanceof orderItem) {
$order->removeItem($item);
$isChanged = true;
}
}
}
if ($isChanged) {
$order->refresh();
$order->commit();
}
if ($oldDeliveryPrice != $newDeliveryPrice && !$isChanged) {
$originalPrice = $object->getValue('total_original_price');
$totalPrice = $originalPrice;
$discount = $order->getDiscount();
if ($discount instanceof discount) {
$totalPrice = $discount->recalcPrice($originalPrice);
}
$totalPrice += $newDeliveryPrice;
$object->setValue('total_price', $totalPrice);
$object->commit();
}
$this->chooseRedirect();
}
$this->setDataType("form");
$this->setActionType("modify");
$data = $this->prepareData($inputData, "object");
$this->setData($data);
return $this->doData();
}
示例7: returnsuccess
function returnsuccess()
{
// mandatory function
$orderid = JRequest::getVar("custom");
// orderid coming back from PP
$txn_id = JRequest::getVar("txn_id");
// pp transaction ID
$cfg = new sc_configuration();
$statuses = explode("\r\n", $cfg->get("ostatus"));
$status = $statuses[count($statuses) - 1];
// set the status to the last one in the list
$scorder = new order();
$scorder->load($orderid);
$scorder->ordercode = $txn_id;
$scorder->status = $status;
$scorder->store();
return;
}
示例8: viewHistory
function viewHistory()
{
include "order.php";
$obj = new order();
if ($obj->viewHistory()) {
$row = $obj->fetch();
echo '{"result":1,"history":[';
while ($row) {
echo json_encode($row);
$row = $obj->fetch();
if ($row) {
echo ",";
}
}
echo "]}";
} else {
echo '{"result":0}';
}
}
示例9: update
public function update(Request $request, $id)
{
$order = order::find($id);
$order->express_code = $request->express_code;
//只有当前在未发货状态下,才修改订单状态
if ($order->status == 1) {
$order->status = 2;
}
$order->save();
return back()->with('info', '发货成功');
}
示例10: buildDomainObject
protected function buildDomainObject($row)
{
$order = new order();
$order->setId($row['cart_id']);
$order->setTacosId($row['tacos_id']);
$order->setTacosName($row['tacos_name']);
$order->setNumber($row['cart_number']);
$order->setPrice($row['tacos_price'] * $row['cart_number']);
return $order;
}
示例11: getOrdersFactured
public function getOrdersFactured($deb_a, $end_a)
{
$deb = DateTime::createFromFormat('d-m-y', $deb_a)->getTimestamp();
$end = DateTime::createFromFormat('d-m-y', $end_a)->getTimestamp();
$stmt = $this->pdo->PDOInstance->prepare("SELECT id FROM `order` WHERE ref != 0 and date_billing > :deb and date_billing < :end");
$stmt->bindParam(':deb', $deb);
$stmt->bindParam(':end', $end);
try {
$stmt->execute();
} catch (Exception $e) {
echo "Problem at " . $e->getLine() . " from model Extraction :" . $e->getMessage();
}
$orders = $stmt->fetchAll(PDO::FETCH_ASSOC);
$results = array();
foreach ($orders as $line) {
$order = new order($line["id"]);
if ($order->getAlready_paid() < $order->getPrice()) {
array_push($results, $order);
}
}
return $results;
}
示例12: topics_move_topic
function topics_move_topic($movetopic)
{
global $database;
global $admin;
//global $queryextra;
global $page_id;
global $section_id;
global $picture_dir;
global $restrict2picdir;
$mod_dir = basename(dirname(__FILE__));
$tablename = $mod_dir;
//change page_id and section_id to get back to new page!
$query_sections = $database->query("SELECT section_title, page_id, picture_dir FROM `" . TABLE_PREFIX . "mod_" . $tablename . "_settings` WHERE section_id = '" . $movetopic . "'");
if ($query_sections->numRows() > 0) {
$sections_fetch = $query_sections->fetchRow();
$newpicture_dir = $sections_fetch['picture_dir'];
if ($restrict2picdir > 0 and $newpicture_dir != $picture_dir) {
die('No Permission');
}
//Hier muss überprüft werden, ob der User überhaupt in die andere Section speichern darf.
if (!$admin->get_page_permission($sections_fetch['page_id'])) {
die('No Permission');
}
//------------------------------------------------------------
$section_id = $movetopic;
$page_id = $sections_fetch['page_id'];
$section_title = $sections_fetch['section_title'];
$order = new order(TABLE_PREFIX . 'mod_' . $tablename, 'position', 'topic_id', 'section_id');
$position = $order->get_new($section_id);
$qextra = ", page_id = '{$page_id}', section_id = '{$section_id}', position = '{$position}'";
echo "<p>Save it in " . $section_title . '</p>';
return $qextra;
} else {
return '';
}
}
示例13: getCustomerOrders
protected function getCustomerOrders()
{
static $customerOrders = null;
if (!is_null($customerOrders)) {
return $customerOrders;
}
$customer = customer::get();
$cmsController = cmsController::getInstance();
$domain = $cmsController->getCurrentDomain();
$domainId = $domain->getId();
$sel = new selector('objects');
$sel->types('object-type')->name('emarket', 'order');
$sel->where('customer_id')->equals($customer->id);
$sel->where('domain_id')->equals($domainId);
$sel->where('status_id')->equals(order::getStatusByCode('ready'));
return $customerOrders = $sel->result;
}
示例14: show_user_orders
/**
* Функция рисует список заказов пользователя
* @param string $template Название шаблона
* @return mixed Список заказов пользователя
*/
public function show_user_orders($template = 'default')
{
list($tpl_block, $tpl_block_empty, $tpl_item, $tpl_order_item) = def_module::loadTemplates("emarket/" . $template, 'orders_block', 'orders_block_empty', 'orders_item', 'orders_order_item');
$cmsController = cmsController::getInstance();
$domain = $cmsController->getCurrentDomain();
$domainId = $domain->getId();
$sel = new selector('objects');
$sel->types('object-type')->name('emarket', 'order');
$sel->where('customer_id')->equals(customer::get()->id);
$sel->where('name')->isNull(false);
$sel->where('domain_id')->equals($domainId);
if ($sel->length == 0) {
$tpl_block = $tpl_block_empty;
}
$items_arr = array();
foreach ($sel->result as $selOrder) {
$order = order::get($selOrder->id);
$item_arr['attribute:id'] = $order->id;
$item_arr['attribute:name'] = $order->name;
$item_arr['attribute:type-id'] = $order->typeId;
$item_arr['attribute:guid'] = $order->GUID;
$item_arr['attribute:type-guid'] = $order->typeGUID;
$item_arr['attribute:ownerId'] = $order->ownerId;
$item_arr['xlink:href'] = $order->xlink;
$item_arr['attribute:delivery_allow_date'] = date('d.m.Y', $order->getValue('delivery_allow_date')->timestamp);
//print_r($order->getValue('order_items'));
//Получаем список товаров заказа
$items = array();
foreach ($order->getItems() as $orderItem) {
// print_r($order_item); die;
$item_line = array();
// print_r(umiHierarchy::getInstance()->getObjectInstances($orderItem->id));
$item_line['attribute:element_id'] = $orderItem->id;
$item_line['attribute:name'] = $orderItem->name;
$item_line['attribute:item_amount'] = $orderItem->getAmount();
// $item_line['attribute:options'] = $orderItem->getOptions();
// print_r($order_item->options);
$items[] = def_module::parseTemplate($tpl_order_item, $item_line, false, $iOrderItemId);
umiObjectsCollection::getInstance()->unloadObject($iOrderItemId);
}
$item_arr['subnodes:order_items'] = $items;
$items_arr[] = def_module::parseTemplate($tpl_item, $item_arr, false, $order->id);
}
return def_module::parseTemplate($tpl_block, array('subnodes:items' => $items_arr));
}
示例15: __construct
function __construct($params = array(), $get_assoc = true, $get_attached = false)
{
global $db, $user;
if (!empty($params['id']) || is_numeric($params)) {
parent::__construct($params, $get_assoc, $get_attached);
$prodtype = $this->product_type;
$this->product = new $prodtype($this->product_id, false, true);
} elseif (isset($params['product_id']) && isset($params['product_type'])) {
// see if this is an existing item in the cart
if (isset($params['orderid'])) {
$order = new order($params['orderid']);
} else {
$order = order::getUserCart();
}
//adding lookup on price to acocomdate quantity discounts
$where = 'orders_id=' . $order->id . ' AND product_id=' . $params['product_id'] . ' AND products_price=' . $params['products_price'] . " AND product_type='" . $params['product_type'] . "'";
$where .= empty($params['options']) ? '' : " AND options='" . $params['options'] . "'";
$where .= empty($params['user_input_fields']) ? '' : " AND user_input_fields='" . $params['user_input_fields'] . "'";
$item = $db->selectObject($this->table, $where);
$this->product = new $params['product_type']($params['product_id'], false, true);
if (empty($item)) {
parent::__construct(array('orders_id' => $order->id, 'user_id' => $user->id, 'product_id' => $this->product->id, 'product_type' => $params['product_type'], 'products_name' => $this->product->title, 'products_price' => $this->product->getBasePrice()), $get_assoc, $get_attached);
} else {
parent::__construct($item->id, $get_assoc, $get_attached);
//$this->quantity = $this->product->incrementQuantity($this->quantity);
}
} else {
parent::__construct(null, $get_assoc, $get_attached);
}
if (isset($this->options)) {
$this->opts = expUnserialize($this->options);
}
if (!empty($this->user_input_fields)) {
//$this->user_input_fields = expUnserialize($this->user_input_fields);
}
}