function process()
 {
     global $order, $currencies;
     if (MODULE_ORDER_TOTAL_VERPACKUNG_LOW_ORDER_FEE == TRUE_STRING_S) {
         switch (MODULE_ORDER_TOTAL_VERPACKUNG_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'] - $order->info['verpackung_cost'] < MODULE_ORDER_TOTAL_VERPACKUNG_ORDER_UNDER) {
             $tax = olc_get_tax_rate(MODULE_ORDER_TOTAL_VERPACKUNG_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
             $tax_description = olc_get_tax_description(MODULE_ORDER_TOTAL_VERPACKUNG_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
             $order->info['tax'] += olc_calculate_tax(MODULE_ORDER_TOTAL_VERPACKUNG_FEE, $tax);
             $order->info['tax_groups']["{$tax_description}"] += olc_calculate_tax(MODULE_ORDER_TOTAL_VERPACKUNG_FEE, $tax);
             $order->info['total'] += MODULE_ORDER_TOTAL_VERPACKUNG_FEE + olc_calculate_tax(MODULE_ORDER_TOTAL_VERPACKUNG_FEE, $tax);
             $this->output[] = array('title' => $this->title . ':', 'text' => $currencies->format(olc_add_tax(MODULE_ORDER_TOTAL_VERPACKUNG_FEE, $tax), true, $order->info['currency'], $order->info['currency_value']), 'value' => olc_add_tax(MODULE_ORDER_TOTAL_VERPACKUNG_FEE, $tax));
         }
     }
 }
function olc_get_products_attribute_price($attribute_price, $tax_class, $price_special, $quantity, $prefix, $calculate_currencies = TRUE_STRING_S)
{
    if ($_SESSION['customers_status']['customers_status_show_price'] == '1') {
        $attribute_tax = olc_get_tax_rate($tax_class);
        // check if user is allowed to see tax rates
        if ($_SESSION['customers_status']['customers_status_show_price_tax'] == '0') {
            $attribute_tax = '';
        }
        // add tax
        $price_string = olc_add_tax($attribute_price, $attribute_tax) * $quantity;
        if ($_SESSION['customers_status']['customers_status_discount_attributes'] == '0') {
            // format price & calculate currency
            $price_string = olc_format_price($price_string, $price_special, $calculate_currencies);
            if ($price_special == '1') {
                $price_string = BLANK . $prefix . BLANK . $price_string . BLANK;
            }
        } else {
            $discount = $_SESSION['customers_status']['customers_status_discount'];
            $rabatt_string = $price_string - $price_string / 100 * $discount;
            $price_string = olc_format_price($price_string, $price_special, $calculate_currencies);
            $rabatt_string = olc_format_price($rabatt_string, $price_special, $calculate_currencies);
            if ($price_special == '1' && $price_string != $rabatt_string) {
                $price_string = BLANK . $prefix . '<font color="ff0000"><s>' . $price_string . '</s></font> ' . $rabatt_string . BLANK;
            } else {
                $price_string = $rabatt_string;
                if ($price_special == '1') {
                    $price_string = BLANK . $prefix . BLANK . $price_string;
                }
            }
        }
    } else {
        $price_string = '  ' . NOT_ALLOWED_TO_SEE_PRICES;
    }
    return $price_string;
}
function olc_format_price_graduated($price_string, $price_special, $calculate_currencies, $products_tax_class)
{
    if ((int) $price_string == 0) {
        $price_string = EMPTY_STRING;
    } else {
        include DIR_FS_INC . 'olc_get_currency_parameters.inc.php';
        if ($calculate_currencies == TRUE_STRING_S) {
            $price_string = $price_string * CURRENCY_VALUE;
        }
        // add tax
        if ($_SESSION['customers_status']['customers_status_show_price_tax'] != '0') {
            $products_tax = olc_get_tax_rate($products_tax_class);
            $price_string = olc_add_tax($price_string, $products_tax);
        }
        // round price
        $price_string = olc_precision($price_string, CURRENCY_DECIMAL_PLACES);
        if ($price_special == '1') {
            $price_string = number_format($price_string, CURRENCY_DECIMAL_PLACES, CURRENCY_DECIMAL_POINT, CURRENCY_THOUSANDS_POINT);
            $price_string = CURRENCY_SYMBOL_LEFT . $price_string . CURRENCY_SYMBOL_RIGHT;
        }
        //1,00 -> 1,--
        global $is_print_version, $is_pdf;
        if ($is_print_version) {
            if ($is_pdf) {
                $s = CURRENCY_DECIMAL_ZEROES_DASHES_PRINT_PDF;
            } else {
                $s = CURRENCY_DECIMAL_ZEROES_DASHES_PRINT;
            }
        } else {
            $s = CURRENCY_DECIMAL_ZEROES_DASHES;
        }
        $price_string = str_replace(CURRENCY_DECIMAL_ZEROES, $s, $price_string);
    }
    return $price_string;
}
 function process()
 {
     global $order, $currencies;
     if (MODULE_ORDER_TOTAL_LOWORDERFEE_LOW_ORDER_FEE == TRUE_STRING_S) {
         $pass = false;
         if ($_SESSION['shipping']['id'] != 'selfpickup_selfpickup') {
             $country = $order->delivery['country_id'];
             switch (MODULE_ORDER_TOTAL_LOWORDERFEE_DESTINATION) {
                 case 'national':
                     if ($country == STORE_COUNTRY) {
                         $pass = true;
                     }
                     break;
                 case 'international':
                     if ($country != STORE_COUNTRY) {
                         $pass = true;
                     }
                     break;
                 case 'both':
                     $pass = true;
                     break;
             }
         }
         if ($pass) {
             if ($order->info['total'] - $order->info['shipping_cost'] < MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER) {
                 $delivery_country = $order->delivery['country']['id'];
                 $delivery_zone_id = $order->delivery['zone_id'];
                 $tax = olc_get_tax_rate(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $delivery_country, $delivery_zone_id);
                 $tax_description = olc_get_tax_description(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $delivery_country, $delivery_zone_id);
                 $low_order_fee = MODULE_ORDER_TOTAL_LOWORDERFEE_FEE;
                 $low_order_fee_tax = olc_calculate_tax($low_order_fee, $tax);
                 $low_order_fee = olc_add_tax($low_order_fee, $tax);
                 if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 1) {
                     $order->info['tax'] += $low_order_fee_tax;
                     $order->info['tax_groups'][TAX_ADD_TAX . "{$tax_description}"] += $low_order_fee_tax;
                     $order->info['total'] += $low_order_fee;
                 } else {
                     if ($_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
                         $order->info['tax'] += $low_order_fee_tax;
                         $order->info['tax_groups'][TAX_NO_TAX . "{$tax_description}"] += $low_order_fee_tax;
                     }
                     $order->info['subtotal'] += $low_order_fee;
                     $order->info['total'] += $low_order_fee;
                 }
                 $this->output[] = array('title' => $this->title . ':', 'text' => olc_format_price($low_order_fee, 1, 1, 1), 'value' => $low_order_fee);
             }
         }
     }
 }
 function process()
 {
     global $order, $currencies, $customer_id;
     //      if (MODULE_ORDER_TOTAL_HANDLING_HANDLING == TRUE_STRING_S) {
     $freequery = olc_db_query("SELECT SUM(cb.customers_basket_quantity) AS total FROM " . TABLE_CUSTOMERS_BASKET . " cb LEFT JOIN " . TABLE_PRODUCTS . " p ON cb.products_id = p.products_id WHERE cb.customers_id =  '" . $customer_id . "' AND cb.final_price <  '0.01' AND p.products_price <  '0.01'");
     $freestuff = olc_db_fetch_array($freequery);
     $freeitems = $freestuff['total'];
     $handlingfree = $order->info['subtotal'] / 100 * 0.85;
     $tax = olc_get_tax_rate(MODULE_ORDER_TOTAL_HANDLING_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
     $tax_description = olc_get_tax_description(MODULE_ORDER_TOTAL_HANDLING_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
     $order->info['tax'] += olc_calculate_tax($handlingfree, $tax);
     $order->info['tax_groups']["{$tax_description}"] += olc_calculate_tax($handlingfree, $tax);
     $order->info['total'] += $handlingfree + olc_calculate_tax($handlingfree, $tax);
     $this->output[] = array('title' => $this->title . ':', 'text' => olc_format_price(olc_add_tax($handlingfree, $tax), true, $order->info['currency'], $order->info['currency_value']), 'value' => olc_add_tax($handlingfree, $tax));
 }
function olc_oe_get_products_attribute_price($attribute_price, $tax_class, $price_special, $quantity, $prefix, $calculate_currencies = TRUE_STRING_S, $customer_status)
{
    $customers_status_query = olc_db_query("select * from " . TABLE_CUSTOMERS_STATUS . " where customers_status_id = '" . $customer_status . "' ");
    $customers_status = olc_db_fetch_array($customers_status_query);
    if ($customers_status['customers_status_show_price'] == '1') {
        $attribute_tax = olc_get_tax_rate($tax_class);
        // check if user is allowed to see tax rates
        if ($customers_status['customers_status_show_price_tax'] == '0') {
            $attribute_tax = '';
        }
        // add tax
        $price_string = olc_add_tax($attribute_price, $attribute_tax) * $quantity;
        if ($customers_status['customers_status_discount_attributes'] == '0') {
            // format price & calculate currency
            $price_string = olc_format_price($price_string, $price_special, $calculate_currencies);
            if ($price_special == '1') {
                $price_string = BLANK . $prefix . BLANK . $price_string . BLANK;
            }
        } else {
            $discount = $customers_status['customers_status_discount'];
            $rabatt_string = $price_string - $price_string / 100 * $discount;
            $price_string = olc_format_price($price_string, $price_special, $calculate_currencies);
            $rabatt_string = olc_format_price($rabatt_string, $price_special, $calculate_currencies);
            if ($price_special == '1' && $price_string != $rabatt_string) {
                $price_string = BLANK . $prefix . '<font color="ff0000"><s>' . $price_string . '</s></font> ' . $rabatt_string . BLANK;
            } else {
                $price_string = $rabatt_string;
                if ($price_special == '1') {
                    $price_string = BLANK . $prefix . BLANK . $price_string;
                }
            }
        }
    } else {
        $price_string = '  ' . NOT_ALLOWED_TO_SEE_PRICES;
    }
    return $price_string;
}
 function get_order_total()
 {
     global $order, $olPrice;
     $module = substr($_SESSION['shipping']['id'], 0, strpos($_SESSION['shipping']['id'], '_'));
     $shipping_tax = olc_get_tax_rate($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
         $order_total = $order->info['tax'] + $order->info['total'];
     }
     if ($_SESSION['customers_status']['customers_status_show_price_tax'] != 0) {
         $order_total = $order->info['total'];
     }
     if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 0) {
         $order_total = $order->info['total'];
     }
     // Check if gift voucher is in cart and adjust total
     $products = $_SESSION['cart']->get_products();
     for ($i = 0; $i < sizeof($products); $i++) {
         $t_prid = olc_get_prid($products[$i]['id']);
         $gv_query = olc_db_query("select products_price, products_tax_class_id, products_model from " . TABLE_PRODUCTS . " where products_id = '" . $t_prid . APOS);
         $gv_result = olc_db_fetch_array($gv_query);
         if (ereg('^GIFT', addslashes($gv_result['products_model']))) {
             $qty = $_SESSION['cart']->get_quantity($t_prid);
             $products_tax = $olPrice->TAX[$gv_result['products_tax_class_id']];
             if ($this->include_tax == FALSE_STRING_S) {
                 $gv_amount = $gv_result['products_price'] * $qty;
             } else {
                 $gv_amount = ($gv_result['products_price'] + $olPrice->calcTax($gv_result['products_price'], $products_tax)) * $qty;
             }
             $order_total = $order_total - $gv_amount;
         }
     }
     if ($this->include_tax == FALSE_STRING_S && !($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 0)) {
         $order_total = $order_total - $order->info['tax'];
     }
     if ($this->include_shipping == FALSE_STRING_S) {
         $order_total = $order_total - $order->info['shipping_cost'];
         if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 1) {
             $order_total += $order->info['shipping_cost'] / (100 + $shipping_tax) * $shipping_tax;
         }
     }
     // OK thats fine for global coupons but what about restricted coupons
     // where you can only redeem against certain products/categories.
     // and I though this was going to be easy !!!
     $coupon_query = olc_db_query("select coupon_code from " . TABLE_COUPONS . " where coupon_id='" . $_SESSION['cc_id'] . APOS);
     if (olc_db_num_rows($coupon_query) != 0) {
         $coupon_result = olc_db_fetch_array($coupon_query);
         $coupon_get = olc_db_query("select coupon_amount, coupon_minimum_order,restrict_to_products,restrict_to_categories, coupon_type from " . TABLE_COUPONS . " where coupon_code='" . $coupon_result['coupon_code'] . APOS);
         $get_result = olc_db_fetch_array($coupon_get);
         $in_cat = false;
         $in_cart = false;
         if ($get_result['restrict_to_categories']) {
             $cat_ids = split("[,]", $get_result['restrict_to_categories']);
             for ($i = 0; $i < count($cat_ids); $i++) {
                 if (is_array($_SESSION['cart']->contents)) {
                     reset($_SESSION['cart']->contents);
                     while (list($products_id, ) = each($_SESSION['cart']->contents)) {
                         $cat_query = olc_db_query("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . $products_id . "' and categories_id = '" . $cat_ids[$i] . APOS);
                         if (olc_db_num_rows($cat_query) != 0 && stristr($pr_in_cat, olc_get_prid($products_id)) === FALSE) {
                             $in_cat = true;
                             $pr_in_cat .= ',' . $products_id;
                             $total_price += $this->get_product_price($products_id);
                         }
                     }
                 }
             }
         }
         if ($get_result['restrict_to_products']) {
             $pr_ids = split("[,]", $get_result['restrict_to_products']);
             $products_array = $_SESSION['cart']->get_products();
             for ($i = 0; $i < sizeof($pr_ids); $i++) {
                 for ($ii = 1; $ii <= sizeof($products_array); $ii++) {
                     if (olc_get_prid($products_array[$ii - 1]['id']) == $pr_ids[$i] && stristr($pr_in_cat, olc_get_prid($products_array[$ii - 1]['id'])) === FALSE) {
                         $in_cart = true;
                         $total_price += $this->get_product_price($products_array[$ii - 1]['id']);
                     }
                 }
             }
         }
         if ($in_cat || $in_cart) {
             if ($this->include_shipping == TRUE_STRING_S) {
                 if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
                     if ($this->include_tax == FALSE_STRING_S) {
                         $total_price += $order->info['shipping_cost'];
                     } else {
                         $total_price += olc_add_tax($order->info['shipping_cost'], $shipping_tax);
                         // original code         $total_price += $order->info['shipping_cost'] = olc_add_tax($order->info['shipping_cost'], $shipping_tax);
                     }
                 } else {
                     if ($this->include_tax == FALSE_STRING_S) {
                         $total_price += $order->info['shipping_cost'];
                         if (!($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 0)) {
                             $total_price -= $order->info['shipping_cost'] / (100 + $shipping_tax) * $shipping_tax;
                         }
                     } else {
                         $total_price += $order->info['shipping_cost'];
                     }
                 }
             }
             if ($total_price > $order_total) {
                 $total_price = $order_total;
             }
             $order_total = $total_price;
         }
     }
     return $order_total;
 }
 function calculate()
 {
     $this->total = 0;
     $this->weight = 0;
     if (!is_array($this->contents)) {
         return 0;
     }
     reset($this->contents);
     while (list($products_id, ) = each($this->contents)) {
         $qty = $this->contents[$products_id]['qty'];
         // products price
         $product_query = olc_db_query("select products_id, products_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id='" . olc_get_prid($products_id) . APOS);
         if ($product = olc_db_fetch_array($product_query)) {
             $prid = $product['products_id'];
             $products_tax = olc_get_tax_rate($product['products_tax_class_id']);
             $products_price = $product['products_price'];
             $products_weight = $product['products_weight'];
             $specials_query = olc_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . $prid . "' and status = '1'");
             if (olc_db_num_rows($specials_query)) {
                 $specials = olc_db_fetch_array($specials_query);
                 $products_price = $specials['specials_new_products_price'];
             }
             $this->total += olc_add_tax($products_price, $products_tax) * $qty;
             $this->weight += $qty * $products_weight;
         }
         // attributes price
         if ($this->contents[$products_id]['attributes']) {
             reset($this->contents[$products_id]['attributes']);
             while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
                 $attribute_price_query = olc_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . $prid . "' and options_id = '" . $option . "' and options_values_id = '" . $value . APOS);
                 $attribute_price = olc_db_fetch_array($attribute_price_query);
                 if ($attribute_price['price_prefix'] == '+') {
                     $this->total += $qty * olc_add_tax($attribute_price['options_values_price'], $products_tax);
                 } else {
                     $this->total -= $qty * olc_add_tax($attribute_price['options_values_price'], $products_tax);
                 }
             }
         }
     }
 }
                    }
                    $shipping_block .= '
											<tr class="moduleRow' . $id . ' onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)"
												onclick="javascript:selectRowEffect(this, ' . $radio_buttons . ')">' . NEW_LINE;
                    if ($OptionBoxRight) {
                        $shipping_block .= '
												<td class="main" width="75%">' . $current_quotes_methods['title'] . '</td>';
                    } else {
                        $shipping_block .= '
												<td class="main" align="left" width="10">' . olc_draw_radio_field('shipping', $current_id, $checked) . '
												</td>';
                    }
                    if (!CUSTOMER_SHOW_PRICE_TAX) {
                        $current_quotes['tax'] = 0;
                    }
                    $cost = olc_format_price(olc_add_tax($current_quotes_methods['cost'], $current_quotes['tax']), $price_special = 1, $calculate_currencies = true);
                    if ($n > 1 || $n2 > 1) {
                        $radio = olc_draw_radio_field('shipping', $current_id, $checked);
                        if ($OptionBoxRight) {
                            $shipping_block .= '
											<td class="main">' . $cost . '</td>
											<td class="main" align="right">' . $radio . '</td>';
                        } else {
                            $shipping_block .= '
											<td class="main" width="75%" align="left">' . $current_quotes_methods['title'] . '</td>
											<td class="main">' . $cost . '</td>';
                        }
                    } else {
                        $shipping_block .= '
											<td class="main" align="right" colspan="2">' . $cost . $radio . '</td>';
                    }
Esempio n. 10
0
function olc_oe_products_price($products_id, $price_special, $quantity, $customer_status)
{
    $customers_status_query = olc_db_query("select * from " . TABLE_CUSTOMERS_STATUS . " where customers_status_id = '" . $customer_status . "' ");
    $customers_status = olc_db_fetch_array($customers_status_query);
    // check if customer is allowed to see prices (if not -> no price calculations , show error message)
    if ($customers_status[customers_status_show_price] == '1') {
        // load price data into array for further use!
        $product_price_query = olc_db_query("SELECT   products_price,\n\t\t\t\t\t\t\t\t\t\t\tproducts_discount_allowed,\n\t\t\t\t\t\t\t\t\t\t\tproducts_tax_class_id\n\t\t\t\t\t\t\t\t\t\t\tFROM " . TABLE_PRODUCTS . " \n\t\t\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\t\tproducts_id = '" . $products_id . APOS);
        $product_price = olc_db_fetch_array($product_price_query);
        $price_data = array();
        $price_data = array('PRODUCTS_PRICE' => $product_price['products_price'], 'PRODUCTS_DISCOUNT_ALLOWED' => $product_price['products_discount_allowed'], 'PRODUCT_TAX_CLASS_ID' => $product_price['products_tax_class_id']);
        // get tax rate for tax class
        $products_tax = olc_get_tax_rate($price_data['PRODUCT_TAX_CLASS_ID']);
        // check if user is allowed to see tax rates
        if ($customers_status['customers_status_show_price_tax'] == '0') {
            $products_tax = '';
        }
        // end $customers_status['customers_status_show_price_tax'] =='0'
        // check if special price is aviable for product (no product discount on special prices!)
        if ($special_price = olc_get_products_special_price($products_id)) {
            $special_price = olc_add_tax($special_price, $products_tax);
            $price_data['PRODUCTS_PRICE'] = olc_add_tax($price_data['PRODUCTS_PRICE'], $products_tax);
            $price_string = olc_format_special_price($special_price, $price_data['PRODUCTS_PRICE'], $price_special, $calculate_currencies = true, $quantity, $products_tax);
        } else {
            // if ($special_price=olc_get_products_special_price($products_id))
            // Check if there is another price for customers_group (if not, take norm price and calculte discounts (NOTE: no discount on group PRICES(only OT DISCOUNT!)!
            $group_price_query = olc_db_query("SELECT personal_offer\n\t\t\t\t\t\t\t\t\t         FROM " . TABLE_PERSONAL_OFFERS_BY_CUSTOMERS_STATUS . $customers_status['customers_status_id'] . "\n\t\t\t\t\t\t\t\t\t         WHERE products_id='" . $products_id . APOS);
            $group_price_data = olc_db_fetch_array($group_price_query);
            // if we found a price, everything is ok if not, we will use normal price
            if ($group_price_data['personal_offer'] != '' and $group_price_data['personal_offer'] != '0.0000') {
                $price_string = $group_price_data['personal_offer'];
                // check if customer is allowed to get graduated prices
                if ($customers_status['customers_status_graduated_prices'] == '1') {
                    // check if there are graduated prices in db
                    // get quantity for products
                    // modifikations for new graduated prices
                    $qty = olc_get_qty($products_id);
                    if (!olc_get_qty($products_id)) {
                        $qty = $quantity;
                    }
                    $graduated_price_query = olc_db_query("SELECT max(quantity)\n\t\t\t\t\t\t\t\t\t                      FROM " . TABLE_PERSONAL_OFFERS_BY_CUSTOMERS_STATUS . $customers_status['customers_status_id'] . "\n\t\t\t\t\t\t\t\t\t                      WHERE products_id='" . $products_id . "'\n\t\t\t\t\t\t\t\t\t                      AND quantity<='" . $qty . APOS);
                    $graduated_price_data = olc_db_fetch_array($graduated_price_query);
                    // get singleprice
                    $graduated_price_query = olc_db_query("SELECT personal_offer\n\t\t\t\t\t                              FROM " . TABLE_PERSONAL_OFFERS_BY_CUSTOMERS_STATUS . $customers_status['customers_status_id'] . "\n\t\t\t\t\t\t\t\t\t                      WHERE products_id='" . $products_id . "'\n\t\t\t\t\t\t\t\t\t                      AND quantity='" . $graduated_price_data['max(quantity)'] . APOS);
                    $graduated_price_data = olc_db_fetch_array($graduated_price_query);
                    $price_string = $graduated_price_data['personal_offer'];
                }
                // end $_SESSION['customers_status']['customers_status_graduated_prices']=='1'
                $price_string = olc_add_tax($price_string, $products_tax);
                //*$quantity;
            } else {
                // if 	($group_price_data['personal_offer']!='' and $group_price_data['personal_offer']!='0.0000')
                $price_string = olc_add_tax($price_data['PRODUCTS_PRICE'], $products_tax);
                //*$quantity;
                // check if product allows discount
                if ($price_data['PRODUCTS_DISCOUNT_ALLOWED'] != '0.00') {
                    $discount = $price_data['PRODUCTS_DISCOUNT_ALLOWED'];
                    // check if group discount > max. discount on product
                    if ($discount > $customers_status['customers_status_discount']) {
                        $discount = $customers_status['customers_status_discount'];
                    }
                    // calculate price with rabatt
                    $rabatt_string = $price_string - $price_string / 100 * $discount;
                    if ($price_string == $rabatt_string) {
                        $price_string = olc_format_price($price_string * $quantity, $price_special, $calculate_currencies = true);
                    } else {
                        $price_string = olc_format_special_price($rabatt_string, $price_string, $price_special, $calculate_currencies = false, $quantity, $products_tax);
                    }
                    return $price_string;
                    break;
                }
            }
            // format price & calculate currency
            if ($price_string == '0.00') {
                $price_string = TEXT_NO_PRICE;
            } else {
                $price_string = olc_format_price($price_string * $quantity, $price_special, $calculate_currencies = true);
            }
        }
    } else {
        // return message, if not allowed to see prices
        $price_string = NOT_ALLOWED_TO_SEE_PRICES;
    }
    // end ($customers_status['customers_status_show_price'] == '1')
    return $price_string;
}
 $random_query = SELECT . "\n\tp.products_id,\n\tpd.products_name,\n\tp.products_price,\n\tp.products_tax_class_id,\n\tp.products_image,\n\tp.products_vpe,\n\tp.products_vpe_status,\n\tp.products_vpe_value,\n\tp2c.categories_id,\n\tcd.categories_name\n\tfrom " . TABLE_PRODUCTS . " p,\t" . TABLE_PRODUCTS_DESCRIPTION . " pd," . TABLE_PRODUCTS_TO_CATEGORIES . " p2c,\t" . TABLE_CATEGORIES_DESCRIPTION . " cd\n\twhere\n\tp.products_status = 1\n\tand p.products_id = " . $products_id . "\n\tand pd.products_id = " . $products_id . "\n\tand p2c.products_id = " . $products_id . "\n\tand pd.language_id = " . SESSION_LANGUAGE_ID . "\n\tand cd.categories_id = p2c.categories_id " . $group_check . $fsk_lock . "\n\tand cd.language_id = " . SESSION_LANGUAGE_ID;
 $random_query = olc_db_query($random_query);
 $random_product = olc_db_fetch_array($random_query, true);
 if (CUSTOMER_SHOW_PRICE) {
     $random_products_price = abs($random_product['products_price']);
     $tax_class = $random_product['products_tax_class_id'];
     if (OL_COMMERCE) {
         $olPrice = round($random_products_price, CURRENCY_DECIMAL_PLACES);
         include_once DIR_FS_INC . 'olc_get_vpe_and_baseprice_info.inc.php';
         $vpe = array();
         olc_get_vpe_and_baseprice_info($vpe, $random_product, $olPrice);
         $vpe = $vpe['PRODUCTS_VPE'];
         include DIR_FS_INC . 'olc_get_price_disclaimer.inc.php';
         $tax_info = $price_disclaimer;
         if (CUSTOMER_SHOW_PRICE_TAX) {
             $random_products_price = olc_add_tax($random_products_price, $tax_class);
         }
     } else {
         $random_products_price_real = $random_products_price;
         if (!is_object($product)) {
             $product = new product();
         }
         $vpe = $product->getVPEtext($random_product, $random_products_price);
         $random_products_price = $xtPrice->xtcFormat($random_products_price, true, $tax_class, true, false);
         $tax_info = $main->getTaxInfo(olc_get_tax_rate($tax_class));
         $picture_disclaimer = EMPTY_STRING;
     }
 }
 $categories_id = $random_product['categories_id'];
 $products_name = $random_product['products_name'];
 if ($products_name) {
 function displayPrice($amount, $tax, $qty = 1)
 {
     global $currencies;
     if (DISPLAY_PRICE_WITH_TAX == TRUE_STRING_S && $tax > 0) {
         return $currencies->format(olc_add_tax($amount, $tax) * $qty, true, $this->currency, $this->currency_value);
     }
     return $currencies->format($amount * $qty, true, $this->currency, $this->currency_value);
 }
Esempio n. 13
0
function olc_get_products_price($products_id, $price_special, $quantity, &$price_real)
{
    global $price_data;
    // check if customer is allowed to see prices (if not -> no price calculations , show error message)
    if (CUSTOMER_SHOW_PRICE) {
        // load price data into array for further use!
        $product_price_query = olc_db_query(SELECT . "\n\t  products_price,\n\t\tproducts_discount_allowed,\n\t\tproducts_tax_class_id\n\t\tFROM " . TABLE_PRODUCTS . "\n\t\tWHERE\n\t\tproducts_id = '" . $products_id . APOS);
        $product_price = olc_db_fetch_array($product_price_query);
        $price_real = $product_price['products_price'];
        $price_data = array('PRODUCTS_PRICE' => $price_real, 'PRODUCTS_UVP' => $price_uvp, 'PRODUCTS_DISCOUNT_ALLOWED' => $product_price['products_discount_allowed'], 'PRODUCT_TAX_CLASS_ID' => $product_price['products_tax_class_id']);
        // check if user is allowed to see tax rates
        if (CUSTOMER_SHOW_PRICE_TAX) {
            // get tax rate for tax class
            $products_tax = olc_get_tax_rate($price_data['PRODUCT_TAX_CLASS_ID']);
        } else {
            $products_tax = 0;
        }
        // end !CUSTOMER_SHOW_PRICE_TAX
        $price_data['PRODUCTS_TAX_VALUE'] = $products_tax . ' %';
        // check if special price is aviable for product (no product discount on special prices!)
        //W. Kaiser - AJAX
        $special_price = olc_get_products_special_price($products_id);
        if ($special_price) {
            //W. Kaiser - AJAX
            $special_price = olc_add_tax($special_price, $products_tax);
            $price = olc_add_tax($price_data['PRODUCTS_PRICE'], $products_tax);
            $price_data['PRODUCTS_PRICE'] = $price;
            $price_string = olc_format_special_price($special_price, $price, $price_special, true, $quantity, $products_tax);
        } else {
            // if ($special_price=olc_get_products_special_price($products_id))
            // Check if there is another price for customers_group (if not, take norm price and calculte discounts (NOTE: no discount on group PRICES(only OT DISCOUNT!)!
            $table_personal_offers = TABLE_PERSONAL_OFFERS_BY_CUSTOMERS_STATUS . CUSTOMER_STATUS_ID;
            $group_price_query = olc_db_query(SELECT . "\n\t\t\tpersonal_offer\n      FROM " . $table_personal_offers . "\n      WHERE products_id='" . $products_id . APOS);
            $group_price_data = olc_db_fetch_array($group_price_query);
            // if we found a price, everything is ok. If not, we will use normal price
            if ($group_price_data['personal_offer'] and $group_price_data['personal_offer'] != '0.0000') {
                $price_string = $group_price_data['personal_offer'];
                // check if customer is allowed to get graduated prices
                if (CUSTOMER_SHOW_GRADUATED_PRICE) {
                    // check if there are graduated prices in db
                    // get quantity for products
                    // modifikations for new graduated prices
                    $qty = olc_get_qty($products_id);
                    if (!olc_get_qty($products_id)) {
                        $qty = $quantity;
                    }
                    $graduated_price_query = olc_db_query(SELECT . "\n\t\t\t\t\t\t\t\tmax(quantity)\n                FROM " . $table_personal_offers . "\n                WHERE products_id='" . $products_id . "'\n                AND quantity<='" . $qty . APOS);
                    $graduated_price_data = olc_db_fetch_array($graduated_price_query);
                    // get singleprice
                    $graduated_price_query = olc_db_query(SELECT . "\n\t\t\t\t\t\tpersonal_offer\n\t          FROM " . $table_personal_offers . "\n            WHERE products_id='" . $products_id . "'\n            AND quantity='" . $graduated_price_data['max(quantity)'] . APOS);
                    $graduated_price_data = olc_db_fetch_array($graduated_price_query);
                    $price_string = $graduated_price_data['personal_offer'];
                }
                $price_string = olc_add_tax($price_string, $products_tax);
                //*$quantity;
            } else {
                // if 	($group_price_data['personal_offer']!=EMPTY_STRING and $group_price_data['personal_offer']!='0.0000')
                $price_string = olc_add_tax($price_data['PRODUCTS_PRICE'], $products_tax);
                //*$quantity;
                // check if product allows discount
                if ($price_data['PRODUCTS_DISCOUNT_ALLOWED'] != '0.00') {
                    $discount = $price_data['PRODUCTS_DISCOUNT_ALLOWED'];
                    // check if group discount > max. discount on product
                    if ($discount > CUSTOMER_DISCOUNT) {
                        $discount = CUSTOMER_DISCOUNT;
                    }
                    // calculate price with rabatt
                    $rabatt_string = $price_string - $price_string / 100 * $discount;
                    if ($price_string == $rabatt_string) {
                        $price_string = olc_format_price($price_string * $quantity, $price_special, true);
                    } else {
                        $price_string = olc_format_special_price($rabatt_string, $price_string, $price_special, false, $quantity, $products_tax);
                    }
                    return $price_string;
                    break;
                }
            }
            // format price & calculate currency
            $price_string = olc_format_price($price_string * $quantity, $price_special, $calculate_currencies = true);
        }
    } else {
        // return message, if not allowed to see prices
        $price_string = NOT_ALLOWED_TO_SEE_PRICES;
    }
    return $price_string;
}
 function display_price($products_price, $products_tax, $quantity = 1)
 {
     return $this->format(olc_add_tax($products_price, $products_tax) * $quantity);
 }
Esempio n. 15
0
function format_price($price_string, $price_special, $currency, $allow_tax, $tax_rate)
{
    if ($price_string) {
        if ($allow_tax == 1) {
            $price_string = olc_add_tax($price_string, $tax_rate);
        }
        $price_string = olc_format_price($price_string, 1, 1);
    }
    return $price_string;
}
             $title = $products_name . $title . $s . $title . TEXT_FURTHER_INFO;
             $image = olc_image(DIR_WS_THUMBNAIL_IMAGES . $image, $title);
         }
         if (CUSTOMER_SHOW_PRICE) {
             $price = abs($best_sellers['products_price']);
             $tax_class = $best_sellers['products_tax_class_id'];
             if (OL_COMMERCE) {
                 $olPrice = round($price, CURRENCY_DECIMAL_PLACES);
                 include_once DIR_FS_INC . 'olc_get_vpe_and_baseprice_info.inc.php';
                 $vpe = array();
                 olc_get_vpe_and_baseprice_info($vpe, $best_sellers, $olPrice);
                 $vpe = $vpe['PRODUCTS_VPE'];
                 include DIR_FS_INC . 'olc_get_price_disclaimer.inc.php';
                 $tax_info = $price_disclaimer;
                 if (CUSTOMER_SHOW_PRICE_TAX) {
                     $price = olc_add_tax($price, $tax_class);
                 }
                 $price = olc_format_price($price, true, true);
             } else {
                 if (!is_object($product)) {
                     $product = new product();
                 }
                 $vpe = $product->getVPEtext($best_sellers, $price);
                 $price = $xtPrice->xtcFormat($price, true, $tax_class, true, false);
                 $tax_info = $main->getTaxInfo(olc_get_tax_rate($tax_class));
                 $picture_disclaimer = EMPTY_STRING;
             }
         }
         $box_content[] = array('ID' => olc_row_number_format($rows), 'NAME' => $best_sellers['products_name'], 'PRICE' => $price, 'VPE' => $vpe, 'TAX_INFO' => $tax_info, 'SHORT_DESCRIPTION' => $products_short_description, 'PICTURE_DISCLAIMER' => $picture_disclaimer, 'IMAGE' => $image, 'LINK' => olc_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers['products_id']));
     }
 }
 //Show the products information line by line
 $total_price = array();
 for ($i = 0, $n = sizeof($order->products) - 1; $i <= $n; $i++) {
     $current_product = $order->products[$i];
     $qty = $current_product[$qty_text];
     $model = $current_product[$model_text];
     $name = BLANK . $current_product[$name_text] . BLANK;
     $name_len = strlen($name);
     $tax = $current_product[$tax_text];
     $price = $current_product[$price_text];
     $final_price = $current_product[$final_price_text];
     $total_price[$tax] .= $final_price;
     if (NOT_NO_TAX_RAISED) {
         if (CUSTOMER_SHOW_PRICE_TAX) {
             $price = olc_add_tax($price, $tax);
             $final_price = olc_add_tax($final_price, $tax);
         }
         $tax = olc_precision($tax, $tax_precision);
         $tax = number_format($tax, $tax_precision, CURRENCY_DECIMAL_POINT, CURRENCY_THOUSANDS_POINT);
     }
     $pdf->SetFont($pdf->font, NO_FORMAT, 10);
     $pdf->SetY($Y_Table_Position);
     $current_product_attributes = $current_product['attributes'];
     $attributes = sizeof($current_product_attributes);
     if ($attributes) {
         if (($item_count + $attributes) % $items_per_page == 0) {
             new_page();
         }
     }
     $field = 0;
     Make_Cell($i + 1 . DOT, RIGHT, false);
 function process()
 {
     global $order, $currencies, $cod_cost, $cod_country, $shipping;
     if (strtolower(MODULE_ORDER_TOTAL_COD_STATUS) == TRUE_STRING_S) {
         //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
             $shipping_id = $_SESSION['shipping']['id'];
             $split_text = "[:,]";
             if ($shipping_id == 'flat_flat') {
                 $cod_zones = split($split_text, MODULE_ORDER_TOTAL_COD_FEE_FLAT);
             } elseif ($shipping_id == 'item_item') {
                 $cod_zones = split($split_text, MODULE_ORDER_TOTAL_COD_FEE_ITEM);
             } elseif ($shipping_id == 'table_table') {
                 $cod_zones = split($split_text, MODULE_ORDER_TOTAL_COD_FEE_TABLE);
             } elseif ($shipping_id == 'zones_zones') {
                 $cod_zones = split($split_text, MODULE_ORDER_TOTAL_COD_FEE_ZONES);
             } elseif ($shipping_id == 'ap_ap') {
                 $cod_zones = split($split_text, MODULE_ORDER_TOTAL_COD_FEE_AP);
             } elseif ($shipping_id == 'dp_dp') {
                 $cod_zones = split($split_text, MODULE_ORDER_TOTAL_COD_FEE_DP);
             } elseif ($shipping_id == 'dpd_dpd') {
                 $cod_zones = split($split_text, MODULE_ORDER_TOTAL_COD_FEE_DPD);
             } elseif ($shipping_id == 'ups_ups') {
                 $cod_zones = split($split_text, MODULE_ORDER_TOTAL_COD_FEE_UPS);
             } elseif ($shipping_id == 'upse_upse') {
                 $cod_zones = split($split_text, MODULE_ORDER_TOTAL_COD_FEE_UPSE);
             } elseif ($shipping_id == 'freeamountausl_freeamountausl') {
                 $cod_zones = split($split_text, MODULE_ORDER_TOTAL_COD_FEE_FREEAMOUNTAUSL);
             } elseif ($shipping_id == 'freeamount_freeamount') {
                 $cod_zones = split($split_text, MODULE_ORDER_TOTAL_COD_FEE_FREEAMOUNT);
             }
             $country_iso_code_2 = $order->billing['country']['iso_code_2'];
             for ($i = 0; $i < count($cod_zones); $i++) {
                 if ($cod_zones[$i] == $country_iso_code_2) {
                     $cod_cost = $cod_zones[$i + 1];
                     $cod_country = true;
                     //print('match' . $cod_zones[$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) {
             $cod_tax = olc_get_tax_rate(MODULE_ORDER_TOTAL_COD_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
             $cod_tax_description = olc_get_tax_description(MODULE_ORDER_TOTAL_COD_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
             if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 1) {
                 $order->info['tax'] += olc_add_tax($cod_cost, $cod_tax) - $cod_cost;
                 $order->info['tax_groups'][TAX_ADD_TAX . "{$cod_tax_description}"] += olc_add_tax($cod_cost, $cod_tax) - $cod_cost;
                 $order->info['total'] += $cod_cost + (olc_add_tax($cod_cost, $cod_tax) - $cod_cost);
                 $cod_cost_value = olc_add_tax($cod_cost, $cod_tax);
                 $cod_cost = olc_format_price($cod_cost_value, $price_special = 1, $calculate_currencies = true);
             }
             if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
                 $order->info['tax'] += olc_add_tax($cod_cost, $cod_tax) - $cod_cost;
                 $order->info['tax_groups'][TAX_NO_TAX . "{$cod_tax_description}"] += olc_add_tax($cod_cost, $cod_tax) - $cod_cost;
                 $cod_cost_value = $cod_cost;
                 $cod_cost = olc_format_price($cod_cost, $price_special = 1, $calculate_currencies = true);
                 $order->info['subtotal'] += $cod_cost_value;
                 $order->info['total'] += $cod_cost_value;
             }
             if (!$cod_cost_value) {
                 $cod_cost_value = $cod_cost;
                 $cod_cost = olc_format_price($cod_cost, $price_special = 1, $calculate_currencies = true);
                 $order->info['total'] += $cod_cost_value;
             }
             $this->output[] = array('title' => $this->title . ':', 'text' => $cod_cost, 'value' => $cod_cost_value);
         } 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' => '');
         }
     }
 }
Esempio n. 19
0
 $order_currency_value = $order->info['currency_value'];
 for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
     $current_product = $order->products[$i];
     $current_product_allow_tax = $current_product['allow_tax'];
     echo '          <tr class="dataTableRow">' . NEW_LINE . '            <td class="dataTableContent" valign="top" align="right">' . $current_product['qty'] . '&nbsp;x&nbsp;</td>' . NEW_LINE . '            <td class="dataTableContent" valign="top">' . $current_product['name'];
     $current_product_attributes = $current_product['attributes'];
     $current_product_attributes_count = sizeof($current_product_attributes);
     if ($current_product_attributes_count > 0) {
         for ($j = 0, $k = $current_product_attributes_count; $j < $k; $j++) {
             $current_product_attribute = $current_product_attributes[$j];
             $attribute_text = '<br/><nobr><small>&nbsp;<i> - ' . $current_product_attribute['option'] . ': ' . $current_product_attribute['value'];
             $attribute_price = $current_product_attribute['price'];
             if ((int) $attribute_price) {
                 $current_product_qty = $current_product['qty'];
                 if ($current_product_allow_tax) {
                     $attribute_price = olc_add_tax($attribute_price * $current_product_qty, $current_product['tax']);
                 }
                 $attribute_text .= LPAREN . $current_product_attribute['prefix'] . $currencies->format($attribute_price * $current_product_qty, true, $order_currency, $order_currency_value) . RPAREN;
             }
             echo $attribute_text .= '</i></small></nobr>';
         }
     }
     echo '            </td>' . NEW_LINE . '            <td class="dataTableContent" valign="top">' . $current_product['model'] . '</td>' . NEW_LINE . '            <td class="dataTableContent" align="right" valign="top">' . format_price($current_product['final_price'] / $current_product['qty'], 1, $order_currency, $current_product_allow_tax, $current_product['tax']) . '</td>' . NEW_LINE;
     if ($current_product_allow_tax) {
         echo '<td class="dataTableContent" align="right" valign="top">';
         echo olc_display_tax_value($current_product['tax']) . '%';
         echo '</td>' . NEW_LINE;
         echo '<td class="dataTableContent" align="right" valign="top"><b>';
         echo format_price($current_product['final_price'] / $current_product['qty'], 1, $order_currency, 0, 0);
         echo '</b></td>' . NEW_LINE;
     }
function olc_get_products_price_export($products_id, $price_special, $quantity, $group_id = 0, $add_tax = 1, $currency, $calculate_currencies = true)
{
    // load price data into array for further use!
    $product_price_query = olc_db_query("SELECT   products_price,\n                                            products_discount_allowed,\n                                            products_tax_class_id\n                                            FROM " . TABLE_PRODUCTS . "\n                                            WHERE\n                                            products_id = '" . $products_id . APOS);
    $product_price = olc_db_fetch_array($product_price_query);
    $price_data = array();
    $price_data = array('PRODUCTS_PRICE' => $product_price['products_price'], 'PRODUCTS_DISCOUNT_ALLOWED' => $product_price['products_discount_allowed'], 'PRODUCT_TAX_CLASS_ID' => $product_price['products_tax_class_id']);
    // get tax rate for tax class
    $products_tax = olc_get_tax_rate_export($price_data['PRODUCT_TAX_CLASS_ID']);
    // check if user is allowed to see tax rates
    if ($add_tax == '0') {
        $products_tax = '';
    }
    // end $_SESSION['customers_status']['customers_status_show_price_tax'] =='0'
    // check if special price is aviable for product (no product discount on special prices!)
    if ($special_price = olc_get_products_special_price($products_id)) {
        $special_price = olc_add_tax($special_price, $products_tax);
        $price_data['PRODUCTS_PRICE'] = olc_add_tax($price_data['PRODUCTS_PRICE'], $products_tax);
        $price_string = olc_format_special_price_export($special_price, $price_data['PRODUCTS_PRICE'], $price_special, $calculate_currencies = true, $quantity, $products_tax, $add_tax, $currency);
    } else {
        // if ($special_price=olc_get_products_special_price($products_id))
        // Check if there is another price for customers_group (if not, take norm price and calculte discounts (NOTE: no discount on group PRICES(only OT DISCOUNT!)!
        $group_price_query = olc_db_query("SELECT personal_offer\n                                             FROM " . TABLE_PERSONAL_OFFERS_BY_CUSTOMERS_STATUS . $group_id . "\n                                             WHERE products_id='" . $products_id . APOS);
        $group_price_data = olc_db_fetch_array($group_price_query);
        // if we found a price, everything is ok if not, we will use normal price
        if ($group_price_data['personal_offer'] != '' and $group_price_data['personal_offer'] != '0.0000') {
            $price_string = $group_price_data['personal_offer'];
            // check if customer is allowed to get graduated prices
            //         if ($_SESSION['customers_status']['customers_status_graduated_prices']=='1'){
            // check if there are graduated prices in db
            // get quantity for products
            // modifikations for new graduated prices
            $qty = olc_get_qty($products_id);
            if (!olc_get_qty($products_id)) {
                $qty = $quantity;
            }
            $graduated_price_query = olc_db_query("SELECT max(quantity)\n                                                          FROM " . TABLE_PERSONAL_OFFERS_BY_CUSTOMERS_STATUS . $group_id . "\n                                                          WHERE products_id='" . $products_id . "'\n                                                          AND quantity<='" . $qty . APOS);
            $graduated_price_data = olc_db_fetch_array($graduated_price_query);
            // get singleprice
            $graduated_price_query = olc_db_query("SELECT personal_offer\n                                                          FROM " . TABLE_PERSONAL_OFFERS_BY_CUSTOMERS_STATUS . $group_id . "\n                                                          WHERE products_id='" . $products_id . "'\n                                                          AND quantity='" . $graduated_price_data['max(quantity)'] . APOS);
            $graduated_price_data = olc_db_fetch_array($graduated_price_query);
            $price_string = $graduated_price_data['personal_offer'];
            //     } // end $_SESSION['customers_status']['customers_status_graduated_prices']=='1'
            $price_string = olc_add_tax($price_string, $products_tax);
            //*$quantity;
        } else {
            // if     ($group_price_data['personal_offer']!='' and $group_price_data['personal_offer']!='0.0000')
            $price_string = olc_add_tax($price_data['PRODUCTS_PRICE'], $products_tax);
            //*$quantity;
            // check if product allows discount
        }
        // format price & calculate currency
        $price_string = $price_string * $quantity;
        // currency calculations
        $currencies_query = olc_db_query("SELECT *\n          FROM " . TABLE_CURRENCIES . " WHERE\n          code = '" . $currency . APOS);
        $currencies_value = olc_db_fetch_array($currencies_query);
        $currencies_data = array();
        $currencies_data = array('SYMBOL_LEFT' => $currencies_value['symbol_left'], 'SYMBOL_RIGHT' => $currencies_value['symbol_right'], 'DECIMAL_PLACES' => $currencies_value['decimal_places'], 'VALUE' => $currencies_value['value']);
        if ($calculate_currencies == TRUE_STRING_S) {
            $price_string = $price_string * $currencies_data['VALUE'];
        }
        $price_string = olc_precision($price_string, $currencies_data['DECIMAL_PLACES']);
        if ($price_special == '1') {
            $currencies_query = olc_db_query("SELECT *\n                                            FROM " . TABLE_CURRENCIES . " WHERE\n                                            code = '" . $currency . APOS);
            $currencies_value = olc_db_fetch_array($currencies_query);
            $price_string = number_format($price_string, $currencies_data['DECIMAL_PLACES'], $currencies_value['decimal_point'], $currencies_value['thousands_point']);
            if ($show_currencies == 1) {
                $price_string = $currencies_data['SYMBOL_LEFT'] . BLANK . $price_string . BLANK . $currencies_data['SYMBOL_RIGHT'];
            }
        }
    }
    //}
    return $price_string;
    //    return $price_data['PRODUCTS_PRICE'];
}
 function process()
 {
     global $order, $currencies;
     $shipping_cost = $order->info['shipping_cost'];
     if (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == TRUE_STRING_S) {
         $country_id = $order->delivery['country_id'];
         switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) {
             case 'national':
                 if ($country_id == STORE_COUNTRY) {
                     $pass = true;
                 }
                 break;
             case 'international':
                 if ($country_id != STORE_COUNTRY) {
                     $pass = true;
                 }
                 break;
             case 'both':
                 $pass = true;
                 break;
             default:
                 $pass = false;
                 break;
         }
         if ($pass) {
             $total_ex_ship = $order->info['total'] - $shipping_cost;
             if ($total_ex_ship >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) {
                 $shipping_method = $this->title . LPAREN . sprintf(FREE_SHIPPING_DESCRIPTION, olc_format_price(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER, true, true, true)) . RPAREN;
                 $order->info['shipping_method'] = $shipping_method;
                 $order->info['total'] = $total_ex_ship;
                 $shipping_cost = 0;
             }
         }
     }
     if (true or $shipping_cost > 0) {
         $module = substr($_SESSION['shipping']['id'], 0, strpos($_SESSION['shipping']['id'], UNDERSCORE));
         if (olc_not_null($order->info['shipping_method'])) {
             $tax_class = $GLOBALS[$module]->tax_class;
             $country_id = $order->delivery['country']['id'];
             $zone_id = $order->delivery['zone_id'];
             $shipping_tax = olc_get_tax_rate($tax_class, $country_id, $zone_id);
             $shipping_tax_description = olc_get_tax_description($tax_class, $country_id, $zone_id);
             $new_shipping_cost = olc_add_tax($shipping_cost, $shipping_tax);
             $tax = $new_shipping_cost - $shipping_cost;
             if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 1) {
                 // price with tax
                 $shipping_cost = $new_shipping_cost;
                 $order->info['tax'] += $tax;
                 $order->info['tax_groups'][TAX_ADD_TAX . "{$shipping_tax_description}"] += $tax;
                 $order->info['total'] += $tax;
             } else {
                 if ($_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
                     $order->info['tax'] += $tax;
                     $order->info['tax_groups'][TAX_NO_TAX . "{$shipping_tax_description}"] += $tax;
                 }
             }
             if (true or $shipping_cost) {
                 $this->output[] = array('title' => $order->info['shipping_method'] . COLON, 'text' => olc_format_price($shipping_cost, true, true, true, true), 'value' => $shipping_cost);
             }
         }
     }
 }
Esempio n. 22
0
function tep_add_tax($x, $y)
{
    return olc_add_tax($x, $y);
}
function Make_Cell($txt = EMPTY_STRING, $align, $is_price = false, $check_field_width = false, $add_lines, $fill = false)
{
    global $pdf, $field, $Y_Table_Position, $x_pos, $x_width, $tax;
    $w = $x_width[$field];
    if ($check_field_width) {
        $txt = fit_string($txt, $w);
    } else {
        if ($is_price) {
            if (ADD_TAX) {
                $txt = olc_add_tax($txt, $tax);
            }
            $txt = olc_format_price($txt, 1, 1, 0);
        }
    }
    $pdf->SetY($Y_Table_Position);
    $pdf->SetX($x_pos[$field]);
    if ($add_lines) {
        //Multicell with more than one line (most likely attributes)
        //Attach line breaks, in order to prevent centering of cell text
        $txt = str_pad($txt, strlen($txt) + $add_lines, TILDE, STR_PAD_RIGHT);
    }
    $pdf->MultiCell($w, $pdf->lines_height, $txt, 1, $align, $fill);
    $field++;
}