Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2006
    Posts
    21
    Plugin Contributions
    0

    Default 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?

    PHP Code:
    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???

    Thanks in advance...

  2. #2
    Join Date
    Jun 2006
    Posts
    21
    Plugin Contributions
    0

    Default 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
    PHP Code:
    'text' => $currencies->format($order->info['total'], true
    to this
    PHP Code:
    'text' => $currencies->format($order->info['total']-5true
    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?

  3. #3
    Join Date
    Jun 2006
    Posts
    21
    Plugin Contributions
    0

    Default 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

    PHP Code:

        
    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'])  );
        } 

 

 

Similar Threads

  1. v139h change Customer Orders Total in Database without deleting orders?
    By AvaAdorn in forum Managing Customers and Orders
    Replies: 6
    Last Post: 30 Jun 2012, 05:00 AM
  2. Order Total Modules making incorrect calculations! Help!
    By shellbell in forum Managing Customers and Orders
    Replies: 1
    Last Post: 15 Jan 2010, 01:07 PM
  3. Replies: 1
    Last Post: 9 Sep 2009, 12:11 PM
  4. Shipping calculations wrong on large orders
    By hedera in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 31 Mar 2008, 07:42 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg