Zen Cart Logo
Forums / Bug Reports / [Not a Bug] tpl_account_history_info & header_php lacks global order total module

[Not a Bug] tpl_account_history_info & header_php lacks global order total module

Locked

Views: 6,162

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
5 Feb 2014, 5:53 AM
#1
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,733
Plugin Contributions:
14

[Not a Bug] tpl_account_history_info & header_php lacks global order total module

tpl_account_history_info_default.php & header_php.php lacks global order total module

It looks like this page was not included when the checkout pages went global...

tpl_account_history_info_default.php

<div id="orderTotals">
<?php
  for ($i=0, $n=sizeof($order->totals); $i<$n; $i++) {
?>
     <div class="amount larger forward"><?php echo $order->totals[$i]['text'] ?></div>
     <div class="lineTitle larger forward"><?php echo $order->totals[$i]['title'] ?></div>
<br class="clearBoth" />
<?php
  }
?>

Should look more like this:

<?php
  if (MODULE_ORDER_TOTAL_INSTALLED) {
    $order_totals = $order_total_modules->process();
?>
<div id="orderTotals"><?php $order_total_modules->output(); ?></div>
<?php
  }
?>

**header_php.php
**```php
require(DIR_WS_CLASSES . 'order.php');
$order = new order($_GET['order_id']);

**
Should look more like this:**
```php
require(DIR_WS_CLASSES . 'order.php');
//$order = new order;
$order = new order($_GET['order_id']);

// load the selected shipping module
require(DIR_WS_CLASSES . 'shipping.php');
$shipping_modules = new shipping($_SESSION['shipping']);


require(DIR_WS_CLASSES . 'order_total.php');
$order_total_modules = new order_total;
$order_total_modules->collect_posts();
$order_total_modules->pre_confirmation_check();

// load the selected payment module
require(DIR_WS_CLASSES . 'payment.php');

Now account history info can see and display the status of the active order total modules.

NOTE: this is NOT a fix, this fixes every other element on the page except sub-total.

In the morning I'll sort out the $0.00 sub-total and post my findings.

5 Feb 2014, 3:23 PM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,089
Plugin Contributions:
56

Re: [Not a Bug] tpl_account_history_info & header_php lacks global order total module

The account_history_info page uses the order information (including the totals) that's stored in the database when the customer places the order. That's why the page uses the $order->totals values instead of calculating the totals again.

The customer, for example, might have purchased the product when the sales tax for their Florida county was 6.0%, two days before the tax increased to 6.25%. For the order's history to display the proper values, you want to display the order-total values as calculated for the order, not how they'd calculate today.

Your $0.00 sub-total is not "core" Zen Cart behavior (unless the products in the order are free!).

5 Feb 2014, 3:45 PM
#3
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,733
Plugin Contributions:
14

Re: [Not a Bug] tpl_account_history_info & header_php lacks global order total module

You're right lat9, I'm developing the page for a completely different purpose.

I realized the 'history' needs to be 'what happened' not 'what is happening' this morning... some nights I should just go to bed ;)

However, there are currently two pages account & account history that click through to the actual order - account history info.

I've changed this to:

  • My Account - management/dashboard page
  • Show Recent Invoices - invoice chart quick tax/totals view for monthly/yearly taxes
  • Show All Invoices - detailed invoice blocks for a quick view of many orders and their product details
  • Account History Info - the original invoice

I'll need the code for creating invoices with Zen Cart.

Forum admin - please move/remove this thread it's not a bug.