Closed (fixed)
Project:
Commerce Core
Version:
7.x-1.x-dev
Component:
Order
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
14 Dec 2011 at 14:56 UTC
Updated:
8 May 2012 at 01:20 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
murzComment #2
rszrama commentedYou'll need to use hook_form_alter() to change the #default_value of that checkbox. It also happens each time a product is added to / removed from the cart.
Comment #3
murzWill be good to add this as option in settings, because there are too much revisions created, but, I think, only very small percents of users review and use revisions.
Comment #4
murzUsing hook_form_alter() to change the #default_value helps to disable creating new revisions when a product is added to / removed from the cart, or I must do additional hooks for change this?
Comment #5
rszrama commentedIt would require additional integration b/c those revisions are specified elsewhere. Let's make this a feature request; it wouldn't hurt to have an option for this.
Comment #6
rszrama commentedConfirmed this idea with Damien; I'll add an option to the order settings page to switch the default behavior of revisions for Orders. It will still default to create a new revision on every change / edit, but you'll be able to toggle this with a checkbox.
Comment #7
mr.baileysPatch attached adds a checkbox to the "Order settings"-form that allows users to toggle the automatic creation of revisions on/off:
Comment #8
murzThanks, I test it and all works normally! Will be good to see this option in core.
Comment #9
rszrama commentedNoticed during manual testing that this wasn't trapping the revision created when a customer cancels checkout. Turns out we were manually setting the revision / log properties on the order in a few form submit handlers to avoid a separate call to commerce_order_status_update(). I wrapped the code in the submit handlers with an if check on the new variable, and everything tests out great now!
Thanks again, Ivo. : )
Commit: http://drupalcode.org/project/commerce.git/commitdiff/c242133
Potential follow-up commit would be to add an option to the order status update action so you can force a new revision even when the default is not to. For the sake of time, I didn't go ahead and do this myself.