Posted: May 25, 2016 at 10:52 am
|
I’m trying to assist a client that absolutely requires auto-incrementing and completely sequential EE transaction IDs for accounting purposes. The transactions appeared to be providing exactly that for a while. Eventually we noticed there would be small gaps, however, and not due to transactions / registrations being deleted as far as I could gather. I was going to simply use a hook to add a meta field to the transaction with my own auto-increment script, but I also then noticed that transactions are not a WordPress post type. Do you have any idea how I might achieve this? Or, if you think the transactions should be perfectly sequential by ID, any idea why some would be missing? |
It turns out that transaction IDs are sequential, however some of the transactions that get abandoned (where for example the registration process gets started by adding some tickets to the cart, but the registration form isn’t submitted) get cleaned up/removed from the database after one week. |
|
|
Alright, thanks for the reply. I think I’m just going to create a custom post type to link successful transactions to a sequential custom field. Thanks for the clarification. |
|
One last question: Is there a way to stop the db cleanup for abandoned transactions? Even if I have to modify core files I’d like to know where to look. |
I do hope you’ll take a minute and consider what will happen to the database if you disable the cleanup. There’s the potential for crashes if the some of the tables become huge. You can take a look at /event-espresso-core-reg/core/db_models/EEM_Transaction.model.php starting on line 233 and you’ll find the delete_junk_transactions() method. Inside the method, there’s a filter hook,
You can use this filter to increase the amount of time to leave those junk transactions to be a few years (or more). Again, there could be some serious problems with the database server getting overwhelmed with transaction line items that belong to transactions that should have been deleted. Maybe you can build a way to trap every bot request to the ticket selector page to avoid those problems. |
|
|
Fair enough, thanks for the time. I’ll take a look and decide one way or another which way to handle it. Thanks! |
The support post ‘Incremental Transaction IDs’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.