Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Deleting/archiving Old Orders Without Affecting Stock Rate Topic   - - - - -

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11368 posts

Posted 21 December 2018 - 07:32 PM #21

We could add an archive/delete orders function to our EZ Admin Helper where you could specify the number of days to retain orders.  It could even run automatically at year end to clean things up.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11368 posts

Posted 21 December 2018 - 09:38 PM #22

We had some time today so we added functionality to archive orders to our EZ Admin Helper addon.

 

A new action has been created for 'Archive Orders'.  It is disabled by default.

If enabled (or the run_once link is clicked) it will archive orders to newly created tables named 'ez_archive_[table name]' (I.e. ez_archive_orders). 

 

We chose to ARCHIVE rather than DELETE because the merchant might want to access the old data or even restore it into the related orders tables in the future (which can be easily done via phpMyAdmin).  Or, the merchant may decide to just truncate the tables effectively deleting the orders.

 

This will NOT affect inventory in any way.

 

The action has one parameter which is 'days'.  By default it is set to 1825 which is 5 years.  But you can set it to whatever you want.

If the action is Active and cron is setup to run, it will run once a year on Jan 1 at 5am (daily DB backups are set to run at 4am by default).  It is suggested that your run this immediately after doing a database backup

 

The product detail page is: https://ez-ms.com/ez-maint.html

And documentation is either in the Attachments tab on the above page or at: https://ez-ms.com/docs/ez_maint.pdf

 

The addon is still priced at:$34.99.  There's no better deal around.

Note that this new functionality is not available in the V3 or V2 versions of the addon.

 

As a reminder, here are the 'Actions' you can take all on one page in EZ Admin Helper

o Clear cache
o Clear template cache (V4 only)
o Clear thumb cache
o Clear logs
o Clear statistics
o Clear carts
o Backup site
o Optimize database
o Backup database
o Update currencies
o Monitor files
o Reset user passwords
o Change admin url
o Check detailed images (V4+ only)
o Check security intrusions (V4+ only)
o Sync orders and users (V4+ only)
o Archive orders (V4+ only)

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • sok777
  • Senior Member
  • Members
  • Join Date: 23-Jun 11
  • 394 posts

Posted 12 March 2019 - 10:07 PM #23

So, when I archive old orders it does a copy of order related tables and truncate them, right?

If I need to merge old and new orders will it be possible?



 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11368 posts

Posted 12 March 2019 - 11:53 PM #24

So, when I archive old orders it does a copy of order related tables and truncate them, right?

If I need to merge old and new orders will it be possible?

 

Sort of....  It copies them to shadow tables.  It doesn't 'truncate' per-se.  It copies and then deletes the appropriate entries.

And you "should" (UNTESTED) be able to re-merge the shadow and original tables since there should not be any UNIQUE conflicts.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • sok777
  • Senior Member
  • Members
  • Join Date: 23-Jun 11
  • 394 posts

Posted 13 March 2019 - 07:00 AM #25

Does it archive all orders including Incomplete/Declined/ Open?

Where is the shadow copy stored? Under Back Up / Restore?

Can I choose exact time frame for orders to be archived not number of days, for example year 2017, etc?

If I have another Admin Helper installed will it conflict? I only need Archive orders functionality but obviously will need to install addon with all features.



 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11368 posts

Posted 13 March 2019 - 07:31 AM #26

Does it archive all orders including Incomplete/Declined/ Open?

 

Please review the documentation at: https://ez-ms.com/docs/ez_maint.pdf

 

By default it archives orders (regardless of status) that are more than 5 years old (1825 days).

 

 

Where is the shadow copy stored? Under Back Up / Restore?

 

In the database.  It is the same table name with 'ez_archive_' prefixed to the table name.  I.e. cscart_ez_archive_orders is the archived cscart_orders table data.  There are 7 related tables for orders.  The basenanes are: orders, order_data, order_details, order_docs, product_file_ekeys, profile_fields_data and shipment_items.

 

 

 Can I choose exact time frame for orders to be archived not number of days, for example year 2017, etc?

 

Yes, per the documentation listed above the time is specified in days.

 

 

If I have another Admin Helper installed will it conflict?

 

Don't know for sure, but I doubt it.  Even if 2 addons provided equivalent functionality, they shouldn't conflict unless one is actually dependent upon the other.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • sok777
  • Senior Member
  • Members
  • Join Date: 23-Jun 11
  • 394 posts

Posted 13 March 2019 - 05:26 PM #27

Ok, thanks.

 

One more clarification. If the archived orders are still kept in the same database but under different tables would mean that DB size will not change. So it will not help to reduce DB size, unless I back up DB without tables with archived orders, is that right?