  |
29 | 29 | | $qty = $this->contents[$products_id]['qty']; |
| |
30 | 30 | | $product_query = tep_db_query("select products_id from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'"); |
| |
31 | 31 | | if (!tep_db_num_rows($product_query)) { |
  |
32 | | - | tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET . " (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id) . "', '" . $qty . "', '" . date('Ymd') . "')"); |
| |
| 32 | + | tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET . " (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id) . "', '" . tep_db_input($qty) . "', '" . date('Ymd') . "')"); |
|
33 | 33 | | if (isset($this->contents[$products_id]['attributes'])) { |
| |
34 | 34 | | reset($this->contents[$products_id]['attributes']); |
| |
35 | 35 | | while (list($option, $value) = each($this->contents[$products_id]['attributes'])) { |
| |
36 | 36 | | tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " (customers_id, products_id, products_options_id, products_options_value_id) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id) . "', '" . (int)$option . "', '" . (int)$value . "')"); |
| |
37 | 37 | | } |
| |
38 | 38 | | } |
| |
39 | 39 | | } else { |
  |
40 | | - | tep_db_query("update " . TABLE_CUSTOMERS_BASKET . " set customers_basket_quantity = '" . $qty . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'"); |
| |
| 40 | + | tep_db_query("update " . TABLE_CUSTOMERS_BASKET . " set customers_basket_quantity = '" . tep_db_input($qty) . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'"); |
|
41 | 41 | | } |
| |
42 | 42 | | } |
| |
43 | 43 | | } |
| |
|
|
 |
… |
|
237 | 237 | | } |
| |
238 | 238 | | |
| |
239 | 239 | | function calculate() { |
  |
| 240 | + | global $currencies; |
| |
| 241 | + | |
|
240 | 242 | | $this->total = 0; |
| |
241 | 243 | | $this->weight = 0; |
| |
242 | 244 | | if (!is_array($this->contents)) return 0; |
| |
|
|
 |
… |
|
259 | 261 | | $products_price = $specials['specials_new_products_price']; |
| |
260 | 262 | | } |
| |
261 | 263 | | |
  |
262 | | - | $this->total += tep_add_tax($products_price, $products_tax) * $qty; |
| |
| 264 | + | $this->total += $currencies->calculate_price($products_price, $products_tax, $qty); |
|
263 | 265 | | $this->weight += ($qty * $products_weight); |
| |
264 | 266 | | } |
| |
265 | 267 | | |
| |
|
|
 |
… |
|
270 | 272 | | $attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$prid . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'"); |
| |
271 | 273 | | $attribute_price = tep_db_fetch_array($attribute_price_query); |
| |
272 | 274 | | if ($attribute_price['price_prefix'] == '+') { |
  |
273 | | - | $this->total += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax); |
| |
| 275 | + | $this->total += $currencies->calculate_price($attribute_price['options_values_price'], $products_tax, $qty); |
|
274 | 276 | | } else { |
  |
275 | | - | $this->total -= $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax); |
| |
| 277 | + | $this->total -= $currencies->calculate_price($attribute_price['options_values_price'], $products_tax, $qty); |
  |
276 | 278 | | } |
| |
277 | 279 | | } |
| |
278 | 280 | | } |