本文整理汇总了PHP中OrderInvoice类的典型用法代码示例。如果您正苦于以下问题:PHP OrderInvoice类的具体用法?PHP OrderInvoice怎么用?PHP OrderInvoice使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OrderInvoice类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param OrderInvoice $order_invoice
* @param $smarty
* @throws PrestaShopException
*/
public function __construct(OrderInvoice $order_invoice, $smarty)
{
$this->order_invoice = $order_invoice;
$this->order = new Order((int) $this->order_invoice->id_order);
$this->smarty = $smarty;
// header informations
$this->date = Tools::displayDate($order_invoice->date_add);
$id_lang = Context::getContext()->language->id;
$this->title = $order_invoice->getInvoiceNumberFormatted($id_lang);
$this->shop = new Shop((int) $this->order->id_shop);
}
示例2: __construct
/**
* @param OrderInvoice $order_invoice
* @param $smarty
* @throws PrestaShopException
*/
public function __construct(OrderInvoice $order_invoice, $smarty, $bulk_mode = false)
{
$this->order_invoice = $order_invoice;
$this->order = new Order((int) $this->order_invoice->id_order);
$this->smarty = $smarty;
// If shop_address is null, then update it with current one.
// But no DB save required here to avoid massive updates for bulk PDF generation case.
// (DB: bug fixed in 1.6.1.1 with upgrade SQL script to avoid null shop_address in old orderInvoices)
if (!isset($this->order_invoice->shop_address) || !$this->order_invoice->shop_address) {
$this->order_invoice->shop_address = OrderInvoice::getCurrentFormattedShopAddress((int) $this->order->id_shop);
if (!$bulk_mode) {
OrderInvoice::fixAllShopAddresses();
}
}
// header informations
$this->date = Tools::displayDate($order_invoice->date_add);
$id_lang = Context::getContext()->language->id;
$this->title = $order_invoice->getInvoiceNumberFormatted($id_lang);
$this->shop = new Shop((int) $this->order->id_shop);
}
示例3: postProcess
public function postProcess()
{
if (Tools::isSubmit('submitAdddelivery')) {
if (!Validate::isDate(Tools::getValue('date_from'))) {
$this->errors[] = Tools::displayError('Invalid \'from\' date');
}
if (!Validate::isDate(Tools::getValue('date_to'))) {
$this->errors[] = Tools::displayError('Invalid \'to\' date');
}
if (!count($this->errors)) {
if (count(OrderInvoice::getByDeliveryDateInterval(Tools::getValue('date_from'), Tools::getValue('date_to')))) {
Tools::redirectAdmin($this->context->link->getAdminLink('AdminPdf') . '&submitAction=generateDeliverySlipsPDF&date_from=' . urlencode(Tools::getValue('date_from')) . '&date_to=' . urlencode(Tools::getValue('date_to')));
} else {
$this->errors[] = Tools::displayError('No delivery slip was found for this period.');
}
}
} else {
parent::postProcess();
}
}
示例4: __construct
/**
* @param OrderInvoice $order_invoice
* @param $smarty
* @throws PrestaShopException
*/
public function __construct(OrderInvoice $order_invoice, $smarty, $bulk_mode = false)
{
$this->order_invoice = $order_invoice;
$this->order = new Order($this->order_invoice->id_order);
$this->smarty = $smarty;
// If shop_address is null, then update it with current one.
// But no DB save required here to avoid massive updates for bulk PDF generation case.
// (DB: bug fixed in 1.6.1.1 with upgrade SQL script to avoid null shop_address in old orderInvoices)
if (!isset($this->order_invoice->shop_address) || !$this->order_invoice->shop_address) {
$this->order_invoice->shop_address = OrderInvoice::getCurrentFormattedShopAddress((int) $this->order->id_shop);
if (!$bulk_mode) {
OrderInvoice::fixAllShopAddresses();
}
}
// header informations
$this->date = Tools::displayDate($order_invoice->date_add);
$prefix = Configuration::get('PS_DELIVERY_PREFIX', Context::getContext()->language->id);
$this->title = sprintf(HTMLTemplateDeliverySlip::l('%1$s%2$06d'), $prefix, $this->order_invoice->delivery_number);
// footer informations
$this->shop = new Shop((int) $this->order->id_shop);
}
示例5: applyDiscountOnInvoice
/**
* @param OrderInvoice $order_invoice
* @param float $value_tax_incl
* @param float $value_tax_excl
*/
protected function applyDiscountOnInvoice($order_invoice, $value_tax_incl, $value_tax_excl)
{
// Update OrderInvoice
$order_invoice->total_discount_tax_incl += $value_tax_incl;
$order_invoice->total_discount_tax_excl += $value_tax_excl;
$order_invoice->total_paid_tax_incl -= $value_tax_incl;
$order_invoice->total_paid_tax_excl -= $value_tax_excl;
$order_invoice->update();
}
示例6: hookDisplayPDFInvoice
/**
* Displays the delivery dates on the invoice
*
* @param $params contains an instance of OrderInvoice
* @return string
*
*/
public function hookDisplayPDFInvoice($params)
{
$order_invoice = $params['object'];
if (!$order_invoice instanceof OrderInvoice) {
return;
}
$order = new Order((int) $order_invoice->id_order);
$oos = false;
// For out of stock management
foreach ($order->getProducts() as $product) {
if ($product['product_quantity_in_stock'] < 1) {
$oos = true;
}
}
$id_carrier = (int) OrderInvoice::getCarrierId($order_invoice->id);
$return = '';
if ($datesDelivery = $this->_getDatesOfDelivery($id_carrier, $oos, $order_invoice->date_add)) {
$return = sprintf($this->l('Approximate date of delivery is between %1$s and %2$s'), $datesDelivery[0], $datesDelivery[1]);
}
return $return;
}
示例7: postProcess
public function postProcess()
{
if (Tools::getValue('submitAddinvoice_date')) {
if (!Validate::isDate(Tools::getValue('date_from'))) {
$this->errors[] = $this->l('Invalid "From" date');
}
if (!Validate::isDate(Tools::getValue('date_to'))) {
$this->errors[] = $this->l('Invalid "To" date');
}
if (!count($this->errors)) {
if (count(OrderInvoice::getByDateInterval(Tools::getValue('date_from'), Tools::getValue('date_to')))) {
Tools::redirectAdmin($this->context->link->getAdminLink('AdminPdf') . '&submitAction=generateInvoicesPDF&date_from=' . urlencode(Tools::getValue('date_from')) . '&date_to=' . urlencode(Tools::getValue('date_to')));
}
$this->errors[] = $this->l('No invoice has been found for this period.');
}
} else {
if (Tools::isSubmit('submitAddinvoice_status')) {
if (!is_array($status_array = Tools::getValue('id_order_state')) || !count($status_array)) {
$this->errors[] = $this->l('You must select at least one order status.');
} else {
foreach ($status_array as $id_order_state) {
if (count(OrderInvoice::getByStatus((int) $id_order_state))) {
Tools::redirectAdmin($this->context->link->getAdminLink('AdminPdf') . '&submitAction=generateInvoicesPDF2&id_order_state=' . implode('-', $status_array));
}
}
$this->errors[] = $this->l('No invoice has been found for this status.');
}
} else {
parent::postProcess();
}
}
}
示例8: 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 = 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->add();
$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();
}
}
示例9: getCarrier
/**
* @since 1.5
* @param $id_order_invoice
*/
public static function getCarrier($id_order_invoice)
{
$carrier = false;
if ($id_carrier = OrderInvoice::getCarrierId($id_order_invoice)) {
$carrier = new Carrier((int) $id_carrier);
}
return $carrier;
}
示例10: setShippingCost
/**
* Set the additional shipping information
*
* @param Order $order
* @param $product
*/
public function setShippingCost(Order $order, $product)
{
$tax_rate = 0;
$carrier = OrderInvoice::getCarrier((int) $this->id_order_invoice);
if (isset($carrier) && Validate::isLoadedObject($carrier)) {
$tax_rate = $carrier->getTaxesRate(new Address((int) $order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}));
}
$this->total_shipping_price_tax_excl = (double) $product['additional_shipping_cost'];
$this->total_shipping_price_tax_incl = (double) ($this->total_shipping_price_tax_excl * (1 + $tax_rate / 100));
$this->total_shipping_price_tax_incl = Tools::ps_round($this->total_shipping_price_tax_incl, 2);
}
示例11: processGenerateDeliverySlipsPDF
public function processGenerateDeliverySlipsPDF()
{
$order_invoice_collection = OrderInvoice::getByDeliveryDateInterval(Tools::getValue('date_from'), Tools::getValue('date_to'));
if (!count($order_invoice_collection)) {
die($this->trans('No invoice was found.', array(), 'Admin.OrdersCustomers.Notification'));
}
$this->generatePDF($order_invoice_collection, PDF::TEMPLATE_DELIVERY_SLIP);
}
示例12: ajaxProcessEditProductOnOrder
public function ajaxProcessEditProductOnOrder()
{
// Return value
$res = true;
$order = new Order((int) Tools::getValue('id_order'));
$order_detail = new OrderDetail((int) Tools::getValue('product_id_order_detail'));
if (Tools::isSubmit('product_invoice')) {
$order_invoice = new OrderInvoice((int) Tools::getValue('product_invoice'));
}
// Check fields validity
$this->doEditProductValidation($order_detail, $order, isset($order_invoice) ? $order_invoice : null);
// If multiple product_quantity, the order details concern a product customized
$qty_behavior = PP::qtyBehavior($order_detail, $order_detail->product_quantity) && !is_array(Tools::getValue('product_quantity'));
$product_quantity = 0;
if (is_array(Tools::getValue('product_quantity'))) {
foreach (Tools::getValue('product_quantity') as $id_customization => $qty) {
// Update quantity of each customization
Db::getInstance()->update('customization', array('quantity' => (int) $qty), 'id_customization = ' . (int) $id_customization);
// Calculate the real quantity of the product
$product_quantity += $qty;
}
} else {
$product_quantity = str_replace(',', '.', Tools::getValue('product_quantity'));
}
$product_price_tax_incl = Tools::ps_round(Tools::getValue('product_price_tax_incl'), 2);
$product_price_tax_excl = Tools::ps_round(Tools::getValue('product_price_tax_excl'), 2);
$total_products_tax_incl = PP::calcPrice($product_price_tax_incl, $qty_behavior ? $order_detail->product_quantity : $product_quantity, $qty_behavior ? $product_quantity : $order_detail->product_quantity_fractional, $order_detail->product_id);
$total_products_tax_excl = PP::calcPrice($product_price_tax_excl, $qty_behavior ? $order_detail->product_quantity : $product_quantity, $qty_behavior ? $product_quantity : $order_detail->product_quantity_fractional, $order_detail->product_id);
// Calculate differences of price (Before / After)
$diff_price_tax_incl = $total_products_tax_incl - $order_detail->total_price_tax_incl;
$diff_price_tax_excl = $total_products_tax_excl - $order_detail->total_price_tax_excl;
$ppropertiessmartprice_hook1 = null;
// Apply change on OrderInvoice
if (isset($order_invoice)) {
// If OrderInvoice to use is different, we update the old invoice and new invoice
if ($order_detail->id_order_invoice != $order_invoice->id) {
$old_order_invoice = new OrderInvoice($order_detail->id_order_invoice);
// We remove cost of products
$old_order_invoice->total_products -= $order_detail->total_price_tax_excl;
$old_order_invoice->total_products_wt -= $order_detail->total_price_tax_incl;
$old_order_invoice->total_paid_tax_excl -= $order_detail->total_price_tax_excl;
$old_order_invoice->total_paid_tax_incl -= $order_detail->total_price_tax_incl;
$res &= $old_order_invoice->update();
$order_invoice->total_products += $order_detail->total_price_tax_excl;
$order_invoice->total_products_wt += $order_detail->total_price_tax_incl;
$order_invoice->total_paid_tax_excl += $order_detail->total_price_tax_excl;
$order_invoice->total_paid_tax_incl += $order_detail->total_price_tax_incl;
$order_detail->id_order_invoice = $order_invoice->id;
}
}
if ($diff_price_tax_incl != 0 && $diff_price_tax_excl != 0) {
$order_detail->unit_price_tax_excl = $product_price_tax_excl;
$order_detail->unit_price_tax_incl = $product_price_tax_incl;
$order_detail->total_price_tax_incl += $diff_price_tax_incl;
$order_detail->total_price_tax_excl += $diff_price_tax_excl;
if (isset($order_invoice)) {
// Apply changes on OrderInvoice
$order_invoice->total_products += $diff_price_tax_excl;
$order_invoice->total_products_wt += $diff_price_tax_incl;
$order_invoice->total_paid_tax_excl += $diff_price_tax_excl;
$order_invoice->total_paid_tax_incl += $diff_price_tax_incl;
}
// Apply changes on Order
$order = new Order($order_detail->id_order);
$order->total_products += $diff_price_tax_excl;
$order->total_products_wt += $diff_price_tax_incl;
$order->total_paid += $diff_price_tax_incl;
$order->total_paid_tax_excl += $diff_price_tax_excl;
$order->total_paid_tax_incl += $diff_price_tax_incl;
$res &= $order->update();
}
$old_quantity = PP::resolveQty($order_detail->product_quantity, $order_detail->product_quantity_fractional);
if ($qty_behavior) {
$order_detail->product_quantity_fractional = $product_quantity;
} else {
$order_detail->product_quantity = $product_quantity;
}
// update taxes
$res &= $order_detail->updateTaxAmount($order);
// Save order detail
$res &= $order_detail->update();
// Update weight SUM
$order_carrier = new OrderCarrier((int) $order->getIdOrderCarrier());
if (Validate::isLoadedObject($order_carrier)) {
$order_carrier->weight = (double) $order->getTotalWeight();
$res &= $order_carrier->update();
if ($res) {
$order->weight = sprintf('%.3f ' . Configuration::get('PS_WEIGHT_UNIT'), $order_carrier->weight);
}
}
// Save order invoice
if (isset($order_invoice)) {
$res &= $order_invoice->update();
}
// Update product available quantity
StockAvailable::updateQuantity($order_detail->product_id, $order_detail->product_attribute_id, $old_quantity - PP::resolveQty($order_detail->product_quantity, $order_detail->product_quantity_fractional), $order->id_shop);
$products = $this->getProducts($order);
// Get the last product
$product = $products[$order_detail->id];
$resume = OrderSlip::getProductSlipResume($order_detail->id);
//.........这里部分代码省略.........
示例13: 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();
}
}
示例14: 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;
}
示例15: setDeliverySlip
/**
* This method allows to generate first delivery slip of the current order
*/
public function setDeliverySlip()
{
if (!$this->hasInvoice()) {
$order_invoice = new OrderInvoice();
$order_invoice->id_order = $this->id;
$order_invoice->number = 0;
$order_invoice->add();
$this->delivery_date = $order_invoice->date_add;
$this->delivery_number = $this->getDeliveryNumber($order_invoice->id);
$this->update();
}
}