Automatically set order status from "payment received" to "completed"

Posts: 9
Joined: 03/06/2008
Cool profile pic award.

Hey folks.

I've got a system where folks purchase both physical goods that require shipping, and memberships (akin to digital downloads) that don't require shipping.

What i'm wondering is how can i go about setting the order status directly from "Payment Received" (e.g. when the paypal ipn stuff is received), to "Completed" only for orders that don't have physical goods.

Any ideas?

Thanks.

...alex...

Posts: 21
Joined: 02/19/2008

Seems like you could do it pretty easily in Workflow. I'd try having the action invoke when the order status is set to "Payment Received" and add a condition to check if the order's weight is zero, or maybe if it has products from the downloadable classes. Then, set the action to update the status to "Completed"

Posts: 9
Joined: 03/06/2008
Cool profile pic award.

manatwo wrote:
Seems like you could do it pretty easily in Workflow. I'd try having the action invoke when the order status is set to "Payment Received" and add a condition to check if the order's weight is zero, or maybe if it has products from the downloadable classes. Then, set the action to update the status to "Completed"

argh. I thought this would be easy too. I tried this method, but it's not working for me.

I have the member role stuff working meaning i have:

  • workflow-ng and workflow-ng-ui installed
  • a product called "yearly membership" that is in the product class "memberships". This "yearly membership" product, will set the role "paid member" on the user (i do not allow anon purchasing for this product) when the order status is changed to "payment received".
  • payment via paypal (sandbox) IPN is working, so that when a user completes the checkout successfully, the order status is changed from "in checkout" to "payment received".

Now, based on manatwo's comments and some digging of my own, i created a new workflow-ng rule that has:

  • name: "automatically update order status from 'paid' to 'completed'"
  • weight: 1 (to make sure it goes after the "update order status on full payment" rule).
  • Invoked on event: Order status gets updated
  • conditions:
    • Order status: "payment received" AND
    • Check an order's products (inclusive mode, "yearly membership")
  • actions:
    • set order status to "completed"

This doesn't work. The rule is never fired.

I've also tried setting the second condition to:

  • Order has a product of a particular class (and set the class to "memberships")

This also didn't work.

I removed the second condition altogether so the rule only had one condition:

  • Order status: "payment received"

And the rule fired (but obviously, this rule isn't very useful).

Perhaps i'm not entering the second condition properly.

Any ideas?

Thanks.

....alex...

Posts: 9
Joined: 03/06/2008
Cool profile pic award.

Hmmm...I tried setting the second condition so that it didn't reference the order contents (product or product class), but instead did like manatwo said and set the condition to see if the order weight is 0. That works.

This is fine for the most part, because now it does what i want. But the investigative side of me still wants to know why my original two attempts (using product and product class) didn't work.

Anyone got any ideas?

Thanks.

...alex...

Posts: 1290
Joined: 08/14/2007
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.

I would try, instead of checking for the Order Status to get updated, try running the rule when a payment gets entered, and the order contents include your subscription product. I've found some funky things with Order Status update being checked in WF-ng, I think you need to have it check for the Order Status it's being changed to, not the status it's changing from.

Hope one of these two things helps Smiling

--

"Pain don't hurt." - Dalton

Mike Nelson's RiffTrax! www.rifftrax.com

Posts: 5245
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Also, to cross-reference, it may be an issue with the order products condition. Lyle's investigating it now, but he's full on Indian food and may be a little slow to respond. Smiling

Posts: 2243
Joined: 08/07/2007
AdministratoreLiTe!

Hmm... It looks like there was a bug in the order product condition, so that if you had selected the first option for "Inclusive mode" (a terrible description of what it does, BTW) it wouldn't work. The second option should work fine though.

Those are two sets of radio buttons that do different things. I'll change their labels so that they're hopefully easier to understand.

I don't see anything wrong with the product class condition itself, but maybe the order isn't passing type info into the condition code for some reason.