Jump to content

[Free Module] Order Reference | Change order reference to a custom number with variables


Recommended Posts

Hi PrestaShop-merchants,

I have created a module for solving a age old problem: changing the order reference into something meaning full. The random string of characters is not a preferred order reference for most merchants.

You can use variables to fill the order reference with, like $cart->id, $order->id, $shop->name, or a combination of those. You can use any variable from several PrestaShop Objects (main classes). For a more detailed explanation checkout: https://github.com/blauwfruit/orderreference

See the latest releases: https://github.com/blauwfruit/orderreference/releases

Give me your opinion! Thanks!

 

  • Like 2

Share this post


Link to post
Share on other sites
  • 3 months later...

Thanks :)

Works great but what if I want permanent string or digit in the begining and order nummer with 4 preceding zeroes? For example 2020  or  ABC. This doesnt work:

2020{order->id:%04d} - 20200001,20200002,20200003,..

ABC{order->id:%04d}  - ABC0001,ABC0002,ABC0003,..

 

Thanks for answer.

Share this post


Link to post
Share on other sites

Hello! Could you advice, how get this kind of format?

[order date}_[random unique number of 3 digits]

for example:

2020-07-10_678

Share this post


Link to post
Share on other sites
  • 2 months later...
  • 1 month later...
On 7/10/2020 at 12:50 PM, way1 said:

Hello! Could you advice, how get this kind of format?

[order date}_[random unique number of 3 digits]

for example:

2020-07-10_678

{order->date_add:%10.10s}{_}{cart->id:%03d} = 2020-07-10_678

{order->date_add:%7.7s}{_}{cart->id:%03d} = 2020-07_678

{order->date_add:%4.4s}{_}{cart->id:%03d} = 2020_678

If your PS create more than 999 carts, then the 3 last numbers would be increase to 4 in order to fit 1000 and so on.

Share this post


Link to post
Share on other sites
14 hours ago, EstebanGarviso said:

{order->date_add:%10.10s}{_}{cart->id:%03d} = 2020-07-10_678

{order->date_add:%7.7s}{_}{cart->id:%03d} = 2020-07_678

{order->date_add:%4.4s}{_}{cart->id:%03d} = 2020_678

If your PS create more than 999 carts, then the 3 last numbers would be increase to 4 in order to fit 1000 and so on.

At the moment a random number is not really possible. Can you create an issue to do this feature request? You can do this here: https://github.com/blauwfruit/PrestaShop-Order-Reference/issues

Share this post


Link to post
Share on other sites
  • 3 months later...

Great modul and thanks for it.

Questions:

1. Can I add a new starting number
e.x I want that my id start at 200
How can I do it?

2. e.x XYZ202100200 - starting at 200

This string:  {XYZ}{order->date_add:%4.4s}{order->id:%05d}
Right??

What would be the string for the year 21 instead of 2021

Thanks for some help and feedback!
Bjorn

Share this post


Link to post
Share on other sites

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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More