Generate order number before save order
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Generate order number before save order
I have additional column in mshop_order => order_no
How can I generate unique an order number just before it is saved to the database?
How can I generate unique an order number just before it is saved to the database?
Re: Generate order number before save order
There's already a column named invoiceno which you can use. If you just want the order ID to be displayed differently, you can also add a macro to the boot() method in your ./app/Providers/AppServiceProvider.php file.
Invoice number:
Order number:
If you really need an extra column with a totally different number, than you have to overwrite the saveBase() method of the order manager: https://github.com/aimeos/aimeos-core/b ... #L604-L623
Invoice number:
Code: Select all
\Aimeos\MShop\Order\Item\Standard::macro('invoicenumber', function($order) {
return 'INV-' . $this->get( 'order.invoiceno', '' );
});
Code: Select all
\Aimeos\MShop\Order\Item\Standard::macro('ordernumber', function($order) {
return 'No-' . $this->getId();
});
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

Re: Generate order number before save order
Thanks for reply