7 replies [Last post]
VitaLife's picture
Offline
Bug Finder
Joined: 10/29/2007
Juice: 249
Was this information Helpful?

I am about to embark on programming a very complex business need, and I'd like a couple of suggestions from the UC experts on how they think the best way to accomplish / approach this is.
Basically, I am going to sell a product that will be charged and delivered over 5 months.
Let me describe the product mix and that might help you see what I'm doing. You want to sign up for the "Get Healthy Program". It will be 5 monthly payments of $99. The first month you'll get an IPOD, some vitamins, and training materials, etc. Each month I'll generate an order and ship out the next set of products. (they will be different so you'll get 5 different packages with different products)

Our site will be delivering them value every day via podcasts, member communications, etc. The main thing I need to use UC for is to handle the signup / initial $99 order. Then I need a way to extend it to process the other 4 payments and create orders for them. I was planning on creating a different product kit for each of the months since each monthly shipment will contain different items.

Also, I need to have a panel or checkbox added that the person is agreeing to pay the 5 payments.

Any input on this beast will be appreciated.

Jim

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6846
Re: Complex Recurring Product Suggestions Please

Interesting problem. After a quick brainstorm, I thought of a couple of ideas. Whenever a customer signs up for the program, have the module create orders for each of the other months and dump them in a special order status. The tricky part is automatically changing the order status when the orders need attention.

torgosPizza's picture
Offline
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.
Joined: 08/14/2007
Juice: 4110
Re: Re: Complex Recurring Product Suggestions Please

Lyle - perhaps that idea can be reused in the upcoming Recurring Payments module for UC. Breaking it down into "month to month" or "yearly" subscription - which would offer the potential for a discount when you purchase a full year.

--
Help directly fund development: Donate via PayPal!

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
torgosPizza wrote:. . .
torgosPizza wrote:

. . . upcoming Recurring Payments module for UC . . .

Looking for testers/feedback.

kcoworks's picture
Offline
Joined: 11/22/2007
Juice: 103
Quote:The tricky part is
Quote:

The tricky part is automatically changing the order status when the orders need attention.

why not have cron do this, based on the dates?

VitaLife's picture
Offline
Bug Finder
Joined: 10/29/2007
Juice: 249
Ready to code a recurring order enhancement

Well I have to do coding for this now, and I've looked at the recurring payments module (cool stuff), but I don't think it's the best way to tackle my business need. I'll physically be shipping a different product of different weight each month, so I think I really need to automatically place an order. I'll be using workflow_ng to setup actions to place the users orders for the 5 months of my program. I need a couple of UC pointers. Here is the psudocode for what I want to do, if there a good ubercart way to do these steps, let me know. I'll have workflow_ng setup to call a custom action like order_month2. It will pass the $user object to the code I write below. My questions are in brackets.

1. Load User Object, would like to load prior shipping address and credit card info. [Is there routine to load a uberccart user record that contatins shipping and cc data?]
2. Create order object and place certain SKU in cart [what is best way to initiate order object and prepare for processing?]
3. Get shipping quote based on sku weight and shipping zip.[how?]
4. Process the Order.[I know we have hook_order for checking status of order, etc. What do I need to have prepared to call order function directly from code
]

What I'm really looking for is an example of how to create a order with just code. If you can point me to that, it would be a big help.
thanks
Jim

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Ready to code a recurring order enhancement

Hey Jim, some quick answers to your questions:

Quote:

Is there routine to load a Ubercart user record that contains shipping and cc data?

Not really... you can use uc_order_load($order_id) to load a previous order, but this won't necessarily have CC data unless you've set it to save the info. Also, as you'll notice, this is based on an order instead of a user, so you'll need to know maybe the user's original order ID.

Quote:

What is best way to initiate order object and prepare for processing?

You can use uc_order_new($uid) to initiate a new order for user $uid. Adding products to the order may need to be done manually at the moment... I'll have to revisit the API in our update to Drupal 6.

Quote:

How?

Oof. Not sure. I bet there's a function somewhere for this, or you may just need to determine flat rates. Eye-wink

Quote:

I know we have hook_order() for checking status of order, etc. What do I need to have prepared to call order function directly from code.

I guess I'd need to know which order function, but you can look at any function to see what parameters it requires. They obviously aren't all documented yet, but that's the goal... as slow as it may be in coming.

VitaLife's picture
Offline
Bug Finder
Joined: 10/29/2007
Juice: 249
That's a good start...

I can search for their origintal order number, because they have to order the 1 month's kit before I'll auto do the 2nd month, and I can look for an order with a certain sku to get the right order. Once I load an old order, assuming I unload the product lines and load a new producdt line. Will it generate a new order_id or I do need to do a dbnextid and then order_save to move forward. Also, whhat routine is actually called when they hit that final submit button, I didn't see an obvious one when I browsed uc_order.

Jim