Re: Re: Hi! The free order payment

Posts: 23
Joined: 05/19/2008
Bug Finder

Okay. I figured it out.

Free order works great when the order total coming into checkout is zero. What does not work for me is when the order gets zeroed by a coupon. I assumed initially that part of the problem was the ole' Safari Ajax bug, but then I also had problems in Firefox.

So what would work for me is a way to modify orders with a balance of zero so that the become free orders automatically no matter what payment method is selected, ie. checkout is completed immediately.

I initially tried to modify free order by adding a function to implement hook_order.

/**
* Implementation of hook_order().
*/
function uc_free_order_order($op, &$arg1, $arg2) {
switch ($op) {
    case 'load':
    if ($arg1->order_total <= .01 && $arg1->order_status == "In checkout") {
    db_query("UPDATE {uc_orders} SET payment_method = '%s' WHERE order_id = %d", 'free_order', $arg1->order_id);
    }
      break;
     }
}

But the testing got hosed due to the problems I was having with the uc_referer issue - so I never got to see if it worked or not. Can someone look this over and maybe figure a better way to address this issue?

Thanks,
Katrina

www.ambereyes.net

New Module for $0 Orders By: Ryan (24 replies) Thu, 04/03/2008 - 17:47