5 replies [Last post]
thomjjames's picture
Offline
Joined: 04/16/2008
Juice: 5
Was this information Helpful?

Hi everyone,

First up sorry if this is a really obvious question, but i've spent all morning looking through the documentation here and as of yet i haven't found the answer. i'm also pretty new to ubercart although i have a lot of experience with drupal.

I'm trying to develop a module to interact with Duplium which is a third party order fulfilment service ie. they do the actual sending out of products.
Basically once a payment is "complete" (or received) on the ubercart side of things i need to send some order information to Duplium in order for them to carry out the order, but i can't work out which hook i should be using.

i've looked at the hook_order (update option) but then i also noticed the uc_cart_complete_sale function in the paypal.module (ipn function) which seems to do something similar? which hook should i be focusing on?

Be great if someone could point me in the direction of the right hook?
Also i'd love to hear of anyones experiences with integrate ubercart and Duplium, if anyone has any?

thanks a lot
Tom

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: What hook is called on payment completion

I think your best bet here will be to hook into the order update and check the order status or balance. I'd recommend having an order status that you move orders to (either manually or through a workflow configuration) when it's time for them to move to fulfillment. This may even just be the "Completed" status. On an update, when the order moves to this status, if it hasn't already been pushed out to the fulfillment service then go ahead and do it.

thomjjames's picture
Offline
Joined: 04/16/2008
Juice: 5
Hi Ryan, thanks alot for

Hi Ryan,

thanks alot for such a rapid response, greatly appreciated!

ok i'll go for the hook_order as you suggested, i thought that was probably the way to go.
just out of interest/my learning could i use the other hook uc_cart_complete_sale and if so am i right in thinking i'd need to make something to interact with the workflow-ng module? just trying to figure stuff out as i'm likely to use ubercart on a number of projects in the future.

thanks again
Tom

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Hi Ryan, thanks alot for

Aye, I almost explained that but deleted as I typed it. Eye-wink That function is really just used to do some odd jobs on order completion. It does invoke a workflow event, so you could potentially have a workflow action that pushes the order data out for fulfillment. Now that I think about it, this may not be a bad idea... it just requires you to do a little more work up front.

olliemuh's picture
Offline
Joined: 03/04/2008
Juice: 23
Re: Re: Hi Ryan, thanks alot for

Thanks for the answer, Ryan.
And to sort of be repetitive,
hook uc_cart_complete_sale is where I would mess with site access?
Basically, we are charging for access to more places on our site, and putting the hook calls into this hook after payment is the way to go?
It's nothing bad, just another random b2b service. But we have some free pages, some available at one access level and a host of nodes available if you pay alot. Just the background info in case you need it.

dharmatech's picture
Offline
Bug Finder
Joined: 01/28/2008
Juice: 94
Re: What hook is called on payment completion

For a working example of how to do this, check out uc_civicrm