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


PHP OrderCarrier::update方法代码示例

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


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

示例1: setWsShippingNumber

    public function setWsShippingNumber($shipping_number)
    {
        $id_order_carrier = Db::getInstance()->getValue('
			SELECT `id_order_carrier`
			FROM `' . _DB_PREFIX_ . 'order_carrier`
			WHERE `id_order` = ' . (int) $this->id);
        if ($id_order_carrier) {
            $order_carrier = new OrderCarrier($id_order_carrier);
            $order_carrier->tracking_number = $shipping_number;
            $order_carrier->update();
        } else {
            $this->shipping_number = $shipping_number;
        }
        return true;
    }
开发者ID:TheTypoMaster,项目名称:neotienda,代码行数:15,代码来源:NeoExchanges.php

示例2: setInvoice

    /**
     * This method allows to generate first invoice of the current order
     */
    public function setInvoice($use_existing_payment = false)
    {
        if (Configuration::get('PS_INVOICE') && !$this->hasInvoice()) {
            if ($id = (int) $this->hasDelivery()) {
                $order_invoice = new OrderInvoice($id);
            } else {
                $order_invoice = new OrderInvoice();
            }
            $order_invoice->id_order = $this->id;
            if (!$id) {
                $order_invoice->number = 0;
            }
            $address = new Address((int) $this->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
            $carrier = new Carrier((int) $this->id_carrier);
            $tax_calculator = $carrier->getTaxCalculator($address);
            $order_invoice->total_discount_tax_excl = $this->total_discounts_tax_excl;
            $order_invoice->total_discount_tax_incl = $this->total_discounts_tax_incl;
            $order_invoice->total_paid_tax_excl = $this->total_paid_tax_excl;
            $order_invoice->total_paid_tax_incl = $this->total_paid_tax_incl;
            $order_invoice->total_products = $this->total_products;
            $order_invoice->total_products_wt = $this->total_products_wt;
            $order_invoice->total_shipping_tax_excl = $this->total_shipping_tax_excl;
            $order_invoice->total_shipping_tax_incl = $this->total_shipping_tax_incl;
            $order_invoice->shipping_tax_computation_method = $tax_calculator->computation_method;
            $order_invoice->total_wrapping_tax_excl = $this->total_wrapping_tax_excl;
            $order_invoice->total_wrapping_tax_incl = $this->total_wrapping_tax_incl;
            // Save Order invoice
            $order_invoice->save();
            $this->setLastInvoiceNumber($order_invoice->id, $this->id_shop);
            $order_invoice->saveCarrierTaxCalculator($tax_calculator->getTaxesAmount($order_invoice->total_shipping_tax_excl));
            // Update order_carrier
            $id_order_carrier = Db::getInstance()->getValue('
				SELECT `id_order_carrier`
				FROM `' . _DB_PREFIX_ . 'order_carrier`
				WHERE `id_order` = ' . (int) $order_invoice->id_order . '
				AND (`id_order_invoice` IS NULL OR `id_order_invoice` = 0)');
            if ($id_order_carrier) {
                $order_carrier = new OrderCarrier($id_order_carrier);
                $order_carrier->id_order_invoice = (int) $order_invoice->id;
                $order_carrier->update();
            }
            // Update order detail
            Db::getInstance()->execute('
				UPDATE `' . _DB_PREFIX_ . 'order_detail`
				SET `id_order_invoice` = ' . (int) $order_invoice->id . '
				WHERE `id_order` = ' . (int) $order_invoice->id_order);
            // Update order payment
            if ($use_existing_payment) {
                $id_order_payments = Db::getInstance()->executeS('
					SELECT DISTINCT op.id_order_payment
					FROM `' . _DB_PREFIX_ . 'order_payment` op
					INNER JOIN `' . _DB_PREFIX_ . 'orders` o ON (o.reference = op.order_reference)
					LEFT JOIN `' . _DB_PREFIX_ . 'order_invoice_payment` oip ON (oip.id_order_payment = op.id_order_payment)
					WHERE (oip.id_order != ' . (int) $order_invoice->id_order . ' OR oip.id_order IS NULL) AND o.id_order = ' . (int) $order_invoice->id_order);
                if (count($id_order_payments)) {
                    foreach ($id_order_payments as $order_payment) {
                        Db::getInstance()->execute('
							INSERT INTO `' . _DB_PREFIX_ . 'order_invoice_payment`
							SET
								`id_order_invoice` = ' . (int) $order_invoice->id . ',
								`id_order_payment` = ' . (int) $order_payment['id_order_payment'] . ',
								`id_order` = ' . (int) $order_invoice->id_order);
                    }
                    // Clear cache
                    Cache::clean('order_invoice_paid_*');
                }
            }
            // Update order cart rule
            Db::getInstance()->execute('
				UPDATE `' . _DB_PREFIX_ . 'order_cart_rule`
				SET `id_order_invoice` = ' . (int) $order_invoice->id . '
				WHERE `id_order` = ' . (int) $order_invoice->id_order);
            // Keep it for backward compatibility, to remove on 1.6 version
            $this->invoice_date = $order_invoice->date_add;
            $this->invoice_number = $this->getInvoiceNumber($order_invoice->id);
            $this->update();
        }
    }
开发者ID:jeprodev,项目名称:jeproshop,代码行数:81,代码来源:order.php

示例3: hookNewOrder

 public function hookNewOrder($params)
 {
     $current_email = $this->context->customer->email;
     // Get value.
     $send24_consumer_key = Configuration::get('send24_consumer_key');
     $send24_consumer_secret = Configuration::get('send24_consumer_secret');
     // Get shipping value.
     $address = new Address($this->context->cart->id_address_delivery);
     $select_country = $this->express;
     // get/check Express.
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, "https://send24.com/wc-api/v3/get_products");
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_HEADER, false);
     curl_setopt($ch, CURLOPT_USERPWD, $send24_consumer_key . ":" . $send24_consumer_secret);
     curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
     $send24_countries = Tools::jsonDecode(curl_exec($ch));
     curl_close($ch);
     $n = count($send24_countries);
     for ($i = 0; $i < $n; $i++) {
         if ($send24_countries[$i]->title == $select_country) {
             $send24_product_id = $send24_countries[$i]->product_id;
             $i = $n;
             $is_available = true;
         } else {
             $is_available = false;
         }
     }
     if ($is_available == true) {
         $insurance_price = 0;
         $discount = "false";
         $ship_total = $type = $price_need = '';
         if ($select_country == $this->express) {
             $select_country = 'Danmark';
             $where_shop_id = 'ekspres';
         }
         // Create order.
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, "https://send24.com/wc-api/v3/create_order");
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         curl_setopt($ch, CURLOPT_HEADER, false);
         curl_setopt($ch, CURLOPT_POST, true);
         curl_setopt($ch, CURLOPT_USERPWD, $send24_consumer_key . ":" . $send24_consumer_secret);
         curl_setopt($ch, CURLOPT_POSTFIELDS, '
                                         {
                                         "TO_company": "' . $address->company . '",
                                         "TO_first_name": "' . $address->firstname . '",
                                         "TO_last_name": "' . $address->lastname . '",
                                         "TO_phone": "' . $address->phone . '",
                                         "TO_email": "' . $current_email . '",
                                         "TO_country": "' . $select_country . '",
                                         "TO_city": "' . $address->city . '",
                                         "TO_postcode": "' . $address->postcode . '",
                                         "Insurance" : "' . $insurance_price . '",
                                         "Weight": "5",
                                         "TO_address": "' . $address->address1 . '",
                                         "WHAT_product_id": "' . $send24_product_id . '",
                                         "WHERE_shop_id": "' . $where_shop_id . '",
                                         "discount": "' . $discount . '",
                                         "type": "' . $type . '",
                                         "need_points": "' . $price_need . '",
                                         "total": "' . $ship_total . '",
                                         "ship_mail": "' . $current_email . '",
                                         "bill_mail": "' . $current_email . '"
                                         }
                                         ');
         curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
         $response = curl_exec($ch);
         $response_order = Tools::jsonDecode($response, JSON_FORCE_OBJECT);
         if (!empty($response_order)) {
             $tracking_number = explode('?', $response_order['track']);
             $objOrder = $params['order'];
             $history = new OrderHistory();
             $history->id_order = (int) $objOrder->id;
             $order_carrier = new OrderCarrier($history->id_order);
             $order_carrier->tracking_number = $tracking_number['1'];
             Db::getInstance()->insert('send24order_value', array('id_order' => (int) $history->id_order, 'order_number' => $response_order['order_number'], 'link_to_pdf' => $response_order['link_to_pdf'], 'link_to_doc' => $response_order['link_to_doc'], 'link_to_zpl' => $response_order['link_to_zpl'], 'link_to_epl' => $response_order['link_to_epl'], 'track' => $response_order['track'], 'date_add' => date('Y-m-d H:i:s')));
             $order_carrier->update();
         }
         // Delete Carriers.
         // self::deleteCarriers();
         foreach ($this->carriers as $value) {
             $carriers = new Carrier((int) Configuration::get(self::PREFIX . $value));
             $carriers->delay = array('1' => '(viser leveringstid i dag)');
             $carriers->deleted = 0;
             $carriers->update();
         }
         curl_close($ch);
     }
     return true;
 }
开发者ID:Send24com,项目名称:Send24-for-Prestashop,代码行数:91,代码来源:send24.php

示例4: updateOrder

 private function updateOrder($id_address, $id_method, Order &$order)
 {
     $id_carrier = $this->getIdcarrierFromIdMethod($id_method);
     if ($id_carrier && Validate::isLoadedObject(new Carrier($id_carrier))) {
         if ($order->id_address_delivery != $id_address || $order->id_carrier != $id_carrier || $order->shipping_number != $this->id_shipment) {
             $order->id_address_delivery = (int) $id_address;
             $order->id_carrier = (int) $id_carrier;
             if (version_compare(_PS_VERSION_, '1.5', '>=') && ($id_order_carrier = (int) $order->getIdOrderCarrier())) {
                 $order_carrier = new OrderCarrier((int) $id_order_carrier);
                 $order_carrier->id_carrier = $order->id_carrier;
                 $order_carrier->update();
             }
             if (!$order->update()) {
                 self::$errors[] = $this->l('Order could not be updated');
                 return false;
             }
         }
         return true;
     } else {
         self::$errors[] = $this->l('Carrier does not exists. Order could not be updated.');
         return false;
     }
 }
开发者ID:remixaz,项目名称:dpdgroup,代码行数:23,代码来源:Shipment.webservice.php

示例5: renderList

 public function renderList()
 {
     $this->toolbar_title = $this->l('Order Management');
     $statuses_array = array();
     $statuses = ErpOrderState::getOrderStates((int) $this->context->language->id);
     foreach ($statuses as $status) {
         $statuses_array[$status['id_order_state']] = $status['name'];
     }
     require_once _PS_MODULE_DIR_ . 'erpillicopresta/models/ErpFeature.php';
     $this->context->smarty->assign(array('token_mr' => ModuleCore::isEnabled('mondialrelay') ? MondialRelay::getToken('back') : 'false', 'token_expeditor' => ModuleCore::isEnabled('expeditor') ? Tools::getAdminToken('AdminExpeditor' . (int) Tab::getIdFromClassName('AdminExpeditor') . (int) $this->context->employee->id) : 'false', 'id_employee' => (int) $this->context->employee->id, 'order_statuses' => $statuses_array, 'controller_status' => $this->controller_status, 'erp_feature' => ErpFeature::getFeaturesWithToken($this->context->language->iso_code), 'template_path' => $this->template_path, 'expeditor_status' => Configuration::get('EXPEDITOR_STATE_EXP'), '_module_dir_' => _MODULE_DIR_));
     $this->tpl_list_vars['has_bulk_actions'] = 'true';
     // handle may contain error messages
     $handle = Tools::getValue('handle');
     switch (trim($handle)) {
         case '':
             break;
         case 'false':
             $this->confirmations[] = $this->l('All orders have been updated') . '<br/>';
             break;
         default:
             if (!empty($handle)) {
                 // $handle = str_replace('u00e9', 'é', $handle);
                 // $handle = str_replace('u00ea', 'ê', $handle);
                 $handle = Tools::replaceAccentedChars($handle);
                 // We take note about orders with error: no valid carrier (split on order number #)
                 $orderWithoutShipping = strstr($handle, '#') != false ? true : false;
                 $errors = explode('<br/>', str_replace('#', '<br/>', $handle));
                 foreach ($errors as $key => $error) {
                     if (!empty($error)) {
                         if (!$orderWithoutShipping) {
                             $message = $error;
                         } else {
                             $message = $error;
                         }
                         $this->errors[] = Tools::displayError($message);
                     }
                 }
             }
             break;
     }
     if (Tools::getValue('linkPDF') != '' && Tools::getValue('newState') != '') {
         // if state need invoice generation
         if (ErpOrderState::invoiceAvailable(Tools::getValue('newState'))) {
             $pdf_link = new Link();
             $pdf_link = $pdf_link->getAdminLink("AdminAdvancedOrder", true) . '&submitAction=generateInvoicesPDF3&id_orders=' . Tools::getValue('linkPDF');
             $this->confirmations[] = '&nbsp;<a target="_blank" href="' . $pdf_link . '" alt="invoices">' . $this->l('Download all invoices') . '<br/></a>';
         }
         // if state need delivery slip generation
         if (ErpOrderState::deliverySlipAvailable(Tools::getValue('newState'))) {
             $pdf_link = new Link();
             $pdf_link = $pdf_link->getAdminLink("AdminAdvancedOrder", true) . '&submitAction=generateDeliverySlipsPDF2&id_orders=' . Tools::getValue('linkPDF');
             $this->confirmations[] = '&nbsp;<a target="_blank" href="' . $pdf_link . '" alt="delivery">' . $this->l('Download all delivery slip') . '<br/></a>';
         }
     }
     if (Tools::getValue('linkPDFPrint') != '') {
         if ($this->controller_status == STATUS1 && count(explode(',', Tools::getValue('linkPDFPrint'))) > ERP_ORDERFR) {
             $this->informations[] = sprintf($this->l('You are using the free version of 1-Click ERP which limits the possible number of documents to print to %d orders'), ERP_ORDERFR);
         } else {
             $invoices = '';
             $delivery = '';
             foreach (explode(',', Tools::getValue('linkPDFPrint')) as $id_order) {
                 if (ErpOrderState::invoiceAvailable(ErpOrder::getIdStateByIdOrder($id_order))) {
                     $invoices .= $id_order . ',';
                 }
                 if (ErpOrderState::deliverySlipAvailable(ErpOrder::getIdStateByIdOrder($id_order))) {
                     $delivery .= $id_order . ',';
                 }
             }
             if ($invoices != '') {
                 $pdf_link = new Link();
                 $pdf_link = $pdf_link->getAdminLink("AdminAdvancedOrder", true) . '&submitAction=generateInvoicesPDF3&id_orders=' . Tools::substr($invoices, 0, -1);
                 $this->confirmations[] = '&nbsp;<a target="_blank" href="' . $pdf_link . '" alt="invoices">' . $this->l('Download all invoices') . '</br></a>';
             }
             if ($delivery != '') {
                 $pdf_link = new Link();
                 $pdf_link = $pdf_link->getAdminLink("AdminAdvancedOrder", true) . '&submitAction=generateDeliverySlipsPDF2&id_orders=' . Tools::substr($delivery, 0, -1);
                 $this->confirmations[] = '&nbsp;<a target="_blank" href="' . $pdf_link . '" alt="delivery">' . $this->l('Download all delivery slip') . '</br></a>';
             }
             if ($invoices == '' && $delivery == '') {
                 $this->errors[] = $this->l('The selected orders have no invoice or delivery !') . '<br/>';
             }
         }
     }
     if (Tools::getValue('etiquettesMR') != '') {
         // Downlad all pdf and zip then delete and display link to zip file
         $etiquettesMR = explode(' ', Tools::getValue('etiquettesMR'));
         unset($etiquettesMR[count($etiquettesMR) - 1]);
         $zipPath = '../modules/erpillicopresta/export/mondialrelay.zip';
         $zip = new ZipArchive();
         if ($zip->open($zipPath, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE) !== true) {
             throw new Exception($this->l('Impossible to create the zip archive containing the shipping labels to Mondial Relay carrier !') . '<br/>');
         }
         foreach ($etiquettesMR as $key => $i) {
             $zip->addFromString('mondialrelay_' . $key . '.pdf', Tools::file_get_contents($i));
         }
         $zip->close();
         //Display link to dl zip file
         $this->confirmations[] = '&nbsp;<a target="_blank" href="' . $zipPath . '" alt="zip_file">' . $this->l('Download zip archive which contents all labels for Mondial Relay shipment') . '<br/></a>';
         if (Tools::getValue('deliveryNumbersMR') != '') {
             // Get all tracking numbers
//.........这里部分代码省略.........
开发者ID:prestamodule,项目名称:erpillicopresta,代码行数:101,代码来源:AdminAdvancedOrder.php

示例6: processChangeCarrier

 public function processChangeCarrier()
 {
     $id_order = (int) Tools::getValue('id_o');
     $id_new_carrier = (int) Tools::getValue('new_carrier');
     $price_incl = (double) Tools::getValue('pr_incl');
     $price_excl = (double) Tools::getValue('pr_excl');
     $order = new Order($id_order);
     $result = array();
     $result['error'] = '';
     if ($id_new_carrier == 0) {
         $result['error'] = $this->l('Error: cannot select carrier');
     } else {
         if ($order->id < 1) {
             $result['error'] = $this->l('Error: cannot find order');
         } else {
             $total_carrierwt = (double) $order->total_products_wt + (double) $price_incl;
             $total_carrier = (double) $order->total_products + (double) $price_excl;
             $order->total_paid = (double) $total_carrierwt;
             $order->total_paid_tax_incl = (double) $total_carrierwt;
             $order->total_paid_tax_excl = (double) $total_carrier;
             $order->total_paid_real = (double) $total_carrierwt;
             $order->total_shipping = (double) $price_incl;
             $order->total_shipping_tax_excl = (double) $price_excl;
             $order->total_shipping_tax_incl = (double) $price_incl;
             $order->carrier_tax_rate = (double) $order->carrier_tax_rate;
             $order->id_carrier = (int) $id_new_carrier;
             if (!$order->update()) {
                 $result['error'] = $this->l('Error: cannot update order');
                 $result['status'] = false;
             } else {
                 if ($order->invoice_number > 0) {
                     $order_invoice = new OrderInvoice($order->invoice_number);
                     $order_invoice->total_paid_tax_incl = (double) $total_carrierwt;
                     $order_invoice->total_paid_tax_excl = (double) $total_carrier;
                     $order_invoice->total_shipping_tax_excl = (double) $price_excl;
                     $order_invoice->total_shipping_tax_incl = (double) $price_incl;
                     if (!$order_invoice->update()) {
                         $result['error'] = $this->l('Error: cannot update order invoice');
                         $result['status'] = false;
                     }
                 }
                 $id_order_carrier = Db::getInstance()->getValue('
                         SELECT `id_order_carrier`
                         FROM `' . _DB_PREFIX_ . 'order_carrier`
                         WHERE `id_order` = ' . (int) $order->id);
                 if ($id_order_carrier) {
                     $order_carrier = new OrderCarrier($id_order_carrier);
                     $order_carrier->id_carrier = $order->id_carrier;
                     $order_carrier->shipping_cost_tax_excl = (double) $price_excl;
                     $order_carrier->shipping_cost_tax_incl = (double) $price_incl;
                     if (!$order_carrier->update()) {
                         $result['error'] = $this->l('Error: cannot update order carrier');
                         $result['status'] = false;
                     }
                 }
                 $result['status'] = true;
             }
         }
     }
     if ($result['status']) {
         $this->sendCarrierToYandex($order);
     }
     return $result;
 }
开发者ID:handaehan,项目名称:yandex-money-cms-prestashop,代码行数:64,代码来源:yamodule.php

示例7: setInvoice

    /**
     * This method allows to generate first invoice of the current order
     */
    public function setInvoice($use_existing_payment = false)
    {
        if (!$this->hasInvoice()) {
            $order_invoice = new OrderInvoice();
            $order_invoice->id_order = $this->id;
            $order_invoice->number = Configuration::get('PS_INVOICE_START_NUMBER');
            // If invoice start number has been set, you clean the value of this configuration
            if ($order_invoice->number) {
                Configuration::updateValue('PS_INVOICE_START_NUMBER', false);
            } else {
                $order_invoice->number = Order::getLastInvoiceNumber() + 1;
            }
            $invoice_address = new Address((int) $this->id_address_invoice);
            $carrier = new Carrier((int) $this->id_carrier);
            $tax_calculator = $carrier->getTaxCalculator($invoice_address);
            $order_invoice->total_discount_tax_excl = $this->total_discounts_tax_excl;
            $order_invoice->total_discount_tax_incl = $this->total_discounts_tax_incl;
            $order_invoice->total_paid_tax_excl = $this->total_paid_tax_excl;
            $order_invoice->total_paid_tax_incl = $this->total_paid_tax_incl;
            $order_invoice->total_products = $this->total_products;
            $order_invoice->total_products_wt = $this->total_products_wt;
            $order_invoice->total_shipping_tax_excl = $this->total_shipping_tax_excl;
            $order_invoice->total_shipping_tax_incl = $this->total_shipping_tax_incl;
            $order_invoice->shipping_tax_computation_method = $tax_calculator->computation_method;
            $order_invoice->total_wrapping_tax_excl = $this->total_wrapping_tax_excl;
            $order_invoice->total_wrapping_tax_incl = $this->total_wrapping_tax_incl;
            // Save Order invoice
            $order_invoice->add();
            $order_invoice->saveCarrierTaxCalculator($tax_calculator->getTaxesAmount($order_invoice->total_shipping_tax_excl));
            // Update order_carrier
            $id_order_carrier = Db::getInstance()->getValue('
				SELECT `id_order_carrier`
				FROM `' . _DB_PREFIX_ . 'order_carrier`
				WHERE `id_order` = ' . (int) $order_invoice->id_order . '
				AND (`id_order_invoice` IS NULL OR `id_order_invoice` = 0)');
            if ($id_order_carrier) {
                $order_carrier = new OrderCarrier($id_order_carrier);
                $order_carrier->id_order_invoice = (int) $order_invoice->id;
                $order_carrier->update();
            }
            // Update order detail
            Db::getInstance()->execute('
				UPDATE `' . _DB_PREFIX_ . 'order_detail`
				SET `id_order_invoice` = ' . (int) $order_invoice->id . '
				WHERE `id_order` = ' . (int) $order_invoice->id_order);
            // Update order payment
            if ($use_existing_payment) {
                $id_order_payments = Db::getInstance()->executeS('
					SELECT op.id_order_payment 
					FROM `' . _DB_PREFIX_ . 'order_payment` op
					INNER JOIN `' . _DB_PREFIX_ . 'orders` o ON (o.reference = op.order_reference)
					LEFT JOIN `' . _DB_PREFIX_ . 'order_invoice_payment` oip ON (oip.id_order_payment = op.id_order_payment)					
					WHERE oip.id_order_payment IS NULL AND o.id_order = ' . (int) $order_invoice->id_order);
                if (count($id_order_payments)) {
                    foreach ($id_order_payments as $order_payment) {
                        Db::getInstance()->execute('
							INSERT INTO `' . _DB_PREFIX_ . 'order_invoice_payment`
							SET
								`id_order_invoice` = ' . (int) $order_invoice->id . ',
								`id_order_payment` = ' . (int) $order_payment['id_order_payment'] . ',
								`id_order` = ' . (int) $order_invoice->id_order);
                    }
                }
            }
            // Update order cart rule
            Db::getInstance()->execute('
				UPDATE `' . _DB_PREFIX_ . 'order_cart_rule`
				SET `id_order_invoice` = ' . (int) $order_invoice->id . '
				WHERE `id_order` = ' . (int) $order_invoice->id_order);
            // Keep it for backward compatibility, to remove on 1.6 version
            $this->invoice_date = $order_invoice->date_add;
            $this->invoice_number = $order_invoice->number;
            $this->update();
        }
    }
开发者ID:rrameshsat,项目名称:Prestashop,代码行数:78,代码来源:Order.php

示例8: trackingStatus

    public static function trackingStatus($id_order, $shipping_number)
    {
        // MAIL::SEND is bugged in 1.5 !
        // http://forge.prestashop.com/browse/PNM-754 (Unresolved as of 2013-04-15)
        // Context fix (it's that easy)
        Context::getContext()->link = new Link();
        // Fix context by adding employee
        $cookie = new Cookie('psAdmin');
        Context::getContext()->employee = new Employee($cookie->id_employee);
        $o = new Order($id_order);
        $o->shipping_number = $shipping_number;
        $o->save();
        // New in 1.5
        $id_order_carrier = Db::getInstance()->getValue('
				SELECT `id_order_carrier`
				FROM `' . _DB_PREFIX_ . 'order_carrier`
				WHERE `id_order` = ' . (int) $id_order);
        $order_carrier = new OrderCarrier($id_order_carrier);
        $order_carrier->tracking_number = $shipping_number;
        $order_carrier->id_order = $id_order;
        $order_carrier->id_carrier = $o->id_carrier;
        $order_carrier->update();
        // No, there is no method in Order to retrieve the orderCarrier object(s)
        $history = new OrderHistory();
        $history->id_order = (int) $o->id;
        $history->id_order_state = _PS_OS_SHIPPING_;
        $history->changeIdOrderState(_PS_OS_SHIPPING_);
        $history->save();
        $customer = new Customer($o->id_customer);
        $carrier = new Carrier($o->id_carrier);
        $tracking_url = str_replace('@', $o->shipping_number, $carrier->url);
        $templateVars = array('{tracking_link}' => '<a href = "' . $tracking_url . '">' . $o->shipping_number . '</a>', '{tracking_code}' => $o->shipping_number, '{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{id_order}' => (int) $o->id);
        Mail::Send($o->id_lang, 'tracking', 'Tracking number for your order', $templateVars, $customer->email, $customer->firstname . ' ' . $customer->lastname, null, null, null, null, _MYDIR_ . '/mails/', true);
    }
开发者ID:rcollard,项目名称:chronopost,代码行数:34,代码来源:chronopost.php

示例9: refreshShippingCost

 /**
  * Re calculate shipping cost
  * @return object $order
  */
 public function refreshShippingCost()
 {
     if (empty($this->id)) {
         return false;
     }
     if (!Configuration::get('PS_ORDER_RECALCULATE_SHIPPING')) {
         return $this;
     }
     $fake_cart = new Cart((int) $this->id_cart);
     $new_cart = $fake_cart->duplicate();
     $new_cart = $new_cart['cart'];
     // assign order id_address_delivery to cart
     $new_cart->id_address_delivery = (int) $this->id_address_delivery;
     // assign id_carrier
     $new_cart->id_carrier = (int) $this->id_carrier;
     //remove all products : cart (maybe change in the meantime)
     foreach ($new_cart->getProducts() as $product) {
         $new_cart->deleteProduct((int) $product['id_product'], (int) $product['id_product_attribute']);
     }
     // add real order products
     foreach ($this->getProducts() as $product) {
         $new_cart->updateQty($product['product_quantity'], (int) $product['product_id']);
     }
     // get new shipping cost
     $base_total_shipping_tax_incl = (double) $new_cart->getPackageShippingCost((int) $new_cart->id_carrier, true, null);
     $base_total_shipping_tax_excl = (double) $new_cart->getPackageShippingCost((int) $new_cart->id_carrier, false, null);
     // calculate diff price, then apply new order totals
     $diff_shipping_tax_incl = $this->total_shipping_tax_incl - $base_total_shipping_tax_incl;
     $diff_shipping_tax_excl = $this->total_shipping_tax_excl - $base_total_shipping_tax_excl;
     $this->total_shipping_tax_excl = $this->total_shipping_tax_excl - $diff_shipping_tax_excl;
     $this->total_shipping_tax_incl = $this->total_shipping_tax_incl - $diff_shipping_tax_incl;
     $this->total_shipping = $this->total_shipping_tax_incl;
     $this->total_paid_tax_excl = $this->total_paid_tax_excl - $diff_shipping_tax_excl;
     $this->total_paid_tax_incl = $this->total_paid_tax_incl - $diff_shipping_tax_incl;
     $this->total_paid = $this->total_paid_tax_incl;
     $this->update();
     // save order_carrier prices, we'll save order right after this in update() method
     $order_carrier = new OrderCarrier((int) $this->getIdOrderCarrier());
     $order_carrier->shipping_cost_tax_excl = $this->total_shipping_tax_excl;
     $order_carrier->shipping_cost_tax_incl = $this->total_shipping_tax_incl;
     $order_carrier->update();
     // remove fake cart
     $new_cart->delete();
     return $this;
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:49,代码来源:Order.php


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