Jump to content

invoice, delivery and order number are not the same?


Recommended Posts

I’m just wondering if there is a way to make the order number, invoice number and delivery slip number the same?

at the minute they all auto-increment at their own pace, which means if they will only stay in order if I generate the documents in the exact order that the orders were placed. This isn’t convinient, as some orders are ready before others.

Is there no way to make all the document numbers the same? so:

order #1 has an invoice #1 and delivery slip #1

at the minute I have:

order #60 has invoice #61 and delivery #59

Thanks!

Link to comment
Share on other sites

  • 2 months later...
  • 2 weeks later...

I think that it is nature to have different order/invoice/delivery numbers. I can understand that current PrestaShop is doing correct job. Think of some order may have more than one delivery(even it is rare to some store owner, but it happens).

If you really want to make all those numbers to be the same, you have an option to do so in following way.
The point is:
1. Keep invoice/delivery ID as it is in database
2. Use order # for other (invoice/delivery) numbers when display on UI or generate PDF document.

This approach is not recommended, but doable with some code changes.

Link to comment
Share on other sites

  • 1 month later...

for me work:

classes/Order.php

   public function setInvoice()

   {

       // Set invoice number

       // $number = intval(Configuration::get('PS_INVOICE_NUMBER'));

       $number = intval($this->id);

       if (!intval($number))

           die(Tools::displayError('Invalid invoice number'));

       $this->invoice_number = $number;

       //Configuration::updateValue('PS_INVOICE_NUMBER', $number + 1);



       // Set invoice date

       $this->invoice_date = date('Y-m-d H:i:s');



       // Save

       $this->update();

   }



   public function setDelivery()

   {

       // Set delivery number

       //$number = intval(Configuration::get('PS_DELIVERY_NUMBER'));

       $number = intval($this->id);

       if (!intval($number))

           die(Tools::displayError('Invalid delivery number'));

       $this->delivery_number = $number;

       //Configuration::updateValue('PS_DELIVERY_NUMBER', $number + 1);



       // Set delivery date

       $this->delivery_date = date('Y-m-d H:i:s');



       // Update object

       $this->update();

   }

Link to comment
Share on other sites

×
×
  • Create New...