示例#1
0
 public function processGenerateOrderSlipPDF()
 {
     $order_slip = new OrderSlip((int) Tools::getValue('id_order_slip'));
     $order = new Order((int) $order_slip->id_order);
     if (!Validate::isLoadedObject($order)) {
         die($this->trans('The order cannot be found within your database.', array(), 'Admin.OrdersCustomers.Notification'));
     }
     $order->products = OrderSlip::getOrdersSlipProducts($order_slip->id, $order);
     $this->generatePDF($order_slip, PDF::TEMPLATE_ORDER_SLIP);
 }
 public function processGenerateOrderSlipPDF()
 {
     $order_slip = new OrderSlip((int) Tools::getValue('id_order_slip'));
     $order = new Order((int) $order_slip->id_order);
     if (!Validate::isLoadedObject($order)) {
         die(Tools::displayError('The order cannot be found within your database.'));
     }
     $order->products = OrderSlip::getOrdersSlipProducts($order_slip->id, $order);
     $this->generatePDF($order_slip, PDF::TEMPLATE_ORDER_SLIP);
 }
示例#3
0
function generateOrderSlipPDF()
{
    $orderSlip = new OrderSlip((int) $_GET['id_order_slip']);
    $order = new Order((int) $orderSlip->id_order);
    if (!Validate::isLoadedObject($order)) {
        die(Tools::displayError('Cannot find order in database'));
    }
    $order->products = OrderSlip::getOrdersSlipProducts($orderSlip->id, $order);
    $tmp = NULL;
    PDF::invoice($order, 'D', false, $tmp, $orderSlip);
}
 public function __construct(OrderSlip $order_slip, $smarty)
 {
     $this->order_slip = $order_slip;
     $this->order = new Order((int) $order_slip->id_order);
     $products = OrderSlip::getOrdersSlipProducts($this->order_slip->id, $this->order);
     $customized_datas = Product::getAllCustomizedDatas((int) $this->order->id_cart);
     Product::addCustomizationPrice($products, $customized_datas);
     $this->order->products = $products;
     $this->smarty = $smarty;
     // header informations
     $this->date = Tools::displayDate($this->order_slip->date_add);
     $this->title = HTMLTemplateOrderSlip::l('Order slip #') . Configuration::get('PS_CREDIT_SLIP_PREFIX', Context::getContext()->language->id) . sprintf('%06d', (int) $this->order_slip->id);
     // footer informations
     $this->shop = new Shop((int) $this->order->id_shop);
 }
 public function __construct(OrderSlip $order_slip, $smarty)
 {
     $this->order_slip = $order_slip;
     $this->order = new Order((int) $order_slip->id_order);
     $products = OrderSlip::getOrdersSlipProducts($this->order_slip->id, $this->order);
     $customized_datas = Product::getAllCustomizedDatas((int) $this->order->id_cart);
     Product::addCustomizationPrice($products, $customized_datas);
     $this->order->products = $products;
     $this->smarty = $smarty;
     // header informations
     $this->date = Tools::displayDate($this->order->invoice_date, (int) $this->order->id_lang);
     $this->title = HTMLTemplateOrderSlip::l('Slip #') . sprintf('%06d', (int) $this->order_slip->id);
     // footer informations
     $this->shop = new Shop((int) $this->order->id_shop);
 }
示例#6
0
 /**
  * @param OrderSlip $order_slip
  * @param $smarty
  * @throws PrestaShopException
  */
 public function __construct(OrderSlip $order_slip, $smarty)
 {
     $this->order_slip = $order_slip;
     $this->order = new Order((int) $order_slip->id_order);
     $this->id_cart = $this->order->id_cart;
     $products = OrderSlip::getOrdersSlipProducts($this->order_slip->id, $this->order);
     foreach ($products as $product) {
         $customized_datas = Product::getAllCustomizedDatas($this->id_cart, null, true, null, (int) $product['id_customization']);
         Product::addProductCustomizationPrice($product, $customized_datas);
     }
     $this->order->products = $products;
     $this->smarty = $smarty;
     // header informations
     $this->date = Tools::displayDate($this->order_slip->date_add);
     $prefix = Configuration::get('PS_CREDIT_SLIP_PREFIX', Context::getContext()->language->id);
     $this->title = sprintf(HTMLTemplateOrderSlip::l('%1$s%2$06d'), $prefix, (int) $this->order_slip->id);
     $this->shop = new Shop((int) $this->order->id_shop);
 }
示例#7
0
if (isset($_GET['pdf'])) {
    if (!isset($_GET['id_order'])) {
        die(Tools::displayError('order ID is missing'));
    }
    $order = new Order(intval($_GET['id_order']));
    if (!Validate::isLoadedObject($order)) {
        die(Tools::displayError('cannot find order in database'));
    }
    PDF::invoice($order);
} elseif (isset($_GET['id_order_slip'])) {
    $orderSlip = new OrderSlip(intval($_GET['id_order_slip']));
    $order = new Order(intval($orderSlip->id_order));
    if (!Validate::isLoadedObject($order)) {
        die(Tools::displayError('cannot find order in database'));
    }
    $order->products = OrderSlip::getOrdersSlipProducts($orderSlip->id, $order);
    $tmp = NULL;
    PDF::invoice($order, 'D', false, $tmp, $orderSlip);
} elseif (isset($_GET['id_delivery'])) {
    $order = Order::getByDelivery(intval($_GET['id_delivery']));
    if (!Validate::isLoadedObject($order)) {
        die(Tools::displayError('cannot find order in database'));
    }
    $tmp = NULL;
    PDF::invoice($order, 'D', false, $tmp, false, $order->delivery_number);
} elseif (isset($_GET['invoices'])) {
    $invoices = Order::getOrdersIdInvoiceByDate($_GET['date_from'], $_GET['date_to'], NULL, 'invoice');
    if (is_array($invoices)) {
        PDF::multipleInvoices($invoices);
    }
} elseif (isset($_GET['deliveryslips'])) {
示例#8
0
 public static function multipleOrderSlips($orderSlips)
 {
     $pdf = new PDF('P', 'mm', 'A4');
     foreach ($orderSlips as $id_order_slip) {
         $orderSlip = new OrderSlip((int) $id_order_slip);
         $order = new Order((int) $orderSlip->id_order);
         $order->products = OrderSlip::getOrdersSlipProducts($orderSlip->id, $order);
         if (Validate::isLoadedObject($orderSlip) and Validate::isLoadedObject($order)) {
             PDF::invoice($order, 'D', true, $pdf, $orderSlip);
         }
     }
     return $pdf->Output('order_slips.pdf', 'D');
 }
示例#9
0
<?php

include dirname(__FILE__) . '/config/config.inc.php';
include dirname(__FILE__) . '/init.php';
$cookie = new Cookie('ps');
if (!$cookie->isLogged()) {
    Tools::redirect('authentication.php?back=order-follow.php');
}
if (isset($_GET['id_order_slip']) and Validate::isUnsignedId($_GET['id_order_slip'])) {
    $orderSlip = new OrderSlip(intval($_GET['id_order_slip']));
}
if (!isset($orderSlip) or !Validate::isLoadedObject($orderSlip)) {
    die(Tools::displayError('order return not found'));
} elseif ($orderSlip->id_customer != $cookie->id_customer) {
    die(Tools::displayError('order return not found'));
}
$order = new Order(intval($orderSlip->id_order));
if (!Validate::isLoadedObject($order)) {
    die(Tools::displayError('order not found'));
}
$order->products = OrderSlip::getOrdersSlipProducts(intval($orderSlip->id), $order);
$ref = NULL;
PDF::invoice($order, 'D', false, $ref, $orderSlip);