Order workflow is a complicated thing, with a lot of triggers and points of entry in which things can change, like stock decrementing, role assignment, etc.
Even more, some triggers are executed even though it's not quite like that, for example, when you create an order as admin, and then you enter a payment from the payment tab in the order, uc_payment_enter() executes uc_complete_sale() which triggers 'customer completes checkout'.
Fixing the workflow is probably not an easy task and I was trying to work out something with rules and I found that what would be really helpful is to be able to identify admin created orders in rules.
The stock decrement is happening twice because when the admin order is edited, stock gets decremented, and when a payment is entered, it tiggers 'customer completes checkout' which decrements stock again.
Comment | File | Size | Author |
---|---|---|---|
#1 | 2129243-0-rules-condition-admin-order.patch | 1.98 KB | hanoii |
Comments
Comment #1
hanoiiComment #2
hanoiiComment #3
hanoiiComment #4
longwaveDuplicate of #1216802: Keep record of user orders and admin orders but this is a simpler suggestion that includes a patch. I don't want to implement this twice so we should consider the suggestions there before committing this.
Comment #5
hanoiiI have read through #1216802: Keep record of user orders and admin orders but is a different approach of the same thing, they add a column while I use the data array. It's true though, that adding some kind of flag to the db would allow for better queries/views integration, but so far this is a good approach and eventually a views integration can be done anyway, only slightly more complicated/less performance.
Comment #6
TR CreditAttribution: TR commentedAdded "Rules" component.