Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / freeship after discounts - code

freeship after discounts - code

Views: 639

Results 1 to 2 of 2
3 Feb 2011, 4:20 AM
#1
makenoiz avatar

makenoiz

Zen Follower

Join Date:
Mar 2006
Posts:
284
Plugin Contributions:
0

freeship after discounts - code

Im working on fixing the age old problem of free shipping . If free shipping is offered (via Modules > Order Total > Shipping) for "order amounts" over xxx.xx it should only be applied after discount coupon has been applied and based on a the new subtotal that has the coupon amount deducted.. In order to do this. I need to have the variable $od_amount['total'] from ot_coupon.php available to function process() in ot_subtotal.php Can a zen guru enlighten me on how I can make this variable available to that function?

Also, if you see an error in my logic feel free to let me know.

Thanks

7 Feb 2011, 8:50 PM
#2
makenoiz avatar

makenoiz

Zen Follower

Join Date:
Mar 2006
Posts:
284
Plugin Contributions:
0

Re: freeship after discounts - code

So a little more on this -need some coders to jump in and help if you can.

Im trying set a redirect to the shipping page in the checkout_confirmation header as follows:

 if ($_SESSION['shipping']['id']=='free_free' && ($_SESSION['subTotAfterDisc'] < MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)){ 
    
     zen_redirect(zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); 
}

$_SESSION['subTotAfterDisc'] is set in ot_subtotal at the end of process() as follows

$_SESSION['subTotAfterDisc'] = $currencies->format(($order->info['subtotal']- $_SESSION['discountCoupon']), true, $order->info['currency'], $order->info['currency_value'])

And $_SESSION['discountCoupon']) is set in ot_coupon at the end of process() as follows:

$_SESSION['discountCoupon']=$od_amount['total'];

Once the process hits the header.php of the checkout_confirmation the session variable I have set is wiped out.

I have not coded any unsets on that Session Variable. Any coders have an idea of whats happening. If anyone can help with the code or the logic, I would greatly appreciate it.

Thanks