Jump to content

Order numbers, sequential order?


necrosaro420

Recommended Posts

I can't stand that when someone places an order, that it assigns random letters.  I process orders in the order they come in, so it makes it pretty hard to organize with just a bunch of random letters.  Is there a way, or module or something that will change the order number letters to actual numbers, as well as put them in order?  Say First order is 21000, next that comes in is 21001, 21002, 21003 etc?  Thanks

Link to comment
Share on other sites

There are several modules for this. I personally lik thisone because you can also setup customized numbers for deliveryslips, credit slips and it has the possibility to edit an order(before changing the status to send or preparation): https://addons.prestashop.com/nl/orderbeheer/24429-orders-management-pro-edit-orders-and-custom-numbers.html

Also thisone is very helpfull because it can also change your invoice and delivery templates:

https://addons.prestashop.com/nl/boekhouding-fakturatie/21817-pdf-invoice-template-delivery-custom-number.html

Link to comment
Share on other sites

If you want a free solution you can modify the code yourself. I have set the Order Reference to match the Order ID which is a sequential number. I then set my invoice numbers up to coincide with the same number so now the Order Reference, Order ID, and Invoice number all relatively match.

You can have the Order Reference generated/set in the PaymentModule.php file within the Classes directory. If you modify the file directly you will need to make the change anytime Prestashop is updated and that file is replaced.

In PaymentModule.php around line 381 for me you will find a block of code like so,

                    if (!$result) {
                        PrestaShopLogger::addLog('PaymentModule::validateOrder - Order cannot be created', 3, null, 'Cart', (int)$id_cart, true);
                        throw new PrestaShopException('Can\'t save Order');
                    }

Right after this code block insert the following two lines.

					$order->reference = str_pad($order->id, 6, '0', STR_PAD_LEFT);
					$order->update();

The code as is will set the Order Reference as the Order ID as a 6 digit number with 0 as a filler before the Order ID.

I did not come up with this myself. I adapted the info from an old forum topic, https://www.prestashop.com/forums/topic/446780-change-to-same-number-idorder-and-reference/

  • Like 1
Link to comment
Share on other sites

  • 1 year later...
  • 2 weeks later...

  

On 4/9/2020 at 10:06 AM, muynck said:

@necrosaro420 I don't know if you still need a solution for this? I have created a module for this problem: https://github.com/blauwfruit/orderreference/releases/tag/1.1.2

Tell me what you think!

Installed this mod, however there is now nothing under the "reference" field in orders. its just blank, even when opening the order PDF

In the module, i tried placing numbers in the "format" field as it was unclear what i should put here. 

Kind regards

ordernu.PNG

Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...