Jump to content

Delivery Note instead Invoice


Recommended Posts

Hello. In the account history can I put to my customer the Delivery Note (PDF) instead invoice.
I want that my customers can download the delivery note, not the invoice, Is ist possible??
Thanks, and sorry for my english.

Link to comment
Share on other sites

Hello. In the account history can I put to my customer the Delivery Note (PDF) instead invoice.
I want that my customers can download the delivery note, not the invoice, Is ist possible??
Thanks, and sorry for my english.


That would be a nice idea....

I think you should create a template for the delivery notice and then play with the history.php file.

in case the order Status ID is NOT 5 (the default delivery status ID number) then the customer should see and download the invoice & if the order status ID is 5 then he should be able to download the delivery notice.

I think this is how it should be done... but unfortunately I am not a developer to do that :red:

Hope we get some kind developers to do it.

Thanks for the idea
Link to comment
Share on other sites

I think copying the pdf-invoice.php and modifying it should work. Create a new file in the root called pdf-delivery.php containing the following:

<?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=pdf-delivery.php');
if (!intval(Configuration::get('PS_INVOICE')))
   die(Tools::displayError('invoices are disabled on this shop'));
if (isset($_GET['id_order']) AND Validate::isUnsignedId($_GET['id_order']))
   $order = new Order(intval($_GET['id_order']));
if (!isset($order) OR !Validate::isLoadedObject($order))
   die(Tools::displayError('delivery slip not found'));
elseif ($order->id_customer != $cookie->id_customer)
   die(Tools::displayError('delivery slip not found'));
elseif (!OrderState::deliveryAvailable($order->getCurrentState()) AND !$order->delivery_number)
   die(Tools::displayError('No delivery slip available'));
else
{
   $parameter = NULL;
   PDF::invoice($order, 'D', false, $parameter, false, true);
}
?>



then edit classes/OrderState.php and add this function:

static public function deliveryAvailable($id_order_state)
{
   $result = Db::getInstance()->getRow('
   SELECT `delivery` AS ok
   FROM `'._DB_PREFIX_.'order_state`
   WHERE `id_order_state` = '.intval($id_order_state));
   return $result['ok'];
}



then change lines 41-43 of history.tpl in your theme's directory from:

{if ($order.invoice AND $order.invoice_number) AND $invoiceAllowed}

{l s='PDF'}



to:

{if $order.delivery_number}

{l s='PDF'}

Link to comment
Share on other sites

Thanks, but it did not solved the problem.
I did what you said step bu step and now dont appear the page www.yourdomain.com/history.php It appear a white page, only the blocks around the page, but no information about orders.
Any solution please?????

Link to comment
Share on other sites

With the new code you gave me it work, it show the delivery note, but there is a problem, the delivery note number is DE000001 always.
Dont change the number of delivery note, the details (id order and products) are well, but the deliveris note number does not change, any solution to fix this bug????? Thanks.

Link to comment
Share on other sites

  • 1 year later...

How can I change the order status for the delivery slip?

 

So when status is set tot status with id 1 the delivery slip is also available.

 

Now the standard is that the delivery slip can only be generate when the status is set to Delivered.

 

Please help me.

Link to comment
Share on other sites

  • 1 year later...

Now the standard is that the delivery slip can only be generate when the status is set to Delivered.

 

I have the same problem. This worked correctly in the previous version. This is a major bug. can someone fix it?

Link to comment
Share on other sites

×
×
  • Create New...