  |
1 | 1 | | <?php |
| |
2 | 2 | | /* |
  |
3 | | - | $Id: order_total.php 437 2006-02-16 10:41:13Z hpdl $ |
| |
| 3 | + | $Id: order_total.php 439 2006-02-19 16:33:18Z hpdl $ |
|
4 | 4 | | |
| |
5 | 5 | | osCommerce, Open Source E-Commerce Solutions |
| |
6 | 6 | | http://www.oscommerce.com |
| |
|
|
 |
… |
|
12 | 12 | | |
| |
13 | 13 | | class osC_OrderTotal { |
| |
14 | 14 | | var $_modules = array(), |
  |
| 15 | + | $_data = array(), |
|
15 | 16 | | $_group = 'order_total'; |
| |
16 | 17 | | |
| |
17 | 18 | | // class constructor |
| |
18 | 19 | | function osC_OrderTotal() { |
| |
19 | 20 | | global $osC_Database, $osC_Language; |
| |
20 | 21 | | |
  |
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 | | - | |
|
28 | 22 | | $Qmodules = $osC_Database->query('select code from :table_templates_boxes where modules_group = "order_total"'); |
| |
29 | 23 | | $Qmodules->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES); |
| |
30 | 24 | | $Qmodules->setCache('modules-order_total'); |
| |
|
|
 |
… |
|
39 | 33 | | $osC_Language->load('modules-order_total'); |
| |
40 | 34 | | |
| |
41 | 35 | | foreach ($this->_modules as $module) { |
  |
42 | | - | include('includes/modules/order_total/' . $module . '.' . substr(basename(__FILE__), (strrpos(basename(__FILE__), '.')+1))); |
| |
43 | | - | |
|
44 | 36 | | $module_class = 'osC_OrderTotal_' . $module; |
| |
45 | 37 | | |
  |
| 38 | + | if (class_exists($module_class) === false) { |
| |
| 39 | + | include('includes/modules/order_total/' . $module . '.' . substr(basename(__FILE__), (strrpos(basename(__FILE__), '.')+1))); |
| |
| 40 | + | } |
| |
| 41 | + | |
|
46 | 42 | | $GLOBALS[$module_class] = new $module_class(); |
| |
47 | 43 | | } |
| |
48 | 44 | | |
| |
|
|
 |
… |
|
70 | 66 | | return $this->_sort_order; |
| |
71 | 67 | | } |
| |
72 | 68 | | |
  |
73 | | - | function getResult() { |
| |
| 69 | + | function &getResult() { |
|
74 | 70 | | global $osC_ShoppingCart; |
| |
75 | 71 | | |
  |
76 | | - | if ($this->_data['cartID'] != $osC_ShoppingCart->getCartID()) { |
| |
77 | | - | $this->_data['cartID'] = $osC_ShoppingCart->getCartID(); |
| |
| 72 | + | $this->_data = array(); |
|
78 | 73 | | |
  |
79 | | - | $this->_data['output'] = array(); |
| |
| 74 | + | foreach ($this->_modules as $module) { |
| |
| 75 | + | $module = 'osC_OrderTotal_' . $module; |
|
80 | 76 | | |
  |
81 | | - | foreach ($this->_modules as $module) { |
| |
82 | | - | $module = 'osC_OrderTotal_' . $module; |
| |
| 77 | + | if ($GLOBALS[$module]->getStatus() === true) { |
| |
| 78 | + | $GLOBALS[$module]->process(); |
|
83 | 79 | | |
  |
84 | | - | if ($GLOBALS[$module]->getStatus() === true) { |
| |
85 | | - | $GLOBALS[$module]->process(); |
| |
86 | | - | |
| |
87 | | - | foreach ($GLOBALS[$module]->output as $output) { |
| |
88 | | - | if (tep_not_null($output['title']) && tep_not_null($output['text'])) { |
| |
89 | | - | $this->_data['output'][] = array('code' => $GLOBALS[$module]->getCode(), |
| |
90 | | - | 'title' => $output['title'], |
| |
91 | | - | 'text' => $output['text'], |
| |
92 | | - | 'value' => $output['value'], |
| |
93 | | - | 'sort_order' => $GLOBALS[$module]->getSortOrder()); |
| |
94 | | - | } |
| |
| 80 | + | foreach ($GLOBALS[$module]->output as $output) { |
| |
| 81 | + | if (tep_not_null($output['title']) && tep_not_null($output['text'])) { |
| |
| 82 | + | $this->_data[] = array('code' => $GLOBALS[$module]->getCode(), |
| |
| 83 | + | 'title' => $output['title'], |
| |
| 84 | + | 'text' => $output['text'], |
| |
| 85 | + | 'value' => $output['value'], |
| |
| 86 | + | 'sort_order' => $GLOBALS[$module]->getSortOrder()); |
|
95 | 87 | | } |
| |
96 | 88 | | } |
| |
97 | 89 | | } |
| |
98 | 90 | | } |
| |
99 | 91 | | |
  |
100 | | - | return $this->_data['output']; |
| |
| 92 | + | return $this->_data; |
  |
101 | 93 | | } |
| |
102 | 94 | | |
| |
103 | 95 | | function hasActive() { |