  |
1 | 1 | | <?php |
| |
2 | 2 | | /* |
  |
3 | | - | $Id: table.php 1739 2007-12-20 00:52:16Z hpdl $ |
| |
| 3 | + | $Id: table.php 1841 2008-12-12 13:25:49Z hpdl $ |
|
4 | 4 | | |
| |
5 | 5 | | osCommerce, Open Source E-Commerce Solutions |
| |
6 | 6 | | http://www.oscommerce.com |
| |
7 | 7 | | |
  |
8 | | - | Copyright (c) 2003 osCommerce |
| |
| 8 | + | Copyright (c) 2008 osCommerce |
|
9 | 9 | | |
| |
10 | 10 | | Released under the GNU General Public License |
| |
11 | 11 | | */ |
| |
|
|
 |
… |
|
46 | 46 | | |
| |
47 | 47 | | // class methods |
| |
48 | 48 | | function quote($method = '') { |
  |
49 | | - | global $order, $cart, $shipping_weight, $shipping_num_boxes; |
| |
| 49 | + | global $order, $shipping_weight, $shipping_num_boxes; |
|
50 | 50 | | |
| |
51 | 51 | | if (MODULE_SHIPPING_TABLE_MODE == 'price') { |
  |
52 | | - | $order_total = $cart->show_total(); |
| |
| 52 | + | $order_total = $this->getShippableTotal(); |
|
53 | 53 | | } else { |
| |
54 | 54 | | $order_total = $shipping_weight; |
| |
55 | 55 | | } |
| |
|
|
 |
… |
|
107 | 107 | | function keys() { |
| |
108 | 108 | | return array('MODULE_SHIPPING_TABLE_STATUS', 'MODULE_SHIPPING_TABLE_COST', 'MODULE_SHIPPING_TABLE_MODE', 'MODULE_SHIPPING_TABLE_HANDLING', 'MODULE_SHIPPING_TABLE_TAX_CLASS', 'MODULE_SHIPPING_TABLE_ZONE', 'MODULE_SHIPPING_TABLE_SORT_ORDER'); |
| |
109 | 109 | | } |
  |
| 110 | + | |
| |
| 111 | + | function getShippableTotal() { |
| |
| 112 | + | global $order, $cart, $currencies; |
| |
| 113 | + | |
| |
| 114 | + | $order_total = $cart->show_total(); |
| |
| 115 | + | |
| |
| 116 | + | if ($order->content_type == 'mixed') { |
| |
| 117 | + | $order_total = 0; |
| |
| 118 | + | |
| |
| 119 | + | for ($i=0, $n=sizeof($order->products); $i<$n; $i++) { |
| |
| 120 | + | $order_total += $currencies->calculate_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']); |
| |
| 121 | + | |
| |
| 122 | + | if (isset($order->products[$i]['attributes'])) { |
| |
| 123 | + | reset($order->products[$i]['attributes']); |
| |
| 124 | + | while (list($option, $value) = each($order->products[$i]['attributes'])) { |
| |
| 125 | + | $virtual_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad where pa.products_id = '" . (int)$order->products[$i]['id'] . "' and pa.options_values_id = '" . (int)$value['value_id'] . "' and pa.products_attributes_id = pad.products_attributes_id"); |
| |
| 126 | + | $virtual_check = tep_db_fetch_array($virtual_check_query); |
| |
| 127 | + | |
| |
| 128 | + | if ($virtual_check['total'] > 0) { |
| |
| 129 | + | $order_total -= $currencies->calculate_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']); |
| |
| 130 | + | } |
| |
| 131 | + | } |
| |
| 132 | + | } |
| |
| 133 | + | } |
| |
| 134 | + | } |
| |
| 135 | + | |
| |
| 136 | + | return $order_total; |
| |
| 137 | + | } |
  |
110 | 138 | | } |
| |
111 | 139 | | ?> |