예제 #1
0
 function process()
 {
     global $order, $currencies;
     switch (MODULE_ORDER_TOTAL_LOWORDERFEE_DESTINATION) {
         case 'national':
             if ($order->delivery['country_id'] == STORE_COUNTRY) {
                 $pass = true;
             }
             break;
         case 'international':
             if ($order->delivery['country_id'] != STORE_COUNTRY) {
                 $pass = true;
             }
             break;
         case 'both':
             $pass = true;
             break;
         default:
             $pass = false;
             break;
     }
     if ($pass == true && ($order->info['total'] - ($_SESSION['sppc_customer_group_show_tax'] == '1' ? 0 : $order->info['shipping_tax']) - $order->info['shipping_cost']) / $order->info['currency_value'] < MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER) {
         $tax = xos_get_tax_rate(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
         $tax_description = xos_get_tax_description(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
         $tax_value = round($order->info['currency_value'] * xos_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax), $currencies->currencies[$_SESSION['currency']]['decimal_places']);
         $order->info['tax'] += $tax_value;
         $order->info['tax_groups']["{$tax_description}"] += $tax_value;
         $order->info['total'] += round($order->info['currency_value'] * MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $currencies->currencies[$_SESSION['currency']]['decimal_places']) + $tax_value;
         $this->output[] = array('title' => $this->title . ':', 'text' => $currencies->format(xos_add_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax), $order->info['currency_value']), 'value' => round(xos_add_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax) * $order->info['currency_value'], $currencies->currencies[$_SESSION['currency']]['decimal_places']), 'tax' => xos_display_tax_value($tax));
     }
 }
예제 #2
0
 function quote($method = '')
 {
     global $order;
     $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_FLAT_TEXT_WAY, 'cost' => MODULE_SHIPPING_FLAT_COST)));
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = xos_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     }
     if (xos_not_null($this->icon)) {
         $this->quotes['icon'] = xos_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
예제 #3
0
 function process()
 {
     global $order, $currencies;
     if (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') {
         switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) {
             case 'national':
                 if ($order->delivery['country_id'] == STORE_COUNTRY) {
                     $pass = true;
                 }
                 break;
             case 'international':
                 if ($order->delivery['country_id'] != STORE_COUNTRY) {
                     $pass = true;
                 }
                 break;
             case 'both':
                 $pass = true;
                 break;
             default:
                 $pass = false;
                 break;
         }
         if ($pass == true && $_SESSION['cart']->get_content_type() != 'virtual' && $order->info['subtotal'] >= $currencies->currencies[$_SESSION['currency']]['value'] * MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) {
             $order->info['shipping_method'] = FREE_SHIPPING_TITLE;
             //          $order->info['total'] -= $order->info['shipping_cost'];
             $order->info['shipping_cost'] = 0;
         }
     }
     $module = substr($_SESSION['shipping']['id'], 0, strpos($_SESSION['shipping']['id'], '_'));
     if (xos_not_null($order->info['shipping_method'])) {
         $order->info['shipping_cost'] = $order->info['currency_value'] * $order->info['shipping_cost'];
         //        if ($GLOBALS[$module]->tax_class > 0) {
         $shipping_tax = xos_get_tax_rate($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
         $shipping_tax_description = xos_get_tax_description($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
         $shipping_tax_value = xos_calculate_tax($order->info['shipping_cost'], $shipping_tax);
         $order->info['tax'] += $order->info['shipping_tax'] = $shipping_tax_value;
         $order->info['tax_groups']["{$shipping_tax_description}"] += $shipping_tax_value;
         $order->info['total'] += $shipping_tax_value;
         if ($_SESSION['sppc_customer_group_show_tax'] == '1') {
             $order->info['shipping_cost'] += $shipping_tax_value;
         }
         //        }
         $this->output[] = array('title' => $order->info['shipping_method'] . ':', 'text' => $currencies->format($order->info['shipping_cost']), 'value' => $order->info['shipping_cost'], 'tax' => $order->info['shipping_method'] == FREE_SHIPPING_TITLE || strpos($order->info['shipping_method'], MODULE_SHIPPING_STORE_PICKUP_TEXT_TITLE) !== false && $order->info['shipping_cost'] == 0 ? -1 : xos_display_tax_value($shipping_tax));
     }
 }
예제 #4
0
 function process()
 {
     global $order, $currencies;
     $cod_country = false;
     if ($_SESSION['payment'] == 'cod') {
         if ($_SESSION['shipping']['id'] == 'flat_flat') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_FLAT);
         }
         if ($_SESSION['shipping']['id'] == 'item_item') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_ITEM);
         }
         if ($_SESSION['shipping']['id'] == 'table_table') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_TABLE);
         }
         if ($_SESSION['shipping']['id'] == 'usps_usps') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_USPS);
         }
         if ($_SESSION['shipping']['id'] == 'zones_zones') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_ZONES);
         }
         if ($_SESSION['shipping']['id'] == 'free_free') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_FREE);
         }
         for ($i = 0; $i < count($cod_zones); $i++) {
             if ($cod_zones[$i] == $order->delivery['country']['iso_code_2']) {
                 $cod_cost = $cod_zones[$i + 1];
                 $cod_country = true;
                 break;
             } elseif ($cod_zones[$i] == '00') {
                 $cod_cost = $cod_zones[$i + 1];
                 $cod_country = true;
             }
             $i++;
         }
     }
     if ($cod_country) {
         $tax = xos_get_tax_rate(MODULE_ORDER_TOTAL_COD_FEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
         $tax_description = xos_get_tax_description(MODULE_ORDER_TOTAL_COD_FEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
         $tax_value = round($order->info['currency_value'] * xos_calculate_tax($cod_cost, $tax), $currencies->currencies[$_SESSION['currency']]['decimal_places']);
         $order->info['tax'] += $tax_value;
         $order->info['tax_groups']["{$tax_description}"] += $tax_value;
         $order->info['total'] += round($order->info['currency_value'] * $cod_cost, $currencies->currencies[$_SESSION['currency']]['decimal_places']) + $tax_value;
         $this->output[] = array('title' => $this->title . ':', 'text' => $currencies->format(xos_add_tax($cod_cost, $tax), $order->info['currency_value']), 'value' => round(xos_add_tax($cod_cost, $tax) * $order->info['currency_value'], $currencies->currencies[$_SESSION['currency']]['decimal_places']), 'tax' => xos_display_tax_value($tax));
     }
 }
         $insert_id = xos_db_insert_id();
         xos_db_query("insert into " . TABLE_REVIEWS_DESCRIPTION . " (reviews_id, languages_id, reviews_text) values ('" . (int) $insert_id . "', '" . (int) $_SESSION['languages_id'] . "', '" . xos_db_input($review) . "')");
         $smarty->clearCache(null, 'L3|cc_reviews');
         $smarty->clearCache(null, 'L3|cc_product_reviews');
         xos_redirect(xos_href_link(FILENAME_PRODUCT_REVIEWS, xos_get_all_get_params(array('action', 'rmp')) . 'rmp=0'), false);
     }
 }
 require DIR_FS_SMARTY . 'catalog/languages/' . $_SESSION['language'] . '/' . FILENAME_PRODUCT_REVIEWS_WRITE;
 $site_trail->add(NAVBAR_TITLE, xos_href_link(FILENAME_PRODUCT_REVIEWS, xos_get_all_get_params()));
 $add_header = '<script type="text/javascript">' . "\n" . '/* <![CDATA[ */' . "\n" . 'function checkForm() {' . "\n" . '  var error = 0;' . "\n" . '  var error_message = "' . JS_ERROR . '";' . "\n\n" . '  var review = document.product_reviews_write.review.value;' . "\n\n" . '  if (review.length < ' . REVIEW_TEXT_MIN_LENGTH . ') {' . "\n" . '    error_message = error_message + "* ' . JS_REVIEW_TEXT . '\\n";' . "\n" . '    error = 1;' . "\n" . '  }' . "\n\n" . '  if ((document.product_reviews_write.rating[0].checked) || (document.product_reviews_write.rating[1].checked) || (document.product_reviews_write.rating[2].checked) || (document.product_reviews_write.rating[3].checked) || (document.product_reviews_write.rating[4].checked)) {' . "\n" . '  } else {' . "\n" . '    error_message = error_message + "* ' . JS_REVIEW_RATING . '\\n";' . "\n" . '    error = 1;' . "\n" . '  }' . "\n\n" . '  if (error == 1) {' . "\n" . '    alert(error_message);' . "\n" . '    return false;' . "\n" . '  } else {' . "\n" . '    return true;' . "\n" . '  }' . "\n" . '}' . "\n" . '/* ]]> */' . "\n" . '</script>' . "\n";
 require DIR_WS_INCLUDES . 'html_header.php';
 require DIR_WS_INCLUDES . 'boxes.php';
 require DIR_WS_INCLUDES . 'header.php';
 require DIR_WS_INCLUDES . 'footer.php';
 $products_prices = xos_get_product_prices($product_info['products_price']);
 $products_tax_rate = xos_get_tax_rate($product_info['products_tax_class_id']);
 $price_breaks_array = array();
 if (isset($products_prices[$customer_group_id][0])) {
     $product_price = $currencies->display_price($products_prices[$customer_group_id][0]['regular'], $products_tax_rate);
     $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][0]['special'] > 0 ? $product_price_special = $currencies->display_price($products_prices[$customer_group_id][0]['special'], $products_tax_rate) : ($product_price_special = '');
     $sizeof = count($products_prices[$customer_group_id]);
     if ($sizeof > 2) {
         $array_keys = array_keys($products_prices[$customer_group_id]);
         for ($count = 2, $n = $sizeof; $count < $n; $count++) {
             $qty = $array_keys[$count];
             $price_breaks_array[] = array('qty' => $qty, 'price_break' => $currencies->display_price($products_prices[$customer_group_id][$qty]['regular'], $products_tax_rate), 'price_break_special' => $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][$qty]['special'] > 0 ? $currencies->display_price($products_prices[$customer_group_id][$qty]['special'], $products_tax_rate) : '');
         }
     }
 } else {
     $product_price = $currencies->display_price($products_prices[0][0]['regular'], $products_tax_rate);
     $products_prices[0]['special_status'] == 1 && $products_prices[0][0]['special'] > 0 ? $product_price_special = $currencies->display_price($products_prices[0][0]['special'], $products_tax_rate) : ($product_price_special = '');
예제 #6
0
require DIR_WS_INCLUDES . 'boxes.php';
require DIR_WS_INCLUDES . 'header.php';
require DIR_WS_INCLUDES . 'footer.php';
if (CACHE_LEVEL > 2 && (isset($_COOKIE[session_name()]) && !isset($_GET[session_name()]) || SESSION_FORCE_COOKIE_USE == 'true')) {
    $smarty->caching = 1;
    $cache_id = 'L3|cc_products_new|' . $_SESSION['language'] . '-' . $_GET['lnc'] . '-' . $_GET[session_name()] . '-' . $session_started . '-' . SELECTED_TPL . '-' . $_SESSION['currency'] . '-' . $_SESSION['sppc_customer_group_id'] . '-' . $_SESSION['sppc_customer_group_show_tax'] . '-' . $_SESSION['sppc_customer_group_tax_exempt'] . '-' . $_GET['page'];
}
if (!$smarty->isCached(SELECTED_TPL . '/products_new.tpl', $cache_id)) {
    $products_new_query_raw = "select distinct p.products_id, p.products_delivery_time_id, pd.products_name, pd.products_p_unit, pd.products_info, p.products_model, p.products_quantity, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, mi.manufacturers_name from " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES_OR_PAGES . " c, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS_INFO . " mi on (p.manufacturers_id = mi.manufacturers_id and mi.languages_id = '" . (int) $_SESSION['languages_id'] . "'), " . TABLE_PRODUCTS_DESCRIPTION . " pd where c.categories_or_pages_status = '1' and p.products_id = p2c.products_id and c.categories_or_pages_id = p2c.categories_or_pages_id and p.products_status = '1' and p.products_date_added > '" . date("Y-m-d", mktime(1, 1, 1, date("m"), date("d") - INTERVAL_DAYS_BACK, date("Y"))) . "' and p.products_id = pd.products_id and pd.language_id = '" . (int) $_SESSION['languages_id'] . "' order by p.products_date_added DESC, pd.products_name";
    $products_new_split = new splitPageResultsBootstrap($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW, 'p.products_id');
    if ($products_new_split->number_of_rows > 0) {
        $products_new_query = xos_db_query($products_new_split->sql_query);
        $products_new_array = array();
        while ($products_new = xos_db_fetch_array($products_new_query)) {
            $products_prices = xos_get_product_prices($products_new['products_price']);
            $products_tax_rate = xos_get_tax_rate($products_new['products_tax_class_id']);
            $price_breaks_array = array();
            if (isset($products_prices[$customer_group_id][0])) {
                $product_price = $currencies->display_price($products_prices[$customer_group_id][0]['regular'], $products_tax_rate);
                $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][0]['special'] > 0 ? $product_price_special = $currencies->display_price($products_prices[$customer_group_id][0]['special'], $products_tax_rate) : ($product_price_special = '');
                $sizeof = count($products_prices[$customer_group_id]);
                if ($sizeof > 2) {
                    $array_keys = array_keys($products_prices[$customer_group_id]);
                    for ($count = 2, $n = $sizeof; $count < $n; $count++) {
                        $qty = $array_keys[$count];
                        $price_breaks_array[] = array('qty' => $qty, 'price_break' => $currencies->display_price($products_prices[$customer_group_id][$qty]['regular'], $products_tax_rate), 'price_break_special' => $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][$qty]['special'] > 0 ? $currencies->display_price($products_prices[$customer_group_id][$qty]['special'], $products_tax_rate) : '');
                    }
                }
            } else {
                $product_price = $currencies->display_price($products_prices[0][0]['regular'], $products_tax_rate);
                $products_prices[0]['special_status'] == 1 && $products_prices[0][0]['special'] > 0 ? $product_price_special = $currencies->display_price($products_prices[0][0]['special'], $products_tax_rate) : ($product_price_special = '');
예제 #7
0
//
//              You should have received a copy of the GNU General Public License
//              along with XOS-Shop.  If not, see <http://www.gnu.org/licenses/>.
//------------------------------------------------------------------------------
// this file is based on:
//              osCommerce, Open Source E-Commerce Solutions
//              http://www.oscommerce.com
//              Copyright (c) 2003 osCommerce
//              filename: specials.php
//
//              Released under the GNU General Public License
////////////////////////////////////////////////////////////////////////////////
if (!(@(include DIR_FS_SMARTY . 'catalog/templates/' . SELECTED_TPL . '/php/includes/boxes/specials.php') == 'overwrite_all')) {
    if ($random_product = xos_random_select("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s, " . TABLE_CATEGORIES_OR_PAGES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where c.categories_or_pages_status = '1' and p.products_id = p2c.products_id and p2c.categories_or_pages_id = c.categories_or_pages_id and p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int) $_SESSION['languages_id'] . "' and s.status = '1' and s.customers_group_id = '" . $customer_group_id . "' order by p.products_date_added DESC limit " . MAX_RANDOM_SELECT_SPECIALS)) {
        $products_prices = xos_get_product_prices($random_product['products_price']);
        $products_tax_rate = xos_get_tax_rate($random_product['products_tax_class_id']);
        $specials_price_breaks_array = array();
        if (isset($products_prices[$customer_group_id][0])) {
            $specials_product_price = $currencies->display_price($products_prices[$customer_group_id][0]['regular'], $products_tax_rate);
            $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][0]['special'] > 0 ? $specials_product_price_special = $currencies->display_price($products_prices[$customer_group_id][0]['special'], $products_tax_rate) : ($specials_product_price_special = '');
            $sizeof = count($products_prices[$customer_group_id]);
            /*      
                  if ($sizeof > 2) {
                    $array_keys = array_keys($products_prices[$customer_group_id]);
                    for ($count=2, $n=$sizeof; $count<$n; $count++) {
                      $qty = $array_keys[$count];
                      $specials_price_breaks_array[]=array('qty' => $qty,
                                                           'price_break' => $currencies->display_price($products_prices[$customer_group_id][$qty]['regular'], $products_tax_rate),
                                                           'price_break_special' => $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][$qty]['special'] > 0 ? $currencies->display_price($products_prices[$customer_group_id][$qty]['special'], $products_tax_rate) : '');
                    }       
                  }
//              osCommerce, Open Source E-Commerce Solutions
//              http://www.oscommerce.com
//              Copyright (c) 2003 osCommerce
//              filename: also_purchased_products.php
//
//              Released under the GNU General Public License
////////////////////////////////////////////////////////////////////////////////
if (!(@(include DIR_FS_SMARTY . 'catalog/templates/' . SELECTED_TPL . '/php/includes/modules/also_purchased_products.php') == 'overwrite_all')) {
    if (isset($_GET['p'])) {
        $orders_query = xos_db_query("select p.products_id, p.products_image, pd.products_name, pd.products_info, p.products_tax_class_id, p.products_price from " . TABLE_ORDERS_PRODUCTS . " opa, " . TABLE_ORDERS_PRODUCTS . " opb, " . TABLE_ORDERS . " o, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES_OR_PAGES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where c.categories_or_pages_status = '1' and p.products_id = p2c.products_id and p2c.categories_or_pages_id = c.categories_or_pages_id and opa.products_id = '" . (int) $_GET['p'] . "' and opa.orders_id = opb.orders_id and opb.products_id != '" . (int) $_GET['p'] . "' and opb.products_id = p.products_id and opb.orders_id = o.orders_id and p.products_id = pd.products_id and pd.language_id = '" . (int) $_SESSION['languages_id'] . "' and p.products_status = '1' group by p.products_id order by o.date_purchased desc limit " . MAX_DISPLAY_ALSO_PURCHASED);
        $num_products_ordered = xos_db_num_rows($orders_query);
        if ($num_products_ordered >= MIN_DISPLAY_ALSO_PURCHASED) {
            $also_purchased_products_array = array();
            while ($orders = xos_db_fetch_array($orders_query)) {
                $products_prices = xos_get_product_prices($orders['products_price']);
                $products_tax_rate = xos_get_tax_rate($orders['products_tax_class_id']);
                $orders_price_breaks_array = array();
                if (isset($products_prices[$customer_group_id][0])) {
                    $orders_product_price = $currencies->display_price($products_prices[$customer_group_id][0]['regular'], $products_tax_rate);
                    $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][0]['special'] > 0 ? $orders_product_price_special = $currencies->display_price($products_prices[$customer_group_id][0]['special'], $products_tax_rate) : ($orders_product_price_special = '');
                    $sizeof = count($products_prices[$customer_group_id]);
                    /*          
                              if ($sizeof > 2) {
                                $array_keys = array_keys($products_prices[$customer_group_id]);
                                for ($count=2, $n=$sizeof; $count<$n; $count++) {
                                  $qty = $array_keys[$count];
                                  $orders_price_breaks_array[]=array('qty' => $qty,
                                                                    'price_break' => $currencies->display_price($products_prices[$customer_group_id][$qty]['regular'], $products_tax_rate),
                                                                    'price_break_special' => $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][$qty]['special'] > 0 ? $currencies->display_price($products_prices[$customer_group_id][$qty]['special'], $products_tax_rate) : '');
                                }       
                              }
예제 #9
0
 function quote($method = '')
 {
     global $order, $shipping_weight, $shipping_num_boxes;
     if (xos_not_null($method) && (isset($this->types[$method]) || in_array($method, $this->intl_types))) {
         $this->_setService($method);
     }
     $this->_setMachinable('false');
     $this->_setContainer('None');
     $this->_setSize('REGULAR');
     // usps doesnt accept zero weight
     $shipping_weight = $shipping_weight < 0.1 ? 0.1 : $shipping_weight;
     $shipping_pounds = floor($shipping_weight);
     $shipping_ounces = round(16 * ($shipping_weight - floor($shipping_weight)));
     $this->_setWeight($shipping_pounds, $shipping_ounces);
     $uspsQuote = $this->_getQuote();
     if (is_array($uspsQuote)) {
         if (isset($uspsQuote['error'])) {
             $this->quotes = array('module' => $this->title, 'error' => $uspsQuote['error']);
         } else {
             $this->quotes = array('id' => $this->code, 'module' => $this->title . ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . 'lbs)');
             $methods = array();
             $size = sizeof($uspsQuote);
             for ($i = 0; $i < $size; $i++) {
                 list($type, $cost) = each($uspsQuote[$i]);
                 $methods[] = array('id' => $type, 'title' => isset($this->types[$type]) ? $this->types[$type] : $type, 'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
             }
             $this->quotes['methods'] = $methods;
             if ($this->tax_class > 0) {
                 $this->quotes['tax'] = xos_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
             }
         }
     } else {
         $this->quotes = array('module' => $this->title, 'error' => MODULE_SHIPPING_USPS_TEXT_ERROR);
     }
     if (xos_not_null($this->icon)) {
         $this->quotes['icon'] = xos_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
예제 #10
0
function xos_get_tax_description($class_id, $country_id, $zone_id)
{
    static $tax_rates = array();
    if ($country_id == '' && $zone_id == '') {
        if (!isset($_SESSION['customer_id'])) {
            $country_id = STORE_COUNTRY;
            $zone_id = STORE_ZONE;
        } else {
            $country_id = $_SESSION['customer_country_id'];
            $zone_id = $_SESSION['customer_zone_id'];
        }
    }
    if (!isset($tax_rates[$class_id][$country_id][$zone_id]['description'])) {
        $tax_query = xos_db_query("select tax_description from " . TABLE_TAX_RATES_DESCRIPTION . " trd, " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za on (tr.tax_zone_id = za.geo_zone_id) left join " . TABLE_GEO_ZONES . " tz on (tz.geo_zone_id = tr.tax_zone_id) where trd.tax_rates_id = tr.tax_rates_id and (za.zone_country_id is null or za.zone_country_id = '0' or za.zone_country_id = '" . (int) $country_id . "') and (za.zone_id is null or za.zone_id = '0' or za.zone_id = '" . (int) $zone_id . "') and tr.tax_class_id = '" . (int) $class_id . "' and trd.language_id = '" . (int) $_SESSION['languages_id'] . "' order by tr.tax_priority");
        if (xos_db_num_rows($tax_query)) {
            $tax_description = '';
            while ($tax = xos_db_fetch_array($tax_query)) {
                $tax_description .= $tax['tax_description'] . ' + ';
            }
            $tax_description = '[' . substr($tax_description, 0, -3) . ']';
            $tax_description .= ' (' . xos_display_tax_value(xos_get_tax_rate($class_id, $country_id, $zone_id)) . '%)';
            $tax_rates[$class_id][$country_id][$zone_id]['description'] = $tax_description;
        } else {
            $tax_rates[$class_id][$country_id][$zone_id]['description'] = TEXT_UNKNOWN_TAX_RATE;
        }
    }
    return $tax_rates[$class_id][$country_id][$zone_id]['description'];
}
예제 #11
0
 function quote($method = '')
 {
     global $order, $shipping_weight, $shipping_num_boxes, $currencies;
     if (MODULE_SHIPPING_TABLE_MODE == 'price') {
         $order_total = $_SESSION['cart']->show_total();
     } else {
         $order_total = $shipping_weight;
     }
     $table_cost = preg_split("/[:,]/", MODULE_SHIPPING_TABLE_COST);
     $size = sizeof($table_cost);
     for ($i = 0, $n = $size; $i < $n; $i += 2) {
         if ($order_total <= $table_cost[$i]) {
             $shipping = $table_cost[$i + 1];
             break;
         }
     }
     if (MODULE_SHIPPING_TABLE_MODE == 'weight') {
         $shipping = $shipping * $shipping_num_boxes;
         $title = MODULE_SHIPPING_TABLE_TEXT_WEIGHT . '&nbsp;' . ($shipping_num_boxes > 1 ? $shipping_num_boxes . '&nbsp;x&nbsp;' : '') . $shipping_weight . 'kg&nbsp;|&nbsp;';
     } else {
         $title = MODULE_SHIPPING_TABLE_TEXT_AMOUNT . '&nbsp;' . $currencies->format($_SESSION['cart']->show_total($currencies->currencies[$_SESSION['currency']]['value'])) . '&nbsp;|&nbsp;';
     }
     $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_TABLE_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => $title . MODULE_SHIPPING_TABLE_TEXT_WAY, 'cost' => $shipping + MODULE_SHIPPING_TABLE_HANDLING)));
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = xos_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     }
     if (xos_not_null($this->icon)) {
         $this->quotes['icon'] = xos_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
예제 #12
0
 function get_products($crrency_value = 1)
 {
     global $customer_group_id;
     if (!is_array($this->contents)) {
         return false;
     }
     $tax_address_query = xos_db_query("select ab.entry_country_id, ab.entry_zone_id from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) where ab.customers_id = '" . (int) $_SESSION['customer_id'] . "' and ab.address_book_id = '" . (int) ($this->get_content_type() == 'virtual' ? $_SESSION['billto'] : $_SESSION['sendto']) . "'");
     $tax_address = xos_db_fetch_array($tax_address_query);
     $products_array = array();
     reset($this->contents);
     while (list($products_id, ) = each($this->contents)) {
         $products_query = xos_db_query("select p.products_id, p.products_delivery_time_id, pd.products_name, pd.products_p_unit, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int) $products_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int) $_SESSION['languages_id'] . "'");
         if ($products = xos_db_fetch_array($products_query)) {
             $prid = $products['products_id'];
             $products_tax = xos_get_tax_rate($products['products_tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']);
             $products_prices = xos_get_product_prices($products['products_price']);
             if (isset($products_prices[$customer_group_id][0])) {
                 $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][0]['special'] > 0 ? $products_price = $products_prices[$customer_group_id][0]['special'] : ($products_price = $products_prices[$customer_group_id][0]['regular']);
                 $sizeof = count($products_prices[$customer_group_id]);
                 if ($sizeof > 2) {
                     $array_keys = array_keys($products_prices[$customer_group_id]);
                     for ($count = 2, $n = $sizeof; $count < $n; $count++) {
                         $qty = $array_keys[$count];
                         if ($this->contents[$products_id]['qty'] >= $qty) {
                             $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][$qty]['special'] > 0 ? $products_price = $products_prices[$customer_group_id][$qty]['special'] : ($products_price = $products_prices[$customer_group_id][$qty]['regular']);
                         }
                     }
                 }
             } else {
                 $products_prices[0]['special_status'] == 1 && $products_prices[0][0]['special'] > 0 ? $products_price = $products_prices[0][0]['special'] : ($products_price = $products_prices[0][0]['regular']);
                 $sizeof = count($products_prices[0]);
                 if ($sizeof > 2) {
                     $array_keys = array_keys($products_prices[0]);
                     for ($count = 2, $n = $sizeof; $count < $n; $count++) {
                         $qty = $array_keys[$count];
                         if ($this->contents[$products_id]['qty'] >= $qty) {
                             $products_prices[0]['special_status'] == 1 && $products_prices[0][$qty]['special'] > 0 ? $products_price = $products_prices[0][$qty]['special'] : ($products_price = $products_prices[0][$qty]['regular']);
                         }
                     }
                 }
             }
             $products_array[] = array('id' => $products_id, 'delivery_time_id' => $products['products_delivery_time_id'], 'name' => $products['products_name'], 'packaging_unit' => $products['products_p_unit'], 'model' => $products['products_model'], 'image' => $products['products_image'], 'price' => xos_add_tax($crrency_value * $products_price, $products_tax), 'quantity' => $this->contents[$products_id]['qty'], 'weight' => $products['products_weight'], 'final_price' => xos_add_tax($crrency_value * $products_price, $products_tax) + $this->attributes_price($products_id, $crrency_value, $products_tax), 'tax_class_id' => $products['products_tax_class_id'], 'attributes' => isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : '');
         }
     }
     return $products_array;
 }
예제 #13
0
 function cart()
 {
     global $currencies;
     $this->content_type = $_SESSION['cart']->get_content_type();
     if ($this->content_type != 'virtual' && $_SESSION['sendto'] == false) {
         $_SESSION['sendto'] = $_SESSION['customer_default_address_id'];
     }
     $customer_address_query = xos_db_query("select c.customers_c_id, c.customers_firstname, c.customers_lastname, c.customers_telephone, c.customers_email_address, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, co.countries_id, co.countries_name, co.countries_iso_code_2, co.countries_iso_code_3, co.address_format_id, ab.entry_state from " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " co on (ab.entry_country_id = co.countries_id) where c.customers_id = '" . (int) $_SESSION['customer_id'] . "' and ab.customers_id = '" . (int) $_SESSION['customer_id'] . "' and c.customers_default_address_id = ab.address_book_id");
     $customer_address = xos_db_fetch_array($customer_address_query);
     if (is_array($_SESSION['sendto']) && !empty($_SESSION['sendto'])) {
         $shipping_address = array('entry_firstname' => $_SESSION['sendto']['firstname'], 'entry_lastname' => $_SESSION['sendto']['lastname'], 'entry_company' => $_SESSION['sendto']['company'], 'entry_street_address' => $_SESSION['sendto']['street_address'], 'entry_suburb' => $_SESSION['sendto']['suburb'], 'entry_postcode' => $_SESSION['sendto']['postcode'], 'entry_city' => $_SESSION['sendto']['city'], 'entry_zone_id' => $_SESSION['sendto']['zone_id'], 'zone_name' => $_SESSION['sendto']['zone_name'], 'entry_country_id' => $_SESSION['sendto']['country_id'], 'countries_id' => $_SESSION['sendto']['country_id'], 'countries_name' => $_SESSION['sendto']['country_name'], 'countries_iso_code_2' => $_SESSION['sendto']['country_iso_code_2'], 'countries_iso_code_3' => $_SESSION['sendto']['country_iso_code_3'], 'address_format_id' => $_SESSION['sendto']['address_format_id'], 'entry_state' => $_SESSION['sendto']['zone_name']);
     } elseif (is_numeric($_SESSION['sendto'])) {
         $shipping_address_query = xos_db_query("select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . (int) $_SESSION['customer_id'] . "' and ab.address_book_id = '" . (int) $_SESSION['sendto'] . "'");
         $shipping_address = xos_db_fetch_array($shipping_address_query);
     } else {
         $shipping_address = array('entry_firstname' => null, 'entry_lastname' => null, 'entry_company' => null, 'entry_street_address' => null, 'entry_suburb' => null, 'entry_postcode' => null, 'entry_city' => null, 'entry_zone_id' => null, 'zone_name' => null, 'entry_country_id' => null, 'countries_id' => null, 'countries_name' => null, 'countries_iso_code_2' => null, 'countries_iso_code_3' => null, 'address_format_id' => 0, 'entry_state' => null);
     }
     if (is_array($_SESSION['billto']) && !empty($_SESSION['billto'])) {
         $billing_address = array('entry_firstname' => $_SESSION['billto']['firstname'], 'entry_lastname' => $_SESSION['billto']['lastname'], 'entry_company' => $_SESSION['billto']['company'], 'entry_street_address' => $_SESSION['billto']['street_address'], 'entry_suburb' => $_SESSION['billto']['suburb'], 'entry_postcode' => $_SESSION['billto']['postcode'], 'entry_city' => $_SESSION['billto']['city'], 'entry_zone_id' => $_SESSION['billto']['zone_id'], 'zone_name' => $_SESSION['billto']['zone_name'], 'entry_country_id' => $_SESSION['billto']['country_id'], 'countries_id' => $_SESSION['billto']['country_id'], 'countries_name' => $_SESSION['billto']['country_name'], 'countries_iso_code_2' => $_SESSION['billto']['country_iso_code_2'], 'countries_iso_code_3' => $_SESSION['billto']['country_iso_code_3'], 'address_format_id' => $_SESSION['billto']['address_format_id'], 'entry_state' => $_SESSION['billto']['zone_name']);
     } else {
         $billing_address_query = xos_db_query("select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . (int) $_SESSION['customer_id'] . "' and ab.address_book_id = '" . (int) $_SESSION['billto'] . "'");
         $billing_address = xos_db_fetch_array($billing_address_query);
     }
     if ($this->content_type == 'virtual') {
         $tax_address = array('entry_country_id' => $billing_address['entry_country_id'], 'entry_zone_id' => $billing_address['entry_zone_id']);
     } else {
         $tax_address = array('entry_country_id' => $shipping_address['entry_country_id'], 'entry_zone_id' => $shipping_address['entry_zone_id']);
     }
     $this->info = array('order_status' => DEFAULT_ORDERS_STATUS_ID, 'currency' => $_SESSION['currency'], 'currency_value' => $currencies->currencies[$_SESSION['currency']]['value'], 'payment_method' => $_SESSION['payment'], 'cc_type' => '', 'cc_owner' => '', 'cc_number' => '', 'cc_expires' => '', 'shipping_method' => $_SESSION['shipping']['title'], 'shipping_cost' => $_SESSION['shipping']['cost'], 'subtotal' => 0, 'tax' => 0, 'shipping_tax' => 0, 'discount' => 0, 'tax_groups' => array(), 'comments' => $_SESSION['comments']);
     if (isset($GLOBALS[$_SESSION['payment']]) && is_object($GLOBALS[$_SESSION['payment']])) {
         if (isset($GLOBALS[$_SESSION['payment']]->public_title)) {
             $this->info['payment_method'] = $GLOBALS[$_SESSION['payment']]->public_title;
         } else {
             $this->info['payment_method'] = $GLOBALS[$_SESSION['payment']]->title;
         }
         if (isset($GLOBALS[$_SESSION['payment']]->order_status) && is_numeric($GLOBALS[$_SESSION['payment']]->order_status) && $GLOBALS[$_SESSION['payment']]->order_status > 0) {
             $this->info['order_status'] = $GLOBALS[$_SESSION['payment']]->order_status;
         }
     }
     $this->customer = array('c_id' => $customer_address['customers_c_id'], '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' => xos_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']), 'country_id' => $customer_address['countries_id'], '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' => xos_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' => xos_not_null($billing_address['entry_state']) ? $billing_address['entry_state'] : $billing_address['zone_name'], 'zone_id' => $billing_address['entry_zone_id'], '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']), 'country_id' => $billing_address['entry_country_id'], 'format_id' => $billing_address['address_format_id']);
     $index = 0;
     $products = $_SESSION['cart']->get_products($currencies->currencies[$_SESSION['currency']]['value']);
     for ($i = 0, $n = sizeof($products); $i < $n; $i++) {
         $this->products[$index] = array('qty' => $products[$i]['quantity'], 'model' => $products[$i]['model'], 'name' => $products[$i]['name'], 'packaging_unit' => $products[$i]['packaging_unit'], 'delivery_time_id' => $products[$i]['delivery_time_id'], 'tax' => xos_get_tax_rate($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']), 'tax_description' => xos_get_tax_description($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']), 'price' => $products[$i]['price'], 'final_price' => $products[$i]['final_price'], 'price_formated' => $currencies->format($products[$i]['price']), 'final_price_formated' => $currencies->format($products[$i]['final_price']), 'total_price_formated' => $currencies->format($products[$i]['quantity'] * $products[$i]['final_price']), 'weight' => $products[$i]['weight'], 'id' => $products[$i]['id']);
         if ($products[$i]['attributes']) {
             $subindex = 0;
             reset($products[$i]['attributes']);
             while (list($option, $value) = each($products[$i]['attributes'])) {
                 $attributes_price = '';
                 $attributes_query = xos_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . (int) $products[$i]['id'] . "' and pa.options_id = '" . (int) $option . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int) $value . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . (int) $_SESSION['languages_id'] . "' and poval.language_id = '" . (int) $_SESSION['languages_id'] . "'");
                 $attributes = xos_db_fetch_array($attributes_query);
                 $attributes_price = xos_add_tax($currencies->currencies[$_SESSION['currency']]['value'] * $attributes['options_values_price'], xos_get_tax_rate($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']));
                 $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options_name'], 'value' => $attributes['products_options_values_name'], 'option_id' => $option, 'value_id' => $value, 'prefix' => $attributes['price_prefix'], 'price' => $attributes_price, 'price_formated' => $currencies->format($attributes_price));
                 $subindex++;
             }
         }
         // $shown_price = $this->products[$index]['final_price'] * $this->products[$index]['qty'];
         $shown_price = round($this->products[$index]['final_price'] * $this->products[$index]['qty'], $currencies->currencies[$_SESSION['currency']]['decimal_places']);
         $this->info['subtotal'] += $shown_price;
         $products_tax = $this->products[$index]['tax'];
         $products_tax_description = $this->products[$index]['tax_description'];
         if ($_SESSION['sppc_customer_group_show_tax'] == '1') {
             $this->info['tax'] += $shown_price - round($shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)), $currencies->currencies[$_SESSION['currency']]['decimal_places']);
             if (isset($this->info['tax_groups']["{$products_tax_description}"])) {
                 $this->info['tax_groups']["{$products_tax_description}"] += $shown_price - round($shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)), $currencies->currencies[$_SESSION['currency']]['decimal_places']);
             } else {
                 $this->info['tax_groups']["{$products_tax_description}"] = $shown_price - round($shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)), $currencies->currencies[$_SESSION['currency']]['decimal_places']);
             }
         } else {
             $this->info['tax'] += round($products_tax / 100 * $shown_price, $currencies->currencies[$_SESSION['currency']]['decimal_places']);
             if (isset($this->info['tax_groups']["{$products_tax_description}"])) {
                 $this->info['tax_groups']["{$products_tax_description}"] += round($products_tax / 100 * $shown_price, $currencies->currencies[$_SESSION['currency']]['decimal_places']);
             } else {
                 $this->info['tax_groups']["{$products_tax_description}"] = round($products_tax / 100 * $shown_price, $currencies->currencies[$_SESSION['currency']]['decimal_places']);
             }
         }
         $index++;
     }
     if ($_SESSION['sppc_customer_group_discount'] > 0) {
         $this->info['subtotal'] -= $this->info['discount'] = round($this->info['subtotal'] / 100 * $_SESSION['sppc_customer_group_discount'], $currencies->currencies[$_SESSION['currency']]['decimal_places']);
         $this->info['discount'] = 0 - $this->info['discount'];
         reset($this->info['tax_groups']);
         while (list($key, $value) = each($this->info['tax_groups'])) {
             if ($value > 0) {
                 $discount_tax = round($value / 100 * $_SESSION['sppc_customer_group_discount'], $currencies->currencies[$_SESSION['currency']]['decimal_places']);
                 $this->info['tax_groups']["{$key}"] -= $discount_tax;
                 $this->info['tax'] -= $discount_tax;
             }
         }
     }
     if ($_SESSION['sppc_customer_group_show_tax'] == '1') {
         $this->info['total'] = $this->info['subtotal'] + round($this->info['currency_value'] * $this->info['shipping_cost'], $currencies->currencies[$_SESSION['currency']]['decimal_places']);
     } else {
         $this->info['total'] = $this->info['subtotal'] + $this->info['tax'] + round($this->info['currency_value'] * $this->info['shipping_cost'], $currencies->currencies[$_SESSION['currency']]['decimal_places']);
     }
 }
예제 #14
0
 function quote($method = '')
 {
     global $order, $shipping_weight, $shipping_num_boxes;
     $dest_country = $order->delivery['country']['iso_code_2'];
     $dest_zone = 0;
     $error = false;
     for ($i = 1; $i <= $this->num_zones; $i++) {
         $countries_table = constant('MODULE_SHIPPING_ZONES_COUNTRIES_' . $i);
         $country_zones = preg_split("/[,]/", $countries_table);
         if (in_array($dest_country, $country_zones)) {
             $dest_zone = $i;
             break;
         }
     }
     if ($dest_zone == 0) {
         $error = true;
     } else {
         $shipping = -1;
         $zones_cost = constant('MODULE_SHIPPING_ZONES_COST_' . $dest_zone);
         $zones_table = preg_split("/[:,]/", $zones_cost);
         $size = sizeof($zones_table);
         for ($i = 0; $i < $size; $i += 2) {
             if ($shipping_weight <= $zones_table[$i]) {
                 $shipping = $zones_table[$i + 1];
                 $shipping_method = MODULE_SHIPPING_ZONES_TEXT_WAY . ' ' . $dest_country . ' : ' . ($shipping_num_boxes > 1 ? $shipping_num_boxes . ' x ' : '') . $shipping_weight . MODULE_SHIPPING_ZONES_TEXT_UNITS;
                 break;
             }
         }
         if ($shipping == -1) {
             $shipping_cost = 0;
             $shipping_method = MODULE_SHIPPING_ZONES_UNDEFINED_RATE;
         } else {
             $shipping_cost = $shipping * $shipping_num_boxes + constant('MODULE_SHIPPING_ZONES_HANDLING_' . $dest_zone);
         }
     }
     $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_ZONES_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => $shipping_method, 'cost' => $shipping_cost)));
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = xos_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     }
     if (xos_not_null($this->icon)) {
         $this->quotes['icon'] = xos_image($this->icon, $this->title);
     }
     if ($error == true) {
         $this->quotes['error'] = MODULE_SHIPPING_ZONES_INVALID_ZONE;
     }
     return $this->quotes;
 }
예제 #15
0
         $categories_query = xos_db_query("select c.categories_or_pages_id, cpd.categories_or_pages_name, c.parent_id from " . TABLE_CATEGORIES_OR_PAGES . " c, " . TABLE_CATEGORIES_OR_PAGES_DATA . " cpd where c.categories_or_pages_id = cpd.categories_or_pages_id and cpd.language_id = '" . (int) $_SESSION['languages_id'] . "' and c.parent_id = '" . (int) $parent_id . "' order by c.sort_order, cpd.categories_or_pages_name");
         while ($categories = xos_db_fetch_array($categories_query)) {
             $categories_string .= " or c.parent_id = '" . $categories['categories_or_pages_id'] . "'";
             $categories_string = xos_get_categories_string($categories['categories_or_pages_id'], '', $categories_string);
         }
         return $categories_string;
     }
     $includes_categories = xos_get_categories_string($new_products_category_id, true);
     $new_products_query = xos_db_query("select distinct p.products_id, p.products_image, pd.products_name, pd.products_info, p.products_tax_class_id, p.products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES_OR_PAGES . " c where c.categories_or_pages_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int) $_SESSION['languages_id'] . "' and p.products_id = p2c.products_id and p2c.categories_or_pages_id = c.categories_or_pages_id and (" . $includes_categories . ") and p.products_status = '1' and p.products_date_added > '" . date("Y-m-d", mktime(1, 1, 1, date("m"), date("d") - INTERVAL_DAYS_BACK, date("Y"))) . "' order by p.products_date_added desc, pd.products_name limit " . MAX_DISPLAY_NEW_PRODUCTS);
 }
 $num_new_products = xos_db_num_rows($new_products_query);
 if ($num_new_products > 0) {
     $new_products_array = array();
     while ($new_products = xos_db_fetch_array($new_products_query)) {
         $products_prices = xos_get_product_prices($new_products['products_price']);
         $products_tax_rate = xos_get_tax_rate($new_products['products_tax_class_id']);
         $new_price_breaks_array = array();
         if (isset($products_prices[$customer_group_id][0])) {
             $new_product_price = $currencies->display_price($products_prices[$customer_group_id][0]['regular'], $products_tax_rate);
             $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][0]['special'] > 0 ? $new_product_price_special = $currencies->display_price($products_prices[$customer_group_id][0]['special'], $products_tax_rate) : ($new_product_price_special = '');
             $sizeof = count($products_prices[$customer_group_id]);
             /*        
                     if ($sizeof > 2) {
                       $array_keys = array_keys($products_prices[$customer_group_id]);
                       for ($count=2, $n=$sizeof; $count<$n; $count++) {
                         $qty = $array_keys[$count];
                         $new_price_breaks_array[]=array('qty' => $qty,
                                                         'price_break' => $currencies->display_price($products_prices[$customer_group_id][$qty]['regular'], $products_tax_rate),
                                                         'price_break_special' => $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][$qty]['special'] > 0 ? $currencies->display_price($products_prices[$customer_group_id][$qty]['special'], $products_tax_rate) : '');
                       }       
                     }
예제 #16
0
    //    if(!$product_list_b) {
    //      $table_heading_array[]=array('text' => $lc_text,
    //                                   'case' => $case);
    //    }
    if (!empty($_GET['sort']) && substr($_GET['sort'], 0, 1) == $col) {
        $selected_none = false;
    }
}
if ($listing_split->number_of_rows > 0) {
    $rows = 0;
    $table_outer_array = array();
    $listing_query = xos_db_query($listing_split->sql_query);
    while ($listing = xos_db_fetch_array($listing_query)) {
        $rows++;
        $products_prices = xos_get_product_prices($listing['products_price']);
        $products_tax_rate = xos_get_tax_rate($listing['products_tax_class_id']);
        $price_breaks = false;
        $price_breaks_array = array();
        if (isset($products_prices[$customer_group_id][0])) {
            $product_price = $currencies->display_price($products_prices[$customer_group_id][0]['regular'], $products_tax_rate);
            $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][0]['special'] > 0 ? $product_price_special = $currencies->display_price($products_prices[$customer_group_id][0]['special'], $products_tax_rate) : ($product_price_special = '');
            $sizeof = count($products_prices[$customer_group_id]);
            if ($sizeof > 2) {
                $price_breaks = true;
                $array_keys = array_keys($products_prices[$customer_group_id]);
                for ($count = 2, $n = $sizeof; $count < $n; $count++) {
                    $qty = $array_keys[$count];
                    $price_breaks_array[] = array('qty' => $qty, 'price_break' => $currencies->display_price($products_prices[$customer_group_id][$qty]['regular'], $products_tax_rate), 'price_break_special' => $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][$qty]['special'] > 0 ? $currencies->display_price($products_prices[$customer_group_id][$qty]['special'], $products_tax_rate) : '');
                }
            }
        } else {
예제 #17
0
//              osCommerce, Open Source E-Commerce Solutions
//              http://www.oscommerce.com
//              Copyright (c) 2003 osCommerce
//              filename: xsell_products.php
//
//              Released under the GNU General Public License
////////////////////////////////////////////////////////////////////////////////
if (!(@(include DIR_FS_SMARTY . 'catalog/templates/' . SELECTED_TPL . '/php/includes/modules/xsell_products.php') == 'overwrite_all')) {
    if (isset($_GET['p'])) {
        $xsell_query = xos_db_query("select distinct p.products_id, p.products_image, pd.products_name, pd.products_info, p.products_tax_class_id, p.products_price from " . TABLE_PRODUCTS_XSELL . " xp, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES_OR_PAGES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where xp.products_id = '" . (int) $_GET['p'] . "' and xp.xsell_id = p.products_id and p.products_id = pd.products_id and p.products_id = p2c.products_id and p2c.categories_or_pages_id = c.categories_or_pages_id and pd.language_id = '" . (int) $_SESSION['languages_id'] . "' and p.products_status = '1' and c.categories_or_pages_status = '1' order by xp.sort_order ");
        $num_products_xsell = xos_db_num_rows($xsell_query);
        if ($num_products_xsell > 0) {
            $xsell_products_array = array();
            while ($xsell = xos_db_fetch_array($xsell_query)) {
                $products_prices = xos_get_product_prices($xsell['products_price']);
                $products_tax_rate = xos_get_tax_rate($xsell['products_tax_class_id']);
                $xsell_price_breaks_array = array();
                if (isset($products_prices[$customer_group_id][0])) {
                    $xsell_product_price = $currencies->display_price($products_prices[$customer_group_id][0]['regular'], $products_tax_rate);
                    $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][0]['special'] > 0 ? $xsell_product_price_special = $currencies->display_price($products_prices[$customer_group_id][0]['special'], $products_tax_rate) : ($xsell_product_price_special = '');
                    $sizeof = count($products_prices[$customer_group_id]);
                    /*          
                              if ($sizeof > 2) {
                                $array_keys = array_keys($products_prices[$customer_group_id]);
                                for ($count=2, $n=$sizeof; $count<$n; $count++) {
                                  $qty = $array_keys[$count];
                                  $xsell_price_breaks_array[]=array('qty' => $qty,
                                                                    'price_break' => $currencies->display_price($products_prices[$customer_group_id][$qty]['regular'], $products_tax_rate),
                                                                    'price_break_special' => $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][$qty]['special'] > 0 ? $currencies->display_price($products_prices[$customer_group_id][$qty]['special'], $products_tax_rate) : '');
                                }       
                              }
예제 #18
0
} elseif (!(@(include DIR_FS_SMARTY . 'catalog/templates/' . SELECTED_TPL . '/php/' . FILENAME_SHOPPING_CART) == 'overwrite_all')) {
    require DIR_FS_SMARTY . 'catalog/languages/' . $_SESSION['language'] . '/' . FILENAME_SHOPPING_CART;
    $site_trail->add(NAVBAR_TITLE, xos_href_link(FILENAME_SHOPPING_CART));
    require DIR_WS_INCLUDES . 'html_header.php';
    require DIR_WS_INCLUDES . 'boxes.php';
    require DIR_WS_INCLUDES . 'header.php';
    require DIR_WS_INCLUDES . 'footer.php';
    if ($_SESSION['cart']->count_contents() > 0) {
        $any_out_of_stock = 0;
        $products = $_SESSION['cart']->get_products($currencies->currencies[$_SESSION['currency']]['value']);
        $tax_address_query = xos_db_query("select ab.entry_country_id, ab.entry_zone_id from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) where ab.customers_id = '" . (int) $_SESSION['customer_id'] . "' and ab.address_book_id = '" . (int) ($_SESSION['cart']->get_content_type() == 'virtual' ? $_SESSION['billto'] : $_SESSION['sendto']) . "'");
        $tax_address = xos_db_fetch_array($tax_address_query);
        $tax_rates = array();
        $products_array = array();
        for ($i = 0, $n = sizeof($products); $i < $n; $i++) {
            $products_tax_rate = xos_get_tax_rate($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']);
            $attributes_options_values_price = false;
            if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
                $hidden_field = '';
                $attributes_array = array();
                reset($products[$i]['attributes']);
                while (list($option, $value) = each($products[$i]['attributes'])) {
                    $hidden_field = xos_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
                    $attributes = xos_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix\n                                      from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n                                      where pa.products_id = '" . (int) $products[$i]['id'] . "'\n                                       and pa.options_id = '" . (int) $option . "'\n                                       and pa.options_id = popt.products_options_id\n                                       and pa.options_values_id = '" . (int) $value . "'\n                                       and pa.options_values_id = poval.products_options_values_id\n                                       and popt.language_id = '" . (int) $_SESSION['languages_id'] . "'\n                                       and poval.language_id = '" . (int) $_SESSION['languages_id'] . "'");
                    $attributes_values = xos_db_fetch_array($attributes);
                    $options_values_price = '';
                    if ($attributes_values['options_values_price'] != 0) {
                        $attributes_options_values_price = true;
                        $options_values_price = $currencies->format(xos_add_tax($currencies->currencies[$_SESSION['currency']]['value'] * $attributes_values['options_values_price'], $products_tax_rate));
                    }
                    $attributes_array[] = array('products_options_name' => $attributes_values['products_options_name'], 'options_values_id' => $value, 'products_options_values_name' => $attributes_values['products_options_values_name'], 'options_values_price' => $options_values_price, 'hidden_field' => $hidden_field, 'price_prefix' => $attributes_values['price_prefix']);