本文整理汇总了PHP中order类的典型用法代码示例。如果您正苦于以下问题:PHP order类的具体用法?PHP order怎么用?PHP order使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了order类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
}
开发者ID:sheamuspy,项目名称:vendite-owner,代码行数:31,代码来源:appinventor_function.php
示例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;
}
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:10,代码来源:courier.php
示例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 "Не определено. Свяжитесь с менеджером для уточнения информации.";
}
}
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:55,代码来源:russianpost.php
示例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;
}
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:11,代码来源:orderPrice.php
示例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);
}
}
}
}
开发者ID:pixelhulk,项目名称:LEPTON,代码行数:62,代码来源:function.delete_page.php
示例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();
}
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:60,代码来源:__admin_orders.php
示例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;
}
开发者ID:bizanto,项目名称:Hooked,代码行数:18,代码来源:scpaypal.class.php
示例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}';
}
}
开发者ID:lydiakemumakinyari,项目名称:mwc_onga_group7,代码行数:19,代码来源:response.php
示例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', '发货成功');
}
开发者ID:beidouzhiguang,项目名称:wy_shop,代码行数:11,代码来源:OrderController.php
示例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;
}
开发者ID:polytechlyon-isi2,项目名称:Tacosmopolite,代码行数:10,代码来源:OrderDAO.php
示例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;
}
开发者ID:JulienRst,项目名称:Biothys-Manager,代码行数:22,代码来源:extraction.php
示例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 '';
}
}
开发者ID:wyg3958,项目名称:WebsiteBaker_CommunityEdition,代码行数:36,代码来源:functions.php
示例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;
}
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:17,代码来源:allOrdersPrices.php
示例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));
}
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:50,代码来源:__custom.php
示例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);
}
}
开发者ID:notzen,项目名称:exponent-cms,代码行数:36,代码来源:orderitem.php
示例16: order
<?php
require_once 'checkSession.php';
require_once '../model/order.php';
$order = new order($_GET["id"]);
$company = new company($order->getId_company());
$employee_ = new employee($order->getId_employee());
include '../view/order.php';
开发者ID:JulienRst,项目名称:Biothys-Manager,代码行数:8,代码来源:viewOrder.php
示例17: order
$vamTemplate->assign('company_kpp', $company['kpp']);
$vamTemplate->assign('company_ogrn', $company['ogrn']);
$vamTemplate->assign('company_okpo', $company['okpo']);
$vamTemplate->assign('company_rs', $company['rs']);
$vamTemplate->assign('company_bank_name', $company['bank_name']);
$vamTemplate->assign('company_bik', $company['bik']);
$vamTemplate->assign('company_ks', $company['ks']);
$vamTemplate->assign('company_address', $company['address']);
$vamTemplate->assign('company_yur_address', $company['yur_address']);
$vamTemplate->assign('company_fakt_address', $company['fakt_address']);
$vamTemplate->assign('company_director', $company['name']);
$vamTemplate->assign('company_accountant', $company['accountant']);
if ($_SESSION['customer_id'] == $order_check['customers_id']) {
// get order data
include DIR_WS_CLASSES . 'order.php';
$order = new order($oID);
$vamTemplate->assign('address_label_customer', vam_address_format($order->customer['format_id'], $order->customer, 1, '', '<br />'));
$vamTemplate->assign('address_label_shipping', vam_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br />'));
$vamTemplate->assign('address_label_payment', vam_address_format($order->billing['format_id'], $order->billing, 1, '', '<br />'));
$vamTemplate->assign('csID', $order->customer['csID']);
// get products data
$order_total = $order->getTotalData($oID);
$vamTemplate->assign('order_data', $order->getOrderData($oID));
$vamTemplate->assign('order_total', $order_total['data']);
$vamTemplate->assign('1', MODULE_PAYMENT_SCHET_1);
$vamTemplate->assign('2', MODULE_PAYMENT_SCHET_2);
$vamTemplate->assign('3', MODULE_PAYMENT_SCHET_3);
$vamTemplate->assign('4', MODULE_PAYMENT_SCHET_4);
$vamTemplate->assign('5', MODULE_PAYMENT_SCHET_5);
$vamTemplate->assign('6', MODULE_PAYMENT_SCHET_6);
$vamTemplate->assign('7', MODULE_PAYMENT_SCHET_7);
开发者ID:nomadcomanche,项目名称:zdorov_shop,代码行数:31,代码来源:schet.php
示例18: zen_session_destroy
$_SESSION['cart']->reset(TRUE);
zen_session_destroy();
zen_redirect(zen_href_link(FILENAME_TIME_OUT));
}
// END CC SLAM PREVENTION
if (!isset($credit_covers)) {
$credit_covers = FALSE;
}
// load selected payment module
require DIR_WS_CLASSES . 'payment.php';
$payment_modules = new payment($_SESSION['payment']);
// load the selected shipping module
require DIR_WS_CLASSES . 'shipping.php';
$shipping_modules = new shipping($_SESSION['shipping']);
require DIR_WS_CLASSES . 'order.php';
$order = new order();
// prevent 0-entry orders from being generated/spoofed
if (sizeof($order->products) < 1) {
zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
}
require DIR_WS_CLASSES . 'order_total.php';
$order_total_modules = new order_total();
$zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_BEFORE_ORDER_TOTALS_PRE_CONFIRMATION_CHECK');
if (strpos($GLOBALS[$_SESSION['payment']]->code, 'paypal') !== 0) {
$order_totals = $order_total_modules->pre_confirmation_check();
}
if ($credit_covers === TRUE) {
$order->info['payment_method'] = $order->info['payment_module_code'] = '';
}
$zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_BEFORE_ORDER_TOTALS_PROCESS');
$order_totals = $order_total_modules->process();
开发者ID:mahuidong,项目名称:doc,代码行数:31,代码来源:checkout_process.php
示例19: checkAuthentication
<?php
// Includng configuration file
include 'config/config.php';
//Check user is already login or not
checkAuthentication();
$id = $_SESSION['adminid'];
$product = new product();
$order = new order();
$cashmemo = new cashmemo();
if (isset($_GET['action']) && $_GET['action'] == 'suggestprod') {
$keyword = $_GET['keyword'];
$elementid = $_GET['id'];
$string = '';
$autosuggpro = $product->getSearchProducts($keyword);
if (is_array($autosuggpro)) {
$string .= '<ul>';
foreach ($autosuggpro as $val) {
$string .= '<li onClick="fillname(\'' . addslashes($val['name']) . '\',\'' . $elementid . '\');fillcode(\'' . addslashes($val['sku']) . '\',\'' . $elementid . '\');fillprice(\'' . addslashes($val['price']) . '\',\'' . $elementid . '\');" >' . $val['name'] . '</li>';
}
$string .= '</ul>';
} else {
$string .= '<li>No Record found</li></ul>';
}
echo $string;
exit;
} elseif (isset($_GET['action']) && $_GET['action'] == 'suggestchalan') {
$keyword = $_GET['chalan_no'];
$string = '';
$autosuggpro = $order->getChalanOrders($keyword);
if (is_array($autosuggpro)) {
开发者ID:roshanbhgt,项目名称:erp,代码行数:31,代码来源:autosuggest.php
示例20: put
/**
* 提交
*/
public function put()
{
$request_data = $this->input->post();
$total_products = 0;
$total = 0;
if (empty($request_data['order_id']) || !is_numeric($request_data['order_id'])) {
remind::set(Kohana::lang('o_global.bad_request'), request::referrer());
}
$order = Myorder::instance($request_data['order_id'])->get();
if (empty($order) || !isset($order)) {
remind::set(Kohana::lang('o_global.bad_request'), request::referrer());
}
$good_ids = $request_data['good_id'];
$prices = $request_data['discount_price'];
$amounts = $request_data['amount'];
if ($good_ids && is_array($good_ids)) {
foreach ($good_ids as $key => $val) {
$good_full_data = ProductService::get_instance()->get($val);
if (empty($good_full_data) || !isset($good_full_data)) {
remind::set(Kohana::lang('o_global.bad_request'), request::referrer());
}
if ($good_full_data['store'] == '0') {
remind::set(Kohana::lang('o_global.bad_request'), request::referrer());
}
//得到合理的价格数值
if ($good_full_data['store'] == -1 && $amounts[$key] > 999) {
$amounts[$key] = 999;
}
if ($good_full_data['store'] != -1 && $amounts[$key] > $good_full_data['store']) {
$amounts[$key] = $good_full_data['store'];
}
//$product_data = ProductService::get_instance()->get($good_full_data['product_id']);
$order_product_detail_data = array();
$order_product_detail_data['order_id'] = $order['id'];
$order_product_detail_data['product_type'] = ProductService::PRODUCT_TYPE_GOODS;
$order_product_detail_data['dly_status'] = 'storage';
//$order_product_detail_data['product_id'] = $product_data['id'];
$order_product_detail_data['good_id'] = $val;
$order_product_detail_data['quantity'] = $amounts[$key];
$order_product_detail_data['sendnum'] = '0';
$order_product_detail_data['price'] = $good_full_data['price'];
$order_product_detail_data['discount_price'] = $prices[$key];
$order_product_detail_data['weight'] = $good_full_data['weight'];
$order_product_detail_data['name'] = $good_full_data['title'];
$order_product_detail_data['SKU'] = $good_full_data['sku'];
$order_product_detail_data['brief'] = $good_full_data['brief'];
$order_product_detail_data['date_add'] = date('Y-m-d H:i:s', time());
$order_product_detail_data['link'] = product::permalink($good_full_data);
order::do_order_product_detail_data_by_good(&$order_product_detail_data, $good_full_data, $good_full_data['default_image_id']);
Myorder_product::instance()->add($order_product_detail_data);
}
//重新查询数据库,计算价格
$goods_order = Myorder_product::instance()->order_product_details(array('order_id' => $order['id']));
foreach ($goods_order as $val) {
$total_products += $val['quantity'] * $val['discount_price'];
}
$total = $total_products + $order['total_shipping'];
$total_real = round($total * 100 / $order['conversion_rate']) / 100;
$final_data = array('total' => $total, 'total_products' => $total_products, 'total_real' => $total_real);
if (Myorder::instance($order['id'])->edit($final_data)) {
remind::set(Kohana::lang('o_global.add_success'), '', 'success');
} else {
remind::set(Kohana::lang('o_global.add_error'), '', 'error');
}
} else {
remind::set(Kohana::lang('o_global.add_error'), '', 'error');
}
$this->template = new View('layout/commonfix_html');
$this->template->content = new View("order/order_product/put_goods");
$this->template->content->order = $order;
}
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:74,代码来源:order_product.php
注:本文中的order类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论