Closed (fixed)
Project:
Commerce Node Checkout
Version:
7.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
8 Apr 2014 at 15:14 UTC
Updated:
27 May 2014 at 18:20 UTC
Jump to comment: Most recent
Comments
Comment #1
drugan commentedYou need to understand the difference/relation between order STATUS and order STATE. For example you can have an order with "Pending" STATE and "Pending" or "Processing" STATUS. By default Drupal Commerce assigns for any successful order (payment has "Success" status but no matter if you're actually paid ) "Pending" STATE which implyes the first possible "Pending" STATUS in the "Pending" STATE array. So there are multiple statuses for each state.
We have a default rule called "Update the order status on checkout completion" but there is some confusion because this rule updates STATE and not STATUS. If you want to assign for your order "Completed" State/status after checkout competing you need to edit this rule OR (better) create your additional custom rule using "After updating an existing commerce order" event and two conditions:
Add an action for this rule "Update the order STATE" => "Completed".
Don't forget to test it through a real payment process. If you have more specific needs after checkout competing please check this issue:
https://drupal.org/node/2111633
Comment #2
bsandor commentedI see. Thanks. I'm going to test it soon.
Comment #3
mstef commentedI agree that the order status needs to be set to 'completed'; for a few reasons. First, it doesn't make sense to have admins set the status/state on every single node order that comes in. Second, when looking up node records that were purchased, we need to filter out all line items that haven't completed the checkout process yet; otherwise, we'll be returning records for nodes that are in the shopping cart and not yet paid for.
The only problem I see with doing this is that we'll need a conditional add-on to the Rule to make sure the checkout process includes nodes. The challenge here is that a purchase could contain nodes and other items and if that's the case, I don't think we can safely just set it to 'completed'.
I'm marking this as major because of it's importance to the ordering workflow and to the filtering that is needed for the node queries.
Comment #5
mstef commentedOkay, so as the commit message says, I added two things:
1) Two new Rules conditions:
- Order has nodes
- Order has only nodes.
2) A Rule that executes when an order finishes checkout that ONLY contains nodes, and if so, sets the order to completed.
I still have to:
1) Fix both child issues and make sure all queries regarding purchased nodes filter by order status = completed.
2) Update the documentation to explain that all nodes must be part of a completed order and that if you're mixing orders with nodes and non-nodes, you'll have to do something else to make sure the order is completed.
Comment #7
mstef commentedThis is all clear now..
The child issues were resolved. And due to the refactoring in #2266549: Node expiration date should be determined when node is published (not added to cart) we no longer have to care about the order status. Prior to the change, line items were given an expiration date whenever they were added to the cart. This was a problem for two reasons: 1) It messed up all of our queries because we then needed to filter out items that weren't paid for yet, 2) If a user kept a node in a cart for a while, their expiration time would start when the node was first created, not published (that's not fair...).
The rule remains in place that will set the order state to completed if it only contains nodes.