当前位置: 首页>>代码示例>>PHP>>正文


PHP Order::update方法代码示例

本文整理汇总了PHP中Order::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Order::update方法的具体用法?PHP Order::update怎么用?PHP Order::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Order的用法示例。


在下文中一共展示了Order::update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: add

 public function add($autodate = true, $null_values = false)
 {
     if (!parent::add($autodate)) {
         return false;
     }
     $order = new Order((int) $this->id_order);
     // Update id_order_state attribute in Order
     $order->current_state = $this->id_order_state;
     $order->update();
     // start of implementation of the module code - taxamo
     $operation = null;
     $list_orderstateoperation = Taxamoeuvat::getListValues();
     foreach ($list_orderstateoperation as $orderstateoperation) {
         if ($orderstateoperation['id_order_state'] == $order->current_state) {
             $operation = $orderstateoperation['operation'];
         }
     }
     if (!is_null($operation)) {
         if ($operation == 1 || $operation == 2) {
             $last_id_order_transaction = Taxamoeuvat::getLastIdByOrder($order->id);
             if (is_null($last_id_order_transaction)) {
                 $res_process_store_transaction = Tools::taxamoStoreTransaction($order->id_currency, $order->id_address_invoice, $order->id_customer, $order->getCartProducts());
                 if (is_null($res_process_store_transaction['key_transaction'])) {
                     $res_process_store_transaction['comment'] .= '* Transaccion NO Adicionada';
                 } else {
                     $res_process_store_transaction['comment'] .= '* Transaccion ADICIONADA';
                 }
                 Taxamoeuvat::addTransaction($order->id, $order->current_state, $res_process_store_transaction['key_transaction'], $res_process_store_transaction['comment']);
             } else {
                 $reg_taxamo_transaction = null;
                 $reg_taxamo_transaction = Taxamoeuvat::idExistsTransaction((int) $last_id_order_transaction);
                 $res_process_store_transaction['key_transaction'] = $reg_taxamo_transaction[0]['key_transaction'];
                 $res_process_store_transaction['comment'] = '';
             }
             if ($operation == 2) {
                 if (is_null($res_process_store_transaction['key_transaction'])) {
                     $res_process_store_transaction['comment'] .= '* Transaccion NO Confirmada';
                 } else {
                     $res_process_confirm_transaction = Tools::taxamoConfirmTransaction($res_process_store_transaction['key_transaction']);
                     if (!is_null($res_process_confirm_transaction['status']) && $res_process_confirm_transaction['status'] == 'C') {
                         $res_process_store_transaction['comment'] .= '* Transaccion CONFIRMADA';
                     } else {
                         if (!empty($res_process_confirm_transaction['error'])) {
                             $res_process_store_transaction['comment'] .= $res_process_confirm_transaction['error'];
                             $res_process_store_transaction['comment'] .= '* Transaccion NO Confirmada';
                         }
                     }
                 }
                 Taxamoeuvat::addTransaction($order->id, $order->current_state, $res_process_store_transaction['key_transaction'], $res_process_store_transaction['comment']);
             }
         }
     }
     // end of code implementation module - taxamo
     Hook::exec('actionOrderHistoryAddAfter', array('order_history' => $this), null, false, true, false, $order->id_shop);
     return true;
 }
开发者ID:hjcalvo,项目名称:prestashop-taxamo-plugin,代码行数:56,代码来源:OrderHistory.php

示例2: addOrder

 /**
  * @param ShopgateOrder $order
  *
  * @return array
  * @throws PrestaShopException
  * @throws ShopgateLibraryException
  */
 public function addOrder(ShopgateOrder $order)
 {
     /**
      * check exits shopgate order
      */
     if (ShopgateOrderPrestashop::loadByOrderNumber($order->getOrderNumber())->status == 1) {
         throw new ShopgateLibraryException(ShopgateLibraryException::PLUGIN_DUPLICATE_ORDER, sprintf('external_order_id: %s', $order->getOrderNumber()), true);
     }
     /** @var CarrierCore $sgCarrier */
     $sgCarrier = new Carrier(Configuration::get('SG_CARRIER_ID'));
     if (version_compare(_PS_VERSION_, '1.5.0', '<') && empty($sgCarrier->name)) {
         $sgCarrier->name = 'shopgate_tmp_carrier';
     }
     if ($order->getShippingType() != ShopgateShipping::DEFAULT_PLUGIN_API_KEY) {
         if ($order->getShippingInfos()->getAmount() > 0) {
             if (version_compare(_PS_VERSION_, '1.5.0', '<')) {
                 ShopgateModObjectModel::updateShippingPrice(pSQL($order->getShippingInfos()->getAmount()));
             } else {
                 $data = array('price' => pSQL($order->getShippingInfos()->getAmount()));
                 $where = 'a.id_carrier = ' . (int) Configuration::get('SG_CARRIER_ID');
                 ObjectModel::updateMultishopTable('Delivery', $data, $where);
             }
             $sgCarrier->is_free = 0;
         } else {
             $sgCarrier->is_free = 1;
         }
     }
     $sgCarrier->update();
     $customerModel = new ShopgateItemsCustomerImportJson($this->getPlugin());
     $paymentModel = new ShopgatePayment($this->getModule());
     $shippingModel = new ShopgateShipping($this->getModule());
     /**
      * read / check customer
      */
     if (!($customerId = Customer::customerExists($order->getMail(), true, false))) {
         /**
          * prepare customer
          */
         $shopgateCustomerItem = new ShopgateCustomer();
         $shopgateCustomerItem->setLastName($order->getInvoiceAddress()->getLastName());
         $shopgateCustomerItem->setFirstName($order->getInvoiceAddress()->getFirstName());
         $shopgateCustomerItem->setGender($order->getInvoiceAddress()->getGender());
         $shopgateCustomerItem->setBirthday($order->getInvoiceAddress()->getBirthday());
         $shopgateCustomerItem->setNewsletterSubscription(Configuration::get('SG_SUBSCRIBE_NEWSLETTER') ? true : false);
         $customerId = $customerModel->registerCustomer($order->getMail(), md5(_COOKIE_KEY_ . time()), $shopgateCustomerItem);
     }
     /** @var CustomerCore $customer */
     $customer = new Customer($customerId);
     /**
      * prepare cart
      */
     if (!$order->getDeliveryAddress()->getPhone()) {
         $order->getDeliveryAddress()->setPhone($order->getPhone());
     }
     if (!$order->getInvoiceAddress()->getPhone()) {
         $order->getInvoiceAddress()->setPhone($order->getPhone());
     }
     $this->getCart()->id_address_delivery = $customerModel->createAddress($order->getDeliveryAddress(), $customer);
     $this->getCart()->id_address_invoice = $customerModel->createAddress($order->getInvoiceAddress(), $customer);
     $this->getCart()->id_customer = $customerId;
     // id_guest is a connection to a ps_guest entry which includes screen width etc.
     // is_guest field only exists in Prestashop 1.4.1.0 and higher
     if (version_compare(_PS_VERSION_, '1.4.1.0', '>=')) {
         $this->getCart()->id_guest = $customer->is_guest;
     }
     $this->getCart()->secure_key = $customer->secure_key;
     $this->getCart()->id_carrier = $shippingModel->getCarrierIdByApiOrder($order);
     $shopgateCustomFieldsHelper = new ShopgateCustomFieldsHelper();
     $shopgateCustomFieldsHelper->saveCustomFields($this->getCart(), $order->getCustomFields());
     $this->getCart()->add();
     /**
      * add cart items
      */
     $canCreateOrder = true;
     $errorMessages = array();
     foreach ($order->getItems() as $item) {
         list($productId, $attributeId) = ShopgateHelper::getProductIdentifiers($item);
         if ($productId == 0) {
             continue;
         }
         $updateCart = $this->getCart()->updateQty($item->getQuantity(), $productId, $attributeId, false, 'up', $this->getCart()->id_address_delivery);
         if ($updateCart !== true) {
             $canCreateOrder = false;
             $errorMessages[] = array('product_id' => $productId, 'attribute_id' => $attributeId, 'quantity' => $item->getQuantity(), 'result' => $updateCart, 'reason' => $updateCart == -1 ? 'minimum quantity not reached' : '');
         }
     }
     /**
      * coupons
      */
     foreach ($order->getExternalCoupons() as $coupon) {
         /** @var CartRuleCore $cartRule */
         $cartRule = new CartRule(CartRule::getIdByCode($coupon->getCode()));
         if (Validate::isLoadedObject($cartRule)) {
//.........这里部分代码省略.........
开发者ID:pankajshoffex,项目名称:shoffex_prestashop,代码行数:101,代码来源:Json.php

示例3: addOrder

 public function addOrder(ShopgateOrder $order)
 {
     $this->log("PS start add_order", ShopgateLogger::LOGTYPE_DEBUG);
     $shopgateOrder = PSShopgateOrder::instanceByOrderNumber($order->getOrderNumber());
     if ($shopgateOrder->id) {
         throw new ShopgateLibraryException(ShopgateLibraryException::PLUGIN_DUPLICATE_ORDER, 'external_order_id: ' . $shopgateOrder->id_order, true);
     }
     $comments = array();
     // generate products array
     $products = $this->insertOrderItems($order);
     //Get or create customer
     $id_customer = Customer::customerExists($order->getMail(), true, false);
     $customer = new Customer($id_customer ? $id_customer : (int) $order->getExternalCustomerId());
     if (!$customer->id) {
         $customer = $this->createCustomer($customer, $order);
     }
     // prepare addresses: company has to be shorten. add mobile phone / telephone
     $this->prepareAddresses($order);
     //Get invoice and delivery addresses
     $invoiceAddress = $this->getPSAddress($customer, $order->getInvoiceAddress());
     $deliveryAddress = $order->getInvoiceAddress() == $order->getDeliveryAddress() ? $invoiceAddress : $this->getPSAddress($customer, $order->getDeliveryAddress());
     //Creating currency
     $this->log("PS setting currency", ShopgateLogger::LOGTYPE_DEBUG);
     $id_currency = $order->getCurrency() ? Currency::getIdByIsoCode($order->getCurrency()) : $this->id_currency;
     $currency = new Currency($id_currency ? $id_currency : $this->id_currency);
     //Creating new cart
     $this->log("PS set cart variables", ShopgateLogger::LOGTYPE_DEBUG);
     $cart = new Cart();
     $cart->id_lang = $this->id_lang;
     $cart->id_currency = $currency->id;
     $cart->id_address_delivery = $deliveryAddress->id;
     $cart->id_address_invoice = $invoiceAddress->id;
     $cart->id_customer = $customer->id;
     if (version_compare(_PS_VERSION_, '1.4.1.0', '>=')) {
         // id_guest is a connection to a ps_guest entry which includes screen width etc.
         // is_guest field only exists in Prestashop 1.4.1.0 and higher
         $cart->id_guest = $customer->is_guest;
     }
     $cart->recyclable = 0;
     $cart->gift = 0;
     $cart->id_carrier = (int) Configuration::get('SHOPGATE_CARRIER_ID');
     $cart->secure_key = $customer->secure_key;
     $this->log("PS try to create cart", ShopgateLogger::LOGTYPE_DEBUG);
     if (!$cart->add()) {
         throw new ShopgateLibraryException(ShopgateLibraryException::PLUGIN_DATABASE_ERROR, 'Unable to create cart', true);
     }
     //Adding items to cart
     $this->log("PS adding items to cart", ShopgateLogger::LOGTYPE_DEBUG);
     foreach ($products as $p) {
         $this->log("PS cart updateQty product id: " . $p['id_product'], ShopgateLogger::LOGTYPE_DEBUG);
         $this->log("PS cart updateQty product quantity: " . $p['quantity'], ShopgateLogger::LOGTYPE_DEBUG);
         $this->log("PS cart updateQty product quantity_difference: " . $p['quantity_difference'], ShopgateLogger::LOGTYPE_DEBUG);
         $this->log("PS cart updateQty product id_product_attribute: " . $p['id_product_attribute'], ShopgateLogger::LOGTYPE_DEBUG);
         $this->log("PS cart updateQty product delivery address: " . $deliveryAddress->id, ShopgateLogger::LOGTYPE_DEBUG);
         //TODO deal with customizations
         $id_customization = false;
         if ($p['quantity'] - $p['quantity_difference'] > 0) {
             // only if the result of $p['quantity'] - $p['quantity_difference'] is higher then 0
             $cart->updateQty($p['quantity'] - $p['quantity_difference'], $p['id_product'], $p['id_product_attribute'], $id_customization, 'up', $deliveryAddress->id);
         }
         if ($p['quantity_difference'] > 0) {
             $this->log("PS try to add cart message ", ShopgateLogger::LOGTYPE_DEBUG);
             $message = new Message();
             $message->id_cart = $cart->id;
             $message->private = 1;
             $message->message = 'Warning, wanted quantity for product "' . $p['name'] . '" was ' . $p['quantity'] . ' unit(s), however, the amount in stock is ' . $p['quantity_in_stock'] . ' unit(s). Only ' . $p['quantity_in_stock'] . ' unit(s) were added to the order';
             $message->save();
         }
     }
     $id_order_state = 0;
     $shopgate = new Shopgate();
     $payment_name = $shopgate->getTranslation('Mobile Payment');
     $this->log("PS map payment method", ShopgateLogger::LOGTYPE_DEBUG);
     if (!$order->getIsShippingBlocked()) {
         $id_order_state = $this->getOrderStateId('PS_OS_PREPARATION');
         switch ($order->getPaymentMethod()) {
             case 'SHOPGATE':
                 $payment_name = $shopgate->getTranslation('Shopgate');
                 break;
             case 'PREPAY':
                 $payment_name = $shopgate->getTranslation('Bankwire');
                 $id_order_state = $this->getOrderStateId('PS_OS_BANKWIRE');
                 break;
             case 'COD':
                 $payment_name = $shopgate->getTranslation('Cash on Delivery');
                 break;
             case 'PAYPAL':
                 $payment_name = $shopgate->getTranslation('PayPal');
                 break;
             default:
                 break;
         }
     } else {
         $id_order_state = $this->getOrderStateId('PS_OS_SHOPGATE');
         switch ($order->getPaymentMethod()) {
             case 'SHOPGATE':
                 $payment_name = $shopgate->getTranslation('Shopgate');
                 break;
             case 'PREPAY':
                 $payment_name = $shopgate->getTranslation('Bankwire');
//.........这里部分代码省略.........
开发者ID:ventsiwad,项目名称:presta_addons,代码行数:101,代码来源:PSShopgatePlugin.php

示例4: add

 public function add($autodate = true, $null_values = false)
 {
     if (!parent::add($autodate)) {
         return false;
     }
     $order = new Order((int) $this->id_order);
     // Update id_order_state attribute in Order
     $order->current_state = $this->id_order_state;
     $order->update();
     Hook::exec('actionOrderHistoryAddAfter', array('order_history' => $this), null, false, true, false, $order->id_shop);
     return true;
 }
开发者ID:dev-lav,项目名称:htdocs,代码行数:12,代码来源:OrderHistory.php

示例5: _updateTable

    private function _updateTable($params, $expeditionNum, $ticketURL, $trackingURL, $id_mr_selected)
    {
        Db::getInstance()->execute('
			UPDATE `' . _DB_PREFIX_ . 'mr_selected`
			SET `MR_poids` = \'' . pSQL($params['Poids']) . '\',
					`exp_number` = \'' . pSQL($expeditionNum) . '\',
					`url_etiquette` = \'' . pSQL($ticketURL) . '\',
					`url_suivi` = \'' . pSQL($trackingURL) . '\'
			WHERE id_mr_selected = ' . (int) $id_mr_selected);
        // NDossier contains the id_order
        $order = new Order($params['NDossier']);
        // Update the database for order and orderHistory
        $order->shipping_number = $expeditionNum;
        $order->update();
        $templateVars = array('{followup}' => $trackingURL);
        $orderState = Configuration::get('PS_OS_SHIPPING') ? Configuration::get('PS_OS_SHIPPING') : _PS_OS_SHIPPING_;
        $history = new OrderHistory();
        $history->id_order = (int) $params['NDossier'];
        $history->changeIdOrderState($orderState, (int) $params['NDossier']);
        $history->id_employee = (int) Context::getContext()->employee->id;
        $history->addWithemail(true, $templateVars);
        unset($order);
        unset($history);
    }
开发者ID:ventsiwad,项目名称:presta_addons,代码行数:24,代码来源:MRCreateTickets.php

示例6: _updateTable

    private function _updateTable($params, $expeditionNum, $ticketURL, $trackingURL, $id_mr_selected)
    {
        $sql = '
			UPDATE `' . _DB_PREFIX_ . 'mr_selected`
			SET `MR_poids` = \'' . pSQL($params['Poids']) . '\',
				`MR_insurance` = \'' . pSQL($params['Assurance']) . '\',
					`exp_number` = \'' . pSQL($expeditionNum) . '\',
					`url_etiquette` = \'' . pSQL($ticketURL) . '\',
					`url_suivi` = \'' . pSQL($trackingURL) . '\'
			WHERE id_mr_selected = ' . (int) $id_mr_selected;
        Db::getInstance()->execute($sql);
        // NDossier contains the id_order
        $order = new Order($params['NDossier']);
        // Update the database for order and orderHistory
        $order->shipping_number = $expeditionNum;
        $order->update();
        if (version_compare(_PS_VERSION_, '1.5', '>=')) {
            //Retrieve Order Carrier
            $sql = 'SELECT `id_order_carrier`
					FROM `' . _DB_PREFIX_ . 'order_carrier`
					WHERE `id_order` = ' . (int) $order->id;
            $id_order_carrier = Db::getInstance()->getValue($sql);
            if ($id_order_carrier) {
                $order_carrier = new OrderCarrier((int) $id_order_carrier);
                if (Validate::isLoadedObject($order_carrier)) {
                    $order_carrier->tracking_number = pSQL($expeditionNum);
                    $order_carrier->update();
                }
            }
        }
        $templateVars = array('{followup}' => $trackingURL);
        $orderState = Configuration::get('PS_OS_SHIPPING') ? Configuration::get('PS_OS_SHIPPING') : _PS_OS_SHIPPING_;
        $history = new OrderHistory();
        $history->id_order = (int) $params['NDossier'];
        if (version_compare(_PS_VERSION_, '1.5.2', '>=')) {
            $history->changeIdOrderState((int) $orderState, $order);
        } else {
            $history->changeIdOrderState((int) $orderState, (int) $params['NDossier']);
        }
        $history->id_employee = isset(Context::getContext()->employee->id) ? (int) Context::getContext()->employee->id : '';
        $history->addWithemail(true, $templateVars);
        unset($order);
        unset($order_carrier);
        unset($history);
    }
开发者ID:studiokiwik,项目名称:mondialrelay,代码行数:45,代码来源:MRCreateTickets.php

示例7: Order

<?php

if (isset($_GET['id'])) {
    $id = (int) $_GET['id'];
    $obj = new Order($id);
}
if (Tools::isSubmit('orderStatusUpdate')) {
    $obj->id_order_status = (int) Tools::getRequest('id_order_status');
    if (strlen(trim(Tools::getRequest('track_number'))) > 0) {
        $obj->track_number = Tools::getRequest('track_number');
        Alert::send($obj->id_user, "Your order:#" . sprintf("%09d", intval($obj->id)) . " has been shipped.");
    }
    $obj->update();
    $obj->order_status = new OrderStatus((int) $obj->id_order_status);
}
$breadcrumb = new UIAdminBreadcrumb();
$breadcrumb->home();
$breadcrumb->add(array('title' => '定单 #' . sprintf("%09d", $id), 'active' => true));
$bread = $breadcrumb->draw();
$btn_group = array(array('type' => 'button', 'title' => '提交到定单系统', 'id' => 'send-to-order-system', 'class' => 'btn-success', 'icon' => 'wrench'), array('type' => 'a', 'title' => '预览', 'href' => 'index.php?rule=order_view&id=' . $obj->id, 'class' => 'btn-warning', 'icon' => 'eye-open'), array('type' => 'a', 'title' => '返回', 'href' => 'index.php?rule=order', 'class' => 'btn-primary', 'icon' => 'level-up'));
echo UIViewBlock::area(array('bread' => $bread, 'btn_groups' => $btn_group), 'breadcrumb');
?>

<div class="order_base_info">
	<div style="width: 49%; float:left;">
		<fieldset class="small">
			<legend><img src="<?php 
echo $_tmconfig['ico_dir'];
?>
tab-customers.gif">用户</legend>
			<span style="font-weight: bold; font-size: 14px;"><a href="index.php?rule=user_edit&id=<?php 
开发者ID:yiuked,项目名称:tmcart,代码行数:31,代码来源:order_edit.php

示例8: updateOrderHistory

 /**
  * Update order history status with kwixo status given
  * 
  * @param int $id_order
  * @param int $psosstatus
  */
 public function updateOrderHistory($id_order, $psosstatus)
 {
     $order = new Order((int) $id_order);
     $orderHistory = new OrderHistory();
     $orderHistory->id_order = $id_order;
     $orderHistory->id_order_state = $psosstatus;
     $orderHistory->save();
     $orderHistory->changeIdOrderState($psosstatus, $id_order);
     $orderHistory->save();
     $order->current_state = $psosstatus;
     $order->update();
 }
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:18,代码来源:kwixo.php

示例9: postProcess

 /**
  * @global object $cookie Employee cookie necessary to keep trace of his/her actions
  */
 public function postProcess()
 {
     global $currentIndex, $cookie;
     /* Update shipping number */
     if (Tools::isSubmit('submitShippingNumber') and $id_order = intval(Tools::getValue('id_order')) and Validate::isLoadedObject($order = new Order($id_order))) {
         if ($this->tabAccess['edit'] === '1') {
             if (!$order->hasBeenShipped()) {
                 die(Tools::displayError('The shipping number can only be set once the order has been shipped!'));
             }
             $_GET['view' . $this->table] = true;
             if (!($shipping_number = pSQL(Tools::getValue('shipping_number')))) {
                 $this->_errors[] = Tools::displayError('Invalid new order status!');
             } else {
                 global $_LANGMAIL;
                 $order->shipping_number = $shipping_number;
                 $order->update();
                 $customer = new Customer(intval($order->id_customer));
                 $carrier = new Carrier(intval($order->id_carrier));
                 if (!Validate::isLoadedObject($customer) or !Validate::isLoadedObject($carrier)) {
                     die(Tools::displayError());
                 }
                 $templateVars = array('{followup}' => str_replace('@', $order->shipping_number, $carrier->url), '{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{id_order}' => intval($order->id));
                 $subject = 'Package in transit';
                 Mail::Send(intval($order->id_lang), 'in_transit', (is_array($_LANGMAIL) and key_exists($subject, $_LANGMAIL)) ? $_LANGMAIL[$subject] : $subject, $templateVars, $customer->email, $customer->firstname . ' ' . $customer->lastname);
             }
         } else {
             $this->_errors[] = Tools::displayError('You do not have permission to edit anything here.');
         }
     } elseif (Tools::isSubmit('submitState') and $id_order = intval(Tools::getValue('id_order')) and Validate::isLoadedObject($order = new Order($id_order))) {
         if ($this->tabAccess['edit'] === '1') {
             $_GET['view' . $this->table] = true;
             if (!($newOrderStatusId = intval(Tools::getValue('id_order_state')))) {
                 $this->_errors[] = Tools::displayError('Invalid new order status!');
             } else {
                 $history = new OrderHistory();
                 $history->id_order = $id_order;
                 $history->changeIdOrderState(intval($newOrderStatusId), intval($id_order));
                 $history->id_employee = intval($cookie->id_employee);
                 $carrier = new Carrier(intval($order->id_carrier), intval($order->id_lang));
                 $templateVars = array('{followup}' => ($history->id_order_state == _PS_OS_SHIPPING_ and $order->shipping_number) ? str_replace('@', $order->shipping_number, $carrier->url) : '');
                 if ($history->addWithemail(true, $templateVars)) {
                     Tools::redirectAdmin($currentIndex . '&id_order=' . $id_order . '&vieworder' . '&token=' . $this->token);
                 }
                 $this->_errors[] = Tools::displayError('an error occurred while changing status or was unable to send e-mail to the customer');
             }
         } else {
             $this->_errors[] = Tools::displayError('You do not have permission to edit anything here.');
         }
     } elseif (isset($_POST['submitMessage'])) {
         $_GET['view' . $this->table] = true;
         if ($this->tabAccess['edit'] === '1') {
             if (!($id_order = intval(Tools::getValue('id_order'))) or !($id_customer = intval(Tools::getValue('id_customer')))) {
                 $this->_errors[] = Tools::displayError('an error occurred before sending message');
             } elseif (!Tools::getValue('message')) {
                 $this->_errors[] = Tools::displayError('message cannot be blank');
             } else {
                 /* Get message rules and and check fields validity */
                 $rules = call_user_func(array('Message', 'getValidationRules'), 'Message');
                 foreach ($rules['required'] as $field) {
                     if (($value = Tools::getValue($field)) == false and (string) $value != '0') {
                         if (!Tools::getValue('id_' . $this->table) or $field != 'passwd') {
                             $this->_errors[] = Tools::displayError('field') . ' <b>' . $field . '</b> ' . Tools::displayError('is required');
                         }
                     }
                 }
                 foreach ($rules['size'] as $field => $maxLength) {
                     if (Tools::getValue($field) and Tools::strlen(Tools::getValue($field)) > $maxLength) {
                         $this->_errors[] = Tools::displayError('field') . ' <b>' . $field . '</b> ' . Tools::displayError('is too long') . ' (' . $maxLength . ' ' . Tools::displayError('chars max') . ')';
                     }
                 }
                 foreach ($rules['validate'] as $field => $function) {
                     if (Tools::getValue($field)) {
                         if (!Validate::$function(htmlentities(Tools::getValue($field), ENT_COMPAT, 'UTF-8'))) {
                             $this->_errors[] = Tools::displayError('field') . ' <b>' . $field . '</b> ' . Tools::displayError('is invalid');
                         }
                     }
                 }
                 if (!sizeof($this->_errors)) {
                     $message = new Message();
                     $message->id_employee = intval($cookie->id_employee);
                     $message->message = htmlentities(Tools::getValue('message'), ENT_COMPAT, 'UTF-8');
                     $message->id_order = $id_order;
                     $message->private = Tools::getValue('visibility');
                     if (!$message->add()) {
                         $this->_errors[] = Tools::displayError('an error occurred while sending message');
                     } elseif ($message->private) {
                         Tools::redirectAdmin($currentIndex . '&id_order=' . $id_order . '&vieworder&conf=11' . '&token=' . $this->token);
                     } elseif (Validate::isLoadedObject($customer = new Customer($id_customer))) {
                         $order = new Order(intval($message->id_order));
                         if (Validate::isLoadedObject($order)) {
                             $title = html_entity_decode($this->l('New message regarding your order') . ' ' . $message->id_order, ENT_NOQUOTES, 'UTF-8');
                             $varsTpl = array('{lastname}' => $customer->lastname, '{firstname}' => $customer->firstname, '{id_order}' => $message->id_order, '{message}' => Configuration::get('PS_MAIL_TYPE') == 2 ? $message->message : nl2br2($message->message));
                             if (Mail::Send(intval($order->id_lang), 'order_merchant_comment', $title, $varsTpl, $customer->email, $customer->firstname . ' ' . $customer->lastname)) {
                                 Tools::redirectAdmin($currentIndex . '&id_order=' . $id_order . '&vieworder&conf=11' . '&token=' . $this->token);
                             }
                         }
                     }
//.........这里部分代码省略.........
开发者ID:redb,项目名称:prestashop,代码行数:101,代码来源:AdminOrders.php

示例10: Order

			</div>
		</fieldset>
		<fieldset class="buttons">
			<button type="reset">reset</button>
			<button type="submit">submit</button>
		</fieldset>
	</form>
</div>';
                }
                break;
            case "edit":
                break;
            case "view":
                if (isset($_REQUEST["target"])) {
                    $order = new Order($_REQUEST["target"]);
                    $pageBody .= '<pre>' . $order->save(RETURN_QUERY) . $order->update(RETURN_QUERY) . '</pre>';
                } else {
                    $pageBody .= Dialog(DIALOG_ERROR, 'no target specified');
                }
                break;
            case "delete":
                break;
        }
        break;
    case "agents":
        $pageBody = '<h1>agents</h1>';
        $action = "list";
        if (isset($_REQUEST["action"])) {
            $action = $_REQUEST["action"];
        }
        switch ($action) {
开发者ID:eebrah,项目名称:deliveries,代码行数:31,代码来源:index.php

示例11: Order

<?php

require_once $_SERVER['DOCUMENT_ROOT'] . "/model/order.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/model/session.php";
$id = $_POST['id'];
$orders = new Order();
$session = new Session();
$order = $orders->find('id', $id);
if ($order['user_id'] == $session->get_session_data('id')) {
    $data = ['address_id' => $_POST['address_id'], 'card_id' => $_POST['card_id'], 'status' => 2];
    if ($orders->update('id', $id, $data)) {
        header('Location: /confirmation.php');
    } else {
        print_r("Something went wrong");
    }
} else {
    print_r("Something serious went wrong");
}
开发者ID:manikanthtalasu,项目名称:restaurant-finder,代码行数:18,代码来源:confirm-payment.php

示例12: json_encode

<?php

include_once "../connection/db.php";
$json = file_get_contents('php://input');
$requests = json_decode($json, true);
$action = $requests['action'];
$email = $requests['email'];
$respose = array();
$respose["success"] = 0;
if ($action == "create") {
    $order = new Order();
    $order->create($email, $status);
} elseif ($action == "index") {
    $orders = Order . fetch();
    echo json_encode($orders);
} elseif ($action == "delete") {
    $success = Order . deletee($id);
    $respose["success"] = $success;
    echo json_encode($respose);
} else {
    $order = new Order();
    $success = $order->update($status, $id);
    $respose["success"] = $success;
    echo json_encode($respose);
}
// return response
echo json_encode($response);
开发者ID:Naimfs,项目名称:fabfresh,代码行数:27,代码来源:post_order.php

示例13: Session

<?php

require_once 'model/session.php';
require_once 'model/order.php';
require_once 'model/restaurant.php';
$session = new Session();
$order = new Order();
$restaurant = new Restaurant();
if (isset($_GET['order-id'])) {
    $getOrder = $order->find('id', $_GET['order-id']);
    $getRestaurant = $restaurant->find('id', $getOrder['restaurant_id']);
    if ($getRestaurant['owner_id'] == $session->get_session_data('id') && $session->get_session_data('user_type') == "restaurant_owner") {
        $status = intval($getOrder['status']) + 1;
        $order->update('id', $_GET['order-id'], ['status' => $status]);
        header('Location: owner-track-order.php');
    } else {
        print_r("Something went wrong");
    }
} else {
    print_r("Something went wrong");
}
开发者ID:manikanthtalasu,项目名称:restaurant-finder,代码行数:21,代码来源:next_step.php

示例14: update

<?php

$paymentObj = new Icepay_PaymentObject();
$paymentObj->setAmount(400)->setCountry("NL")->setLanguage("NL")->setIssuer('ACCEPTGIRO')->setPaymentMethod('AFTERPAY')->setReference("My Sample Website")->setDescription("My Sample Payment")->setCurrency("EUR")->setOrderID('test01');
try {
    $webservice = Icepay_Api_Webservice::getInstance()->paymentService();
    $webservice->setMerchantID(MERCHANTID)->setSecretCode(SECRETCODE);
    $transactionObj = $webservice->extendedCheckout($paymentObj);
    $orderID = $transactionObj->getOrderID();
    $order = new Order();
    // We update the user order so we know he was redirect to icepay
    $order->update($orderID, array('status' => 'USER_REDIRECTED'));
    printf('<a href="%s">%s</a>', $transactionObj->getPaymentScreenURL(), 'Pay via icepay');
} catch (Exception $e) {
    var_dump($e);
}
/**
 * Example Order Class
 */
class Order
{
    public function update($id, $attributes = array())
    {
        // Store this data somewhere
    }
}
开发者ID:pionect,项目名称:icepay,代码行数:26,代码来源:sample_webservice_track_user_step.php

示例15: index

 /**
  * Action that gets called before we interface with our payment
  * method.
  *
  * This action is responsible for setting up an order and
  * saving it into the database (as well as a session) and also then
  * generating an order summary before the user performs any final
  * actions needed.
  *
  * This action is then mapped directly to the index action of the
  * Handler for the payment method that was selected by the user
  * in the "Postage and Payment" form.
  *
  */
 public function index()
 {
     $cart = ShoppingCart::get();
     // If shopping cart doesn't exist, redirect to base
     if (!$cart->getItems()->exists() || $this->getPaymentHandler() === null) {
         return $this->redirect(Director::BaseURL());
     }
     // Get billing and delivery details and merge into an array
     $billing_data = Session::get("Commerce.BillingDetailsForm.data");
     $delivery_data = Session::get("Commerce.DeliveryDetailsForm.data");
     $postage = PostageArea::get()->byID(Session::get('Commerce.PostageID'));
     if (!$postage || !$billing_data || !$delivery_data) {
         return $this->redirect(Checkout_Controller::create()->Link());
     }
     // Work out if an order prefix string has been set in siteconfig
     $config = SiteConfig::current_site_config();
     $order_prefix = $config->OrderPrefix ? $config->OrderPrefix . '-' : '';
     // Merge billand and delivery data into an array
     $data = array_merge((array) $billing_data, (array) $delivery_data);
     // Set discount info
     $data['DiscountAmount'] = $cart->DiscountAmount();
     // Get postage data
     $data['PostageType'] = $postage->Title;
     $data['PostageCost'] = $postage->Cost;
     $data['PostageTax'] = $config->TaxRate > 0 && $postage->Cost > 0 ? (double) $postage->Cost / 100 * $config->TaxRate : 0;
     // Set status
     $data['Status'] = 'incomplete';
     // Setup an order based on the data from the shopping cart and load data
     $order = new Order();
     $order->update($data);
     // If user logged in, track it against an order
     if (Member::currentUserID()) {
         $order->CustomerID = Member::currentUserID();
     }
     // Write so we can setup our foreign keys
     $order->write();
     // Loop through each session cart item and add that item to the order
     foreach ($cart->getItems() as $cart_item) {
         $order_item = new OrderItem();
         $order_item->Title = $cart_item->Title;
         $order_item->SKU = $cart_item->SKU;
         $order_item->Price = $cart_item->Price;
         $order_item->Tax = $cart_item->Tax;
         $order_item->Customisation = serialize($cart_item->Customised);
         $order_item->Quantity = $cart_item->Quantity;
         $order_item->write();
         $order->Items()->add($order_item);
     }
     $order->write();
     // Add order to session so our payment handler can process it
     Session::set("Commerce.Order", $order);
     $this->payment_handler->setOrder($order);
     // Get gateway data
     $return = $this->payment_handler->index();
     return $this->customise($return)->renderWith(array("Payment", "Commerce", "Page"));
 }
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-commerce,代码行数:70,代码来源:Payment_Controller.php


注:本文中的Order::update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。