0

I've got Ubercart set up with Paypal Payments Pro and it is all working well, however, I want to set up the system so that when a payment is received (captured) in PayPal (after which the site successfully receives an IPN), an email is sent to our manufacturing plant to fulfill the order (including the order details, shipping address, etc.).

I am aware of hook_order but I'm not sure how to use it in this scenario (i.e., upon IPN), or whether there might be an easier way to accomplish this (without code, i.e., using Actions). It is OK if we have to code it, that is not a problem. Only want to know my options.

1

IMHO the easiest way is to use Rules. There's a default rule you can clone and tune for your needs: uc_payment_received.

I would clone that rule, add the condition to ensure it's a payment coming from PayPal, then replace the action with "Send an order email". The you should be able to customize the email.

Writing a custom module for this task is a bit overkill.

  • That is awesome. I had found hook_uc_payment_received, but not this related rule. Thanks! For others' benefit, it's here: /admin/config/workflow/rules/reaction/manage/uc_payment_received – udog Nov 14 '13 at 4:47
0

One very important thing know about ubercart is that hook_order from drupal 6 has been replaced with hook_uc_order in drupal 7.

Using hook_uc_order the conditions needed to figure out when an order is successfully completed seem to be:

function MODULE_NAME_uc_order($op, $order, $arg2) {
    if($op == 'update' && $order->order_status == 'payment_received' && $arg2 == 'completed'){
        //do something on order completion
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.