Administrators can change the order state, but that does not trigger the "commerce_checkout_complete" Rules event. I developed a small module that allows administrators to trigger the "checkout completed" event manually. Adds a checkbox to the order edit form in the order status field set.

http://drupal.org/sandbox/klausi/1645238

Is this something for commerce core? Should I roll a patch?

Comments

rszrama’s picture

Yeah, I'd be up for something like this in core. I don't know the best way to represent it on the order edit form, though. Perhaps the same patch could also address the fact that we need a way to trigger price calculation rules to do things like apply discounts / taxes. I don't suppose your module already does that, too?

klausi’s picture

Hm, currently I'm assuming that the prices are final if the admin triggers the checkout. But you are right, taxes are missing here :-(
Will look into it.

klausi’s picture

I have introduced a second checkbox now: "Run the pricing rules when the order is saved.". This will execute commerce_cart_order_refresh(), not sure that is the right API function to use.

Code is in the sandbox.

rszrama’s picture

Hmm, I just closed a related issue as duplicate, and the point in there was that there was no way to apply taxes to an order if the Cart module wasn't enabled, since that was the primary point of sell price calculation. I haven't looked at your code yet, but it may be we need some way to support the direct calculation of taxes, too, without relying on the shopping cart refresh.

klausi’s picture

Ok, so what we need:

a) an API function provided by commerce_tax for tax calculation. It takes an order as parameter.
b) a form alter in commerce_tax to add a checkbox "Run the taxation rules when the order is saved" to the order edit form (or similar).
c) a checkbox "Trigger the checkout completed event when the order is saved" at the order edit form. Provided with a form alter from commerce_checkout module.

Correct me if I got something wrong here.

rszrama’s picture

You know, it may not need to be so specific to the Tax module. We want to support price calculation outside of the Cart module, but we may do just fine to add an API function to the Order module that calls commerce_product_calculate_sell_price() on each product line item on an order directly outside of a cart refresh. I'd say that if a site has the Cart module enabled, it should all be handled through that, but if the site doesn't then the Order module should make its separate approach available.

klausi’s picture

In the meantime I have released commerce_checkout_admin as full module, as we are using it in production. http://drupal.org/project/commerce_checkout_admin

rszrama’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new3.5 KB

Related to #1918978-4: Allow administrators to trigger price calculation on an order, I've rolled a patch that allows you to simulate checkout completion for an order via a local action on the order edit form.

rszrama’s picture

Status: Needs review » Fixed

Committed with an update function to disable the new feature on existing sites while leaving it enabled for new sites.

Commit: http://drupalcode.org/project/commerce.git/commitdiff/465805b

Status: Fixed » Needs work

The last submitted patch, 8: 1645252-8.checkout_completion_action.patch, failed testing.

rszrama’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

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

santerref’s picture

Status: Closed (fixed) » Needs review

Status: Needs review » Needs work

The last submitted patch, 8: 1645252-8.checkout_completion_action.patch, failed testing.

rszrama’s picture

Status: Needs work » Closed (fixed)

This has already been committed and closed. Please don't reopen it.