Similar to this issue #1166540: add ability to get order checkout date

That issue, however, seems to have a longer history related to order review and is trying to address several things at once. It seems to have only recently become relevant to what I'm looking for, after somebody re-opened a closed/fixed issue and renamed it.

Rather than doing that I'm opening a fresh issue to discuss an important problem.

Ryan pretty much sums up the use case here: http://www.bywombats.com/blog/01-24-2012/updating-completed-order-timest...

TL;DR: There's a problem with the discrepancy between order "created" and "paid" timestamps. If a user starts an order, doesn't checkout, and then comes back weeks later to make a payment, the order is lost on the order review screen (/admin/commerce/orders) because it gets buried by orders that are more recently created.

Worse yet.. The Commerce Kickstart setup give you filters at the top for date, and doesn't have any text near those filters that explains that orders may have been created long before they were paid for. So an admin goes in and filters to see orders completed in the last week, and the order that was created weeks ago but paid for yesterday doesn't appear. This is really bad UI.

In the above-mentioned post on bywombats.com, Ryan alters the "created" date with a rule. I don't think that is a solid fix because it overwrites a date value that may be useful to admins. Maybe an admin wants to have both the created date and the "paid" date? Overwriting the created date solves the problem but does so by creating a new problem. The created date should only reference what it stands for, the created date. Changing it will certainly cause confusion if the admin wants to know data about order creation.

This could be fixed if a new field were added to orders. "Date paid in full" -- it would be a simple time stamp just like "Created" and "Updated" stamps, but it would represent the time at which the order was paid for.

A rule similar to the rule Ryan created could set the value.

Then, the default view at "/admin/commerce/orders" would have to be updated to have that filter use the "paid in full" date rather than the "created" date...

I'm marking this as "major" because I think it's a huge problem that in the default configuration, orders can be easily lost. This came up on a site of mine that now has thousands of orders. Some were lost because admins were not seeing them when they were filtering the order review screen to a specific date range. It totally disrupted their order fulfillment process, and now fixing the problem is going to be a bit of a nightmare because I have to retrofit a "paid in full" date on orders that were already "Paid in full" -- I can't go back and fire rules, so this is going to take some ugly query writing to target when each past order was paid....

Comments

tmsimont’s picture

I set this up as a temporary work around: https://drupal.org/sandbox/tmsimont/2045247

You'll have to manually add a field called "field_paid_in_full" to your order entity, and the sandbox module provide a batch operation to retrofit the date value of the latest successful payment to the field value. It also sets up a rule to handle future orders.

rszrama’s picture

Thanks for the description and for your take on the issue - hearing more voices on this really helps. In another recent blog post about reporting, it became apparent to me that a core solution for this would be really helpful for the upcoming 1.9 release.

What I'm going to do is add a core rule to set the order created date to the checkout completion date, but I'll leave it disabled by default so as not to mess up the workflow / behavior (even if suboptimal) of existing sites or interfere with other solutions like your sandbox. I decided to do this for two primary reasons:

  1. In a minor update of Drupal Commerce, this is an unobtrusive fix. We can add it in without requiring any schema change or introducing a new property on the entity itself. I'll grant it isn't a perfect solution, but the situation isn't as severe as data loss when you consider the original entity created timestamp will still be available in the initial order revision.
  2. It conforms to the expectation of most users. For this reason, I imagine the "checkout completion" date will become the primary date in Commerce 2.x. Thus far in the roadmap I've mused about revision tagging handling things like this (because right now it would be too unwieldy to try and determine these dates through the revision list), but I'd also be open to just adding additional timestamps directly to the order entity itself. The problem with that is that you could do that for any other lifecycle point under the sun - canceled timestamp, "completed" timestamp (not just checkout completed), etc. If we had a core date field, that might make more sense - who knows - but at least making the created date that we have now function as the date the order was finalized and submitted by the customer for fulfillment (i.e. the checkout completion date) will make View filtering / sorting and report generation much simpler.

Follow-up comment with the patch since the new issue queue has broken my process. : (

rszrama’s picture

Issue summary: View changes
StatusFileSize
new1.25 KB
rszrama’s picture

Priority: Major » Normal
Status: Active » Fixed

Committed the patch; leaving the title as is even though the solution was a bit different.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.