Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / How to customize orders total calculations

How to customize orders total calculations

Locked

Views: 2,512

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
10 Jul 2006, 5:48 PM
#1
catv avatar

catv

New Zenner

Join Date:
Jun 2006
Posts:
21
Plugin Contributions:
0

How to customize orders total calculations

I'm using the master password contrib, as part of my effort to use the front end of the site for our 3dparty sales and offline sales. I want the master password admin to be able to change the order total in the checkout process by making the order's total to be able to be edited via a form input. I have this working for the shipping total, by manipulating the Session variable for shipping cost. Now I'm stuck trying to fitgure out where the total is being calculated, so I can simply subtract an amount by a percentage. so I can do something like Session[Ordertotal]-Session[mypercentage].

I'm looking through the files, but the orders total looks to be so abstracted in code I 'm just chasing my tail on this one.

I'm looking in all the right files I think, but kind find where I can code in a simple substraction off the total, We're only using the flat_flat shipping right now.

I see this in tpl_orders_module_orders.php
I don't understand what the heck this array is suppose to be?

echo $GLOBALS[$class]->output[$i]['text']

I see some intresting stuff in
classes/orders_total.php but everthing is too abstracted to make sense of it.

Where on earth is the Session etc. variable that is holding the order's total that I can manipulate???:wacko:

Thanks in advance...

10 Jul 2006, 5:57 PM
#2
catv avatar

catv

New Zenner

Join Date:
Jun 2006
Posts:
21
Plugin Contributions:
0

Re: How to customize orders total calculations

I found this file too

modules/ot_total.php

Just found something in this file.

by chaning this line

'text' => $currencies->format($order->info['total'], true,

to this

'text' => $currencies->format($order->info['total']-5, true,

I'm able to subtract $5 off the total, I think I found my variable I was looking for.

Is there a better place to code this in? and can I override this file or not?

Now I'll post my value to a session variable and have it change the order's total, and re-assign the value to the new value, right?

10 Jul 2006, 9:07 PM
#3
catv avatar

catv

New Zenner

Join Date:
Jun 2006
Posts:
21
Plugin Contributions:
0

Re: How to customize orders total calculations

I have it working partially put it doesn't calculate exactly right, any idea?

includes/modules/order_total.php

    function process() {

    
      global $order, $currencies;
      $this->output[] = array('title' => $this->title . ':',
                              'text' => $currencies->format( ($order->info['total'])-($order->info['total'] * $_SESSION['orderDiscount'])  , true, $order->info['currency'], $order->info['currency_value']),
                              'value' => ($order->info['total'])-($order->info['total'] * $_SESSION['orderDiscount'])  );
    }