function process() {
      global $oOrder, $oCurrencies;

      if (MODULE_ORDER_TOTAL_LOWORDERFEE_LOW_ORDER_FEE == '1') {
        switch (MODULE_ORDER_TOTAL_LOWORDERFEE_DESTINATION) {
          case 'national':
            if ($oOrder->delivery['country_id'] == STORE_COUNTRY) $pass = true; break;
          case 'international':
            if ($oOrder->delivery['country_id'] != STORE_COUNTRY) $pass = true; break;
          case 'both':
            $pass = true; break;
          default:
            $pass = false; break;
        }

        if ( ($pass == true) && ( ($oOrder->info['total'] - $oOrder->info['shipping_cost']) < MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER) ) {
          $tax = oos_get_tax_rate(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $oOrder->billing['country']['id'], $oOrder->billing['zone_id']);
          // $tax_description = oos_get_tax_description(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
          $tax_description = oos_get_tax_rate(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $oOrder->billing['country']['id'], $oOrder->billing['zone_id']);

          $oOrder->info['tax'] += oos_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);
          $oOrder->info['tax_groups']["$tax_description"] += oos_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);
          $oOrder->info['total'] += MODULE_ORDER_TOTAL_LOWORDERFEE_FEE + oos_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);

          $this->output[] = array('title' => $this->title . ':',
                                  'text' => $oCurrencies->format(oos_add_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax), true, $oOrder->info['currency'], $oOrder->info['currency_value']),
                                  'value' => oos_add_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax));
        }
      }
    }
function smarty_function_oos_cost($params, &$smarty)
{
    global $oCurrencies;
    MyOOS_CoreApi::requireOnce('lib/smarty/libs/plugins/shared.escape_special_chars.php');
    $price = '';
    $tax = '';
    foreach ($params as $_key => $_val) {
        ${$_key} = smarty_function_escape_special_chars($_val);
    }
    print $oCurrencies->format(oos_add_tax($price, $tax));
}
function smarty_function_oos_display_price($params, &$smarty)
{
    global $oCurrencies;
    MyOOS_CoreApi::requireOnce('lib/smarty/libs/plugins/shared.escape_special_chars.php');
    $price = '';
    $tax = '';
    $qty = '';
    $calculate_currency_value = true;
    $currency = '';
    $currency_value = '';
    foreach ($params as $_key => $_val) {
        ${$_key} = smarty_function_escape_special_chars($_val);
    }
    print $oCurrencies->format(oos_add_tax($price, $tax) * $qty, $calculate_currency_value, $currency, $currency_value);
}
Example #4
0
 function process()
 {
     global $oOrder, $oCurrencies, $cod_cost, $cod_country;
     if (MODULE_ORDER_TOTAL_COD_STATUS == '1') {
         //Will become true, if cod can be processed.
         $cod_country = false;
         //check if payment method is cod. If yes, check if cod is possible.
         if ($_SESSION['payment'] == 'cod') {
             //process installed shipping modules
             if ($_SESSION['shipping']['id'] == 'flat_flat') {
                 $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_FLAT);
             }
             if ($_SESSION['shipping']['id'] == 'item_item') {
                 $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_ITEM);
             }
             if ($_SESSION['shipping']['id'] == 'table_table') {
                 $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_TABLE);
             }
             if ($_SESSION['shipping']['id'] == 'zones_zones') {
                 $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_ZONES);
             }
             if ($_SESSION['shipping']['id'] == 'ap_ap') {
                 $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_AP);
             }
             if ($_SESSION['shipping']['id'] == 'dp_dp') {
                 $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_DP);
             }
             if ($_SESSION['shipping']['id'] == 'chp_ECO') {
                 $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_CHP);
             }
             if ($_SESSION['shipping']['id'] == 'chp_PRI') {
                 $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_CHP);
             }
             if ($_SESSION['shipping']['id'] == 'chp_URG') {
                 $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_CHP);
             }
             if ($_SESSION['shipping']['id'] == 'certifiedmail_certifiedmail') {
                 $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_CERTIFIEDMAIL);
             }
             if ($_SESSION['shipping']['id'] == 'hermes_hermes') {
                 $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_HERMES);
             }
             for ($i = 0; $i < count($cod_zones); $i++) {
                 if ($cod_zones[$i] == $oOrder->billing['country']['iso_code_2']) {
                     $cod_cost = $cod_zones[$i + 1];
                     $cod_country = true;
                     //print('match' . $i . ': ' . $cod_cost);
                     break;
                 } elseif ($cod_zones[$i] == '00') {
                     $cod_cost = $cod_zones[$i + 1];
                     $cod_country = true;
                     //print('match' . $i . ': ' . $cod_cost);
                     break;
                 } else {
                     //print('no match');
                 }
                 $i++;
             }
         } else {
             //COD selected, but no shipping module which offers COD
         }
         if ($cod_country) {
             if (MODULE_ORDER_TOTAL_COD_TAX_CLASS > 0) {
                 $cod_tax = oos_get_tax_rate(MODULE_ORDER_TOTAL_COD_TAX_CLASS, $oOrder->billing['country']['id'], $oOrder->billing['zone_id']);
                 // $cod_tax_description = oos_get_tax_description(MODULE_ORDER_TOTAL_COD_TAX_CLASS, $oOrder->billing['country']['id'], $oOrder->billing['zone_id']);
                 $cod_tax_description = oos_get_tax_rate(MODULE_ORDER_TOTAL_COD_TAX_CLASS, $oOrder->billing['country']['id'], $oOrder->billing['zone_id']);
                 $oOrder->info['tax'] += oos_calculate_tax($cod_cost, $cod_tax);
                 $oOrder->info['tax_groups']["{$cod_tax_description}"] += oos_calculate_tax($cod_cost, $cod_tax);
                 $oOrder->info['total'] += $cod_cost + oos_calculate_tax($cod_cost, $cod_tax);
                 $this->output[] = array('title' => $this->title . ':', 'text' => $oCurrencies->format(oos_add_tax($cod_cost, $cod_tax), true, $oOrder->info['currency'], $oOrder->info['currency_value']), 'value' => oos_add_tax($cod_cost, $cod_tax));
             } else {
                 $oOrder->info['total'] += $cod_cost;
                 $this->output[] = array('title' => $this->title . ':', 'text' => $oCurrencies->format($cod_cost, true, $oOrder->info['currency'], $oOrder->info['currency_value']), 'value' => $cod_cost);
             }
         } else {
             //Following code should be improved if we can't get the shipping modules disabled, who don't allow COD
             // as well as countries who do not have cod
             //          $this->output[] = array('title' => $this->title . ':',
             //                                  'text' => 'No COD for this module.',
             //                                  'value' => '');
         }
     }
 }
 function psm_price($products_price, $products_tax, $quantity = 1)
 {
     return $this->format_prm(oos_add_tax($products_price, $products_tax) * $quantity);
 }
Example #6
0
 function cart()
 {
     global $oCurrencies;
     $this->content_type = $_SESSION['cart']->get_content_type();
     $nLanguageID = isset($_SESSION['language_id']) ? $_SESSION['language_id'] + 0 : 1;
     // Get database information
     $dbconn =& oosDBGetConn();
     $oostable =& oosDBGetTables();
     $customerstable = $oostable['customers'];
     $address_booktable = $oostable['address_book'];
     $zonestable = $oostable['zones'];
     $countriestable = $oostable['countries'];
     $sql = "SELECT c.customers_firstname, c.customers_lastname, c.customers_telephone, c.customers_email_address,\n                       ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city,\n                       ab.entry_zone_id, z.zone_name, co.countries_id, co.countries_name, co.countries_iso_code_2,\n                       co.countries_iso_code_3, co.address_format_id, ab.entry_state\n                FROM {$customerstable} c,\n                     {$address_booktable} ab LEFT JOIN\n                     {$zonestable} z\n                 ON  (ab.entry_zone_id = z.zone_id) LEFT JOIN\n                     {$countriestable} co\n                 ON (ab.entry_country_id = co.countries_id)\n                WHERE c.customers_id = '" . intval($_SESSION['customer_id']) . "' AND\n                    ab.customers_id = '" . intval($_SESSION['customer_id']) . "' AND\n                     c.customers_default_address_id = ab.address_book_id";
     $customer_address = $dbconn->GetRow($sql);
     $address_booktable = $oostable['address_book'];
     $zonestable = $oostable['zones'];
     $countriestable = $oostable['countries'];
     $sql = "SELECT ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address,\n                       ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name,\n                       ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2,\n                       c.countries_iso_code_3, c.address_format_id, ab.entry_state\n                FROM {$address_booktable} ab LEFT JOIN\n                     {$zonestable} z\n                  ON (ab.entry_zone_id = z.zone_id) LEFT JOIN\n                     {$countriestable} c ON\n                     (ab.entry_country_id = c.countries_id)\n                WHERE ab.customers_id = '" . intval($_SESSION['customer_id']) . "' AND\n                      ab.address_book_id = '" . intval($_SESSION['sendto']) . "'";
     $shipping_address = $dbconn->GetRow($sql);
     $address_booktable = $oostable['address_book'];
     $zonestable = $oostable['zones'];
     $countriestable = $oostable['countries'];
     $sql = "SELECT ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address,\n                       ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name,\n                       ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2,\n                       c.countries_iso_code_3, c.countries_moneybookers, c.address_format_id, ab.entry_state\n                FROM {$address_booktable} ab LEFT JOIN\n                     {$zonestable} z\n                  ON (ab.entry_zone_id = z.zone_id) LEFT JOIN\n                     {$countriestable} c ON\n                     (ab.entry_country_id = c.countries_id)\n                WHERE ab.customers_id = '" . intval($_SESSION['customer_id']) . "' AND\n                    ab.address_book_id = '" . intval($_SESSION['billto']) . "'";
     $billing_address = $dbconn->GetRow($sql);
     $class =& $_SESSION['payment'];
     $this->info = array('order_status' => DEFAULT_ORDERS_STATUS_ID, 'campaigns' => $_SESSION['campaigns_id'], 'currency' => $_SESSION['currency'], 'currency_value' => $oCurrencies->currencies[$_SESSION['currency']]['value'], 'payment_method' => $GLOBALS[$class]->title, 'cc_type' => isset($GLOBALS['cc_type']) ? $GLOBALS['cc_type'] : '', 'cc_owner' => isset($GLOBALS['cc_owner']) ? $GLOBALS['cc_owner'] : '', 'cc_number' => isset($GLOBALS['cc_number']) ? $GLOBALS['cc_number'] : '', 'cc_expires' => isset($GLOBALS['cc_expires']) ? $GLOBALS['cc_expires'] : '', 'cc_cvv' => isset($GLOBALS['cc_cvv']) ? $GLOBALS['cc_cvv'] : '', 'shipping_method' => $_SESSION['shipping']['title'], 'shipping_cost' => $_SESSION['shipping']['cost'], 'comments' => isset($_SESSION['comments']) ? $_SESSION['comments'] : '', 'shipping_class' => strpos($shipping['id'], '_') > 0 ? substr(strrev(strchr(strrev($shipping['id']), '_')), 0, -1) : $shipping['id'], 'payment_class' => $_SESSION['payment']);
     if (isset($GLOBALS['payment']) && is_object($GLOBALS['payment'])) {
         $this->info['payment_method'] = $GLOBALS['payment']->title;
         if (isset($GLOBALS['payment']->order_status) && is_numeric($GLOBALS['payment']->order_status) && $GLOBALS['payment']->order_status > 0) {
             $this->info['order_status'] = $GLOBALS['payment']->order_status;
         }
     }
     $this->customer = array('firstname' => $customer_address['customers_firstname'], 'lastname' => $customer_address['customers_lastname'], 'company' => $customer_address['entry_company'], 'street_address' => $customer_address['entry_street_address'], 'suburb' => $customer_address['entry_suburb'], 'city' => $customer_address['entry_city'], 'postcode' => $customer_address['entry_postcode'], 'state' => oos_is_not_null($customer_address['entry_state']) ? $customer_address['entry_state'] : $customer_address['zone_name'], 'zone_id' => $customer_address['entry_zone_id'], 'country' => array('id' => $customer_address['countries_id'], 'title' => $customer_address['countries_name'], 'iso_code_2' => $customer_address['countries_iso_code_2'], 'iso_code_3' => $customer_address['countries_iso_code_3']), 'format_id' => $customer_address['address_format_id'], 'telephone' => $customer_address['customers_telephone'], 'email_address' => $customer_address['customers_email_address']);
     $this->delivery = array('firstname' => $shipping_address['entry_firstname'], 'lastname' => $shipping_address['entry_lastname'], 'company' => $shipping_address['entry_company'], 'street_address' => $shipping_address['entry_street_address'], 'suburb' => $shipping_address['entry_suburb'], 'city' => $shipping_address['entry_city'], 'postcode' => $shipping_address['entry_postcode'], 'state' => oos_is_not_null($shipping_address['entry_state']) ? $shipping_address['entry_state'] : $shipping_address['zone_name'], 'zone_id' => $shipping_address['entry_zone_id'], 'country' => array('id' => $shipping_address['countries_id'], 'title' => $shipping_address['countries_name'], 'iso_code_2' => $shipping_address['countries_iso_code_2'], 'iso_code_3' => $shipping_address['countries_iso_code_3']), 'country_id' => $shipping_address['entry_country_id'], 'format_id' => $shipping_address['address_format_id']);
     $this->billing = array('firstname' => $billing_address['entry_firstname'], 'lastname' => $billing_address['entry_lastname'], 'company' => $billing_address['entry_company'], 'street_address' => $billing_address['entry_street_address'], 'suburb' => $billing_address['entry_suburb'], 'city' => $billing_address['entry_city'], 'postcode' => $billing_address['entry_postcode'], 'state' => oos_is_not_null($billing_address['entry_state']) ? $billing_address['entry_state'] : $billing_address['zone_name'], 'country' => array('id' => $billing_address['countries_id'], 'title' => $billing_address['countries_name'], 'iso_code_2' => $billing_address['countries_iso_code_2'], 'iso_code_3' => $billing_address['countries_iso_code_3'], 'moneybookers' => $billing_address['countries_moneybookers']), 'country_id' => $billing_address['entry_country_id'], 'format_id' => $billing_address['address_format_id']);
     $index = 0;
     $products = $_SESSION['cart']->get_products();
     for ($i = 0, $n = sizeof($products); $i < $n; $i++) {
         $this->products[$index] = array('qty' => $products[$i]['quantity'], 'name' => $products[$i]['name'], 'model' => $products[$i]['model'], 'ean' => $products[$i]['ean'], 'tax' => oos_get_tax_rate($products[$i]['tax_class_id'], $billing_address['entry_country_id'], ${$billing_address}['entry_zone_id']), 'tax_description' => oos_get_tax_description($products[$i]['tax_class_id'], $billing_address['entry_country_id'], $billing_address['entry_zone_id']), 'price' => $products[$i]['price'], 'final_price' => $products[$i]['price'] + $_SESSION['cart']->attributes_price($products[$i]['id']), 'weight' => $products[$i]['weight'], 'towlid' => $products[$i]['towlid'], 'id' => $products[$i]['id']);
         if ($products[$i]['attributes']) {
             $subindex = 0;
             foreach ($products[$i]['attributes'] as $option => $value) {
                 $products_optionstable = $oostable['products_options'];
                 $products_options_valuestable = $oostable['products_options_values'];
                 $products_attributestable = $oostable['products_attributes'];
                 if ($value == PRODUCTS_OPTIONS_VALUE_TEXT_ID) {
                     $sql = "SELECT popt.products_options_name, poval.products_options_values_name,\n                                       pa.options_values_price, pa.price_prefix\n                                FROM {$products_optionstable} popt,\n                                     {$products_options_valuestable} poval,\n                                     {$products_attributestable} pa\n                                WHERE\n                                     pa.products_id = '" . oos_db_input($products[$i]['id']) . "' AND\n                                     pa.options_id = '" . oos_db_input($option) . "' AND\n                                     pa.options_id = popt.products_options_id AND\n                                   popt.products_options_languages_id = '" . intval($nLanguageID) . "'";
                 } else {
                     $sql = "SELECT popt.products_options_name, poval.products_options_values_name,\n                                       pa.options_values_price, pa.price_prefix\n                                FROM {$products_optionstable} popt,\n                                     {$products_options_valuestable} poval,\n                                     {$products_attributestable} pa\n                                WHERE pa.products_id = '" . oos_db_input($products[$i]['id']) . "' AND\n                                      pa.options_id = '" . oos_db_input($option) . "' AND\n                                      pa.options_id = popt.products_options_id AND\n                                      pa.options_values_id = '" . oos_db_input($value) . "' AND\n                                      pa.options_values_id = poval.products_options_values_id AND\n                                      popt.products_options_languages_id = '" . intval($nLanguageID) . "' AND\n                                      poval.products_options_values_languages_id = '" . intval($nLanguageID) . "'";
                 }
                 $attributes = $dbconn->GetRow($sql);
                 if ($value == PRODUCTS_OPTIONS_VALUE_TEXT_ID) {
                     $attr_value = $products[$i]['attributes_values'][$option];
                 } else {
                     $attr_value = $attributes['products_options_values_name'];
                 }
                 $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options_name'], 'value' => $attr_value, 'option_id' => $option, 'value_id' => $value, 'prefix' => $attributes['price_prefix'], 'price' => $attributes['options_values_price']);
                 $subindex++;
             }
         }
         $shown_price = oos_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'];
         $this->info['subtotal'] += $shown_price;
         $products_tax = $this->products[$index]['tax'];
         if ($_SESSION['member']->group['show_price_tax'] == 1) {
             $this->info['tax'] += $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
             $this->info['tax_groups']["{$products_tax}"] += $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
         } else {
             $this->info['tax'] += $products_tax / 100 * $shown_price;
             $this->info['tax_groups']["{$products_tax}"] += $products_tax / 100 * $shown_price;
         }
         $index++;
     }
     if ($_SESSION['member']->group['show_price_tax'] == 1) {
         $this->info['total'] = $this->info['subtotal'] + $this->info['shipping_cost'];
     } else {
         $this->info['total'] = $this->info['subtotal'] + $this->info['tax'] + $this->info['shipping_cost'];
     }
 }
 function getNext()
 {
     // Get database information
     $dbconn =& oosDBGetConn();
     $oostable =& oosDBGetTables();
     switch ($this->mode) {
         // yearly
         case '1':
             $sd = $this->actDate;
             $ed = mktime(0, 0, 0, date("m", $sd), date("d", $sd), date("Y", $sd) + 1);
             break;
             // monthly
         // monthly
         case '2':
             $sd = $this->actDate;
             $ed = mktime(0, 0, 0, date("m", $sd) + 1, 1, date("Y", $sd));
             break;
             // weekly
         // weekly
         case '3':
             $sd = $this->actDate;
             $ed = mktime(0, 0, 0, date("m", $sd), date("d", $sd) + 7, date("Y", $sd));
             break;
             // daily
         // daily
         case '4':
             $sd = $this->actDate;
             $ed = mktime(0, 0, 0, date("m", $sd), date("d", $sd) + 1, date("Y", $sd));
             break;
     }
     if ($ed > $this->endDate) {
         $ed = $this->endDate;
     }
     $filterString = "";
     if ($this->statusFilter > 0) {
         $filterString .= " AND o.orders_status = " . $this->statusFilter . " ";
     }
     $rqOrders = $dbconn->Execute($this->queryOrderCnt . " WHERE o.date_purchased >= '" . oos_db_input(date("Y-m-d\\TH:i:s", $sd)) . "' AND o.date_purchased < '" . oos_db_input(date("Y-m-d\\TH:i:s", $ed)) . "'" . $filterString);
     $order = $rqOrders->fields;
     $rqShipping = $dbconn->Execute($this->queryShipping . " AND o.date_purchased >= '" . oos_db_input(date("Y-m-d\\TH:i:s", $sd)) . "' AND o.date_purchased < '" . oos_db_input(date("Y-m-d\\TH:i:s", $ed)) . "'" . $filterString);
     $shipping = $rqShipping->fields;
     $rqItems = $dbconn->Execute($this->queryItemCnt . " AND o.date_purchased >= '" . oos_db_input(date("Y-m-d\\TH:i:s", $sd)) . "' AND o.date_purchased < '" . oos_db_input(date("Y-m-d\\TH:i:s", $ed)) . "'" . $filterString . " group by pid " . $this->sortString);
     // set the return values
     $this->actDate = $ed;
     $this->showDate = $sd;
     $this->showDateEnd = $ed - 60 * 60 * 24;
     // execute the query
     $cnt = 0;
     $itemTot = 0;
     $sumTot = 0;
     while ($resp[$cnt] = $rqItems->fields) {
         // to avoid rounding differences round for every quantum
         // multiply with the number of items afterwords.
         $price = $resp[$cnt]['psum'] / $resp[$cnt]['pquant'];
         // products_attributes
         // are there any attributes for this order_id ?
         $rqAttr = $dbconn->Execute($this->queryAttr . " AND o.date_purchased >= '" . oos_db_input(date("Y-m-d\\TH:i:s", $sd)) . "' AND o.date_purchased < '" . oos_db_input(date("Y-m-d\\TH:i:s", $ed)) . "' AND op.products_id = " . $resp[$cnt]['pid'] . $filterString . " group by products_options_values ORDER BY orders_products_id");
         $i = 0;
         while ($attr[$i] = $rqAttr->fields) {
             $i++;
             // Move that ADOdb pointer!
             $rqAttr->MoveNext();
         }
         // values per date
         if ($i > 0) {
             $price2 = 0;
             $price3 = 0;
             $option = array();
             $k = -1;
             $ord_pro_id_old = 0;
             for ($j = 0; $j < $i; $j++) {
                 if ($attr[$j]['price_prefix'] == "-") {
                     $price2 += -1 * $attr[$j]['options_values_price'];
                     $price3 = -1 * $attr[$j]['options_values_price'];
                     $prefix = "-";
                 } else {
                     $price2 += $attr[$j]['options_values_price'];
                     $price3 = $attr[$j]['options_values_price'];
                     $prefix = "+";
                 }
                 $ord_pro_id = $attr[$j]['orders_products_id'];
                 if ($ord_pro_id != $ord_pro_id_old) {
                     $k++;
                     $l = 0;
                     // set values
                     $option[$k]['quant'] = $attr[$j]['attr_cnt'];
                     $option[$k]['options'][0] = $attr[$j]['products_options'];
                     $option[$k]['options_values'][0] = $attr[$j]['products_options_values'];
                     if ($price3 != 0) {
                         $option[$k]['price'][0] = oos_add_tax($price3, $resp[$cnt]['ptax']);
                     } else {
                         $option[$k]['price'][0] = 0;
                     }
                 } else {
                     $l++;
                     // update values
                     $option[$k]['options'][$l] = $attr[$j]['products_options'];
                     $option[$k]['options_values'][$l] = $attr[$j]['products_options_values'];
                     if ($price3 != 0) {
                         $option[$k]['price'][$l] = oos_add_tax($price3, $resp[$cnt]['ptax']);
                     } else {
                         $option[$k]['price'][$l] = 0;
                     }
                 }
                 $ord_pro_id_old = $ord_pro_id;
             }
             // set attr value
             $resp[$cnt]['attr'] = $option;
         } else {
             $resp[$cnt]['attr'] = "";
         }
         $resp[$cnt]['price'] = oos_add_tax($price, $resp[$cnt]['ptax']);
         $resp[$cnt]['psum'] = $resp[$cnt]['pquant'] * oos_add_tax($price, $resp[$cnt]['ptax']);
         $resp[$cnt]['order'] = $order['order_cnt'];
         $resp[$cnt]['shipping'] = $shipping['shipping'];
         // values per date and item
         $sumTot += $resp[$cnt]['psum'];
         $itemTot += $resp[$cnt]['pquant'];
         // add totsum and totitem until current row
         $resp[$cnt]['totsum'] = $sumTot;
         $resp[$cnt]['totitem'] = $itemTot;
         $cnt++;
         // Move that ADOdb pointer!
         $rqItems->MoveNext();
     }
     return $resp;
 }
Example #8
0
        echo '          <tr class="dataTableRow">' . "\n" . '            <td class="dataTableContent" valign="top" align="right">' . $order->products[$i]['qty'] . '&nbsp;x</td>' . "\n" . '            <td class="dataTableContent" valign="top">' . $order->products[$i]['name'];
        if (count($order->products[$i]['attributes']) > 0) {
            for ($j = 0, $k = count($order->products[$i]['attributes']); $j < $k; $j++) {
                echo '<br /><nobr><small>&nbsp;<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'];
                if ($order->products[$i]['attributes'][$j]['price'] != '0') {
                    echo ' (' . $order->products[$i]['attributes'][$j]['prefix'] . $currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')';
                }
                echo '</i></small></nobr>';
            }
        }
        echo '            </td>' . "\n";
        $serial_number = "Add Serial #";
        if (oos_is_not_null($order->products[$i]['serial_number'])) {
            $serial_number = $order->products[$i]['serial_number'];
        }
        echo '            <td class="dataTableContent" valign="top"><a href="' . oos_href_link_admin($aFilename['orders'], 'action=edit&oID=' . $oID . '&serial=' . $i, 'NONSSL') . '">' . $serial_number . '</a></td>' . "\n" . '            <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n" . '            <td class="dataTableContent" align="right" valign="top">' . oos_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n" . '            <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" . '            <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format(oos_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" . '            <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" . '            <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format(oos_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n";
        echo '          </tr>' . "\n";
        if (oos_is_not_null($_GET['serial']) && $_GET['serial'] == $i && $_GET['serial_updated'] != 1) {
            echo '          <tr class="dataTableRow">' . "\n" . '            <td class="dataTableContent" colspan="2" valign="top" align="right">Enter Serial #:&nbsp;</td>' . "\n";
            echo '            <td class="dataTableContent" colspan="7" valign="top">' . oos_draw_form('serial_form', $aFilename['orders'], 'action=update_serial&oID=' . $oID . '&serial=' . $order->products[$i]['id'], 'post', '') . oos_draw_input_field('serial_number', $serial_number, '', false, 'text', true) . '&nbsp;&nbsp;' . oos_image_swap_submits('update', 'update_off.gif', IMAGE_UPDATE) . '</td>' . "\n" . '          </tr>' . "\n";
        }
    }
    ?>
          <tr>
            <td align="right" colspan="9"><table border="0" cellspacing="0" cellpadding="2">
<?php 
    for ($i = 0, $n = count($order->totals); $i < $n; $i++) {
        echo '              <tr>' . "\n" . '                <td align="right" class="smallText">' . $order->totals[$i]['title'] . '</td>' . "\n" . '                <td align="right" class="smallText">' . $order->totals[$i]['text'] . '</td>' . "\n" . '              </tr>' . "\n";
    }
    ?>
            </table></td>
 function display_price($products_price, $products_tax, $quantity = 1)
 {
     global $oEvent, $aLang;
     $show_what_price = '';
     switch (true) {
         case $oEvent->installed_plugin('down_for_maintenance'):
             $show_what_price = $aLang['down_for_maintenance_no_prices_display'];
             break;
         default:
             $show_what_price = $this->format(oos_add_tax($products_price, $products_tax) * $quantity);
             break;
     }
     return $show_what_price;
 }
Example #10
0
          echo '</i></small></nobr>';
        }
      }

      echo '        </td>' . "\n";

      $serial_number = "";
      if (!empty($order->products[$i]['serial_number'])) $serial_number = $order->products[$i]['serial_number'];

      echo '        <td class="dataTableContent" valign="top">' . $serial_number . '</td>' . "\n" .
           '        <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n";
      echo '        <td class="dataTableContent" align="right" valign="top">' . oos_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n" .
           '        <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" .
           '        <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format(oos_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" .
           '        <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" .
           '        <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format(oos_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n";
      echo '      </tr>' . "\n";
    }
?>
      <tr>
        <td align="right" colspan="9"><table border="0" cellspacing="0" cellpadding="2">
<?php
  for ($i = 0, $n = count($order->totals); $i < $n; $i++) {
    echo '          <tr>' . "\n" .
         '            <td align="right" class="smallText">' . $order->totals[$i]['title'] . '</td>' . "\n" .
         '            <td align="right" class="smallText">' . $order->totals[$i]['text'] . '</td>' . "\n" .
         '          </tr>' . "\n";
  }
?>
        </table></td>
      </tr>
 function calculate()
 {
     $this->total_virtual = 0;
     // Gift Voucher System
     $this->weight_virtual = 0;
     $this->total = 0;
     $this->weight = 0;
     if (!is_array($this->contents)) {
         return 0;
     }
     // Get database information
     $dbconn =& oosDBGetConn();
     $oostable =& oosDBGetTables();
     reset($this->contents);
     while (list($products_id, ) = each($this->contents)) {
         $nQuantity = $this->contents[$products_id]['qty'];
         // products price
         $productstable = $oostable['products'];
         $product_sql = "SELECT products_id, products_model, products_price, products_discount_allowed,\r\n                                   products_tax_class_id, products_weight\r\n                            FROM {$productstable}\r\n                            WHERE products_id='" . oos_get_product_id($products_id) . "'";
         $product_result = $dbconn->Execute($product_sql);
         if ($product = $product_result->fields) {
             $no_count = 1;
             if (ereg('^GIFT', $product['products_model'])) {
                 $no_count = 0;
             }
             $prid = $product['products_id'];
             $products_tax = oos_get_tax_rate($product['products_tax_class_id']);
             if ($_SESSION['member']->group['qty_discounts'] == 1) {
                 $products_price = $this->products_price_actual($prid, $product['products_price'], $nQuantity);
             } else {
                 $products_price = $product['products_price'];
             }
             $max_product_discount = min($product['products_discount_allowed'], $_SESSION['member']->group['discount']);
             $products_price = $products_price * (100 - $max_product_discount) / 100;
             $products_weight = $product['products_weight'];
             $specialstable = $oostable['specials'];
             $sql = "SELECT specials_new_products_price\r\n                        FROM {$specialstable}\r\n                        WHERE products_id = '" . intval($prid) . "'\r\n                        AND   status = '1'";
             $specials_result = $dbconn->Execute($sql);
             if ($specials_result->RecordCount()) {
                 $specials = $specials_result->fields;
                 $products_price = $specials['specials_new_products_price'];
             }
             $this->total_virtual += oos_add_tax($products_price, $products_tax) * $nQuantity * $no_count;
             $this->weight_virtual += $nQuantity * $products_weight * $no_count;
             $this->total += oos_add_tax($products_price, $products_tax) * $nQuantity;
             $this->weight += $nQuantity * $products_weight;
         }
         // attributes price
         if (isset($this->contents[$products_id]['attributes'])) {
             reset($this->contents[$products_id]['attributes']);
             while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
                 $products_attributestable = $oostable['products_attributes'];
                 $sql = "SELECT options_values_price, price_prefix\r\n                            FROM {$products_attributestable}\r\n                            WHERE products_id = '" . intval($prid) . "'\r\n                            AND options_id = '" . intval($option) . "'\r\n                            AND options_values_id = '" . intval($value) . "'";
                 $attribute_price = $dbconn->GetRow($sql);
                 if ($attribute_price['price_prefix'] == '+') {
                     $this->total += $nQuantity * oos_add_tax($attribute_price['options_values_price'], $products_tax);
                 } else {
                     $this->total -= $nQuantity * oos_add_tax($attribute_price['options_values_price'], $products_tax);
                 }
             }
         }
     }
 }