  |
1 | 1 | | <?php |
| |
2 | 2 | | /* |
  |
3 | | - | $Id: order_total.php 434 2006-02-15 20:49:45Z hpdl $ |
| |
| 3 | + | $Id: order_total.php 435 2006-02-16 10:02:53Z hpdl $ |
|
4 | 4 | | |
| |
5 | 5 | | osCommerce, Open Source E-Commerce Solutions |
| |
6 | 6 | | http://www.oscommerce.com |
| |
|
|
 |
… |
|
18 | 18 | | function osC_OrderTotal() { |
| |
19 | 19 | | global $osC_Database, $osC_Language; |
| |
20 | 20 | | |
  |
| 21 | + | if (isset($_SESSION['osC_OrderTotal_data']) === false) { |
| |
| 22 | + | $_SESSION['osC_OrderTotal_data'] = array('cartID' => null, |
| |
| 23 | + | 'output' => array()); |
| |
| 24 | + | } |
| |
| 25 | + | |
| |
| 26 | + | $this->_data =& $_SESSION['osC_OrderTotal_data']; |
| |
| 27 | + | |
|
21 | 28 | | $Qmodules = $osC_Database->query('select code from :table_templates_boxes where modules_group = "order_total"'); |
| |
22 | 29 | | $Qmodules->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES); |
| |
23 | 30 | | $Qmodules->setCache('modules-order_total'); |
| |
|
|
 |
… |
|
62 | 69 | | } |
| |
63 | 70 | | |
| |
64 | 71 | | function getResult() { |
  |
65 | | - | $order_total_array = array(); |
| |
| 72 | + | global $osC_ShoppingCart; |
|
66 | 73 | | |
  |
67 | | - | foreach ($this->_modules as $module) { |
| |
68 | | - | $module = 'osC_OrderTotal_' . $module; |
| |
| 74 | + | if ($this->_data['cartID'] != $osC_ShoppingCart->getCartID()) { |
| |
| 75 | + | $this->_data['cartID'] = $osC_ShoppingCart->getCartID(); |
|
69 | 76 | | |
  |
70 | | - | if ($GLOBALS[$module]->getStatus() === true) { |
| |
71 | | - | $GLOBALS[$module]->process(); |
| |
| 77 | + | $this->_data['output'] = array(); |
|
72 | 78 | | |
  |
73 | | - | foreach ($GLOBALS[$module]->output as $output) { |
| |
74 | | - | if (tep_not_null($output['title']) && tep_not_null($output['text'])) { |
| |
75 | | - | $order_total_array[] = array('code' => $GLOBALS[$module]->getCode(), |
| |
76 | | - | 'title' => $output['title'], |
| |
77 | | - | 'text' => $output['text'], |
| |
78 | | - | 'value' => $output['value'], |
| |
79 | | - | 'sort_order' => $GLOBALS[$module]->getSortOrder()); |
| |
| 79 | + | foreach ($this->_modules as $module) { |
| |
| 80 | + | $module = 'osC_OrderTotal_' . $module; |
| |
| 81 | + | |
| |
| 82 | + | if ($GLOBALS[$module]->getStatus() === true) { |
| |
| 83 | + | $GLOBALS[$module]->process(); |
| |
| 84 | + | |
| |
| 85 | + | foreach ($GLOBALS[$module]->output as $output) { |
| |
| 86 | + | if (tep_not_null($output['title']) && tep_not_null($output['text'])) { |
| |
| 87 | + | $this->_data['output'][] = array('code' => $GLOBALS[$module]->getCode(), |
| |
| 88 | + | 'title' => $output['title'], |
| |
| 89 | + | 'text' => $output['text'], |
| |
| 90 | + | 'value' => $output['value'], |
| |
| 91 | + | 'sort_order' => $GLOBALS[$module]->getSortOrder()); |
| |
| 92 | + | } |
|
80 | 93 | | } |
| |
81 | 94 | | } |
| |
82 | 95 | | } |
| |
83 | 96 | | } |
| |
84 | 97 | | |
  |
85 | | - | return $order_total_array; |
| |
| 98 | + | return $this->_data['output']; |
  |
86 | 99 | | } |
| |
87 | 100 | | |
| |
88 | 101 | | function hasActive() { |