/** * @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; }
/** * 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; }