Forum Commerce App Non-sequential orderids

Non-sequential orderids

phoenix
1 Posts
Joined: Oct 2017
Quick question.  I don't like the orderids being sequential.  Sometimes on a slow day I may have a customer make two purchases, and from this they can tell how many orders have been placed in the time between their orders, how can change this so the orderids are either random or have a random gap?
0 | 0
Bill
15 Posts
Pittsburgh, PA
Joined: Nov 2015
1.  Go to Contents -> Modules and scroll to or search for the Custom Changes module.  Click the Green Modules Hooks button.



2.  On the Module Event Hooks page enable the place_order_final event.  If your server permissions allow it a modules/custom_changes/events/place_order_final.php file will be created.



3.  Using FTP, or by clicking the link and using the Gahela admin file editor insert the following line of code into this file:

Database::run('ALTER TABLE gfw_orders AUTO_INCREMENT=?', array($orderid + rand(10, 40)));


Then, when an order is placed the orderid will be randomly between 10-40 higher than the previous order.
Bill Brewer Gahela
1 | 0
Bill
15 Posts
Pittsburgh, PA
Joined: Nov 2015
FYI: No core code was changed to create this modification, so it will not affect the ability of the software to be updated.  This is the design of the Gahela module system.  There are code hooks, which make changes easy.
Bill Brewer Gahela
0 | 0
phoenix
1 Posts
Joined: Oct 2017
Perfect.  Thank you
0 | 0

You need to register or login before you can comment.