示例#1
0
function olc_get_products_price_specials($products_id, $price_special, $quantity, &$price_special_info, &$products_price_real)
{
    global $special_info, $price_data;
    $special_price = olc_get_products_price($products_id, $price_special, $quantity, $products_price_real);
    if ($special_price) {
        $products_price = split(SESSION_CURRENCY, strip_tags($special_price));
        $products_price = $products_price[0];
        //$products_price_real=$products_price;
        //Convert curreny string to PHP-compatible number!
        $products_price_real_length = strlen($products_price_real);
        for ($i = 0; $i < $products_price_real_length; $i++) {
            $s = substr($products_price_real, $i, 1);
            if ($s == DASH || is_numeric($s)) {
                $products_price_real = substr($products_price_real, $i);
                break;
            }
        }
        if ($special_info['specials_new_products_price']) {
            $price_special_info = TEMPLATE_SPECIAL_PRICE_DATE_1;
            $expires_date = $special_info['expires_date'];
            if (isset($expires_date)) {
                $expires_date_serial = strtotime($expires_date);
                $expires_date = date("d.m.Y", $expires_date_serial);
                if ($expires_date_serial < time()) {
                    $special_price = $products_price;
                } else {
                    $price_special_info .= sprintf(TEMPLATE_SPECIAL_PRICE_DATE_2, $expires_date);
                }
                $price_special_info = BLANK . $price_special_info;
            }
        } else {
            $price_special_info = "";
        }
    } else {
        $price_special_info = EMPTY_STRING;
        $products_price_real = 0;
    }
    return $special_price;
}
         TABLE_PRODUCTS . " p, " .
         TABLE_PRODUCTS_DESCRIPTION . " pd
         where
         p.products_id='#' and
         pd.products_id = p.products_id and
         pd.language_id = '" . SESSION_LANGUAGE_ID . APOS;
         */
         $products = array();
         $price_raw = 0;
         while ($products_basket = olc_db_fetch_array($products_basket_query)) {
             $products_id = $products_basket['products_id'];
             $prid = olc_get_prid($products_id);
             $products_query_sql = str_replace(HASH, $prid, $products_query_sql0);
             $products_query = olc_db_query($products_query_sql);
             if ($current_product = olc_db_fetch_array($products_query)) {
                 $products_price = abs(olc_get_products_price($prid, $price_special = 0, $quantity = 1));
                 $price_raw += $products_price;
                 $products[] = array('id' => $products_id, 'name' => $current_product['products_name'], 'model' => $current_product['products_model'], 'image' => $current_product['products_image'], 'price' => $current_product_price, 'discount_allowed' => $current_product['products_discount_allowed'], 'quantity' => $products_basket['customers_basket_quantity'], 'weight' => $current_product['products_weight'], 'final_price' => $products_price, 'tax_class_id' => $current_product['products_tax_class_id']);
             }
         }
         $show_saved_cart = true;
         $module_content_save = $module_content;
         include_once DIR_WS_MODULES . 'order_details_cart.php';
         $module_content = $module_content_save;
         $show_saved_cart = false;
     }
 } else {
     $parameters = 'basket_id=' . $basket_id;
     $cart_content = EMPTY_STRING;
 }
 $link = olc_href_link(CURRENT_SCRIPT, $parameters);
for ($i = 0; $i < sizeof($products); $i++) {
    $product = $products[$i];
    $product_id = $product[$id_text];
    $products_quantity = $product[$quantity_text];
    $products_min_quantity = $product[$min_quantity_text];
    $products_quantity = max($products_quantity, $products_min_quantity);
    if ($do_stock_check) {
        $mark_stock = olc_check_stock($product_id, $products_quantity);
        $_SESSION[$any_out_of_stock_text] = $mark_stock;
        $mark_stock = HTML_NBSP . $mark_stock;
    }
    $image = $product[$image_text];
    if ($image) {
        $image = DIR_WS_THUMBNAIL_IMAGES . $image;
    }
    $price_single = olc_get_products_price($product_id, $price_special = 1, $quantity = 1, $price_real);
    $price_single = abs($price_real);
    $total_price = olc_format_price($price_single * $products_quantity, 1, 1);
    if ($show_saved_cart) {
        $products_qty = $products_quantity;
    } else {
        if (USE_AJAX) {
            $parameter = str_replace(HASH, $i, $parameter0);
            $parameter1 = str_replace(HASH, $i, $parameter10);
            $parameter2 = str_replace(HASH, $i, $parameter20);
            $parameter3 = str_replace(HASH, $i, $parameter30);
            $parameter4 = str_replace(HASH, $i, $parameter40);
            $parameter5 = str_replace(HASH, $i, $parameter50);
            $total_price = $parameter3 . $total_price . $span_end_text;
        }
        $products_qty = olc_draw_input_field($cart_quantity_text, $products_quantity, $parameter) . olc_draw_hidden_field($cart_min_quantity_text, $products_min_quantity, $parameter4) . olc_draw_hidden_field($products_id_text, $product_id, $parameter1);
 function get_products($use_saved_cart = false)
 {
     if (!is_array($this->contents)) {
         return false;
     }
     //if product is an auction
     $sql0 = SELECT . "\n\t\t\tp.products_id,\n\t\t\tpd.products_name,\n\t\t\tp.products_image,\n\t\t\tp.products_model,\n\t\t\tp.products_min_order_quantity,\n\t\t\tp.products_weight,\n\t\t\tp.products_uvp,\n\t\t\tp.products_tax_class_id,";
     $from = "\n\t\tfrom " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd";
     $where = "\n\t\twhere\n\t\t\tp.products_id = '#' and\n\t\t\tpd.products_id = p.products_id and\n\t\t\tpd.language_id = '" . SESSION_LANGUAGE_ID . APOS;
     //query: also select for auctionid -
     //there might be more than one auction from the same product (same productid) with different prices
     $auction_trailer = "\n\t\tad.auction_endprice" . $from . ", " . TABLE_AUCTION_DETAILS . " ad, " . TABLE_AUCTION_LIST . " al" . $where . "\n\t\tAND ad.auction_id = al.auction_id\n\t\tAND al.product_id=p.products_id\n\t\tAND\tal.auction_id = '" . ATSIGN . APOS;
     //normal shopproduct - normal select
     $normal_trailer = "\n\t\tp.products_price" . $from . $where;
     $sql0_normal = $sql0 . $normal_trailer;
     $sql0_auction = $sql0 . $auction_trailer;
     $products_array = array();
     reset($this->contents);
     while (list($products_id, ) = each($this->contents)) {
         $auctionid = $this->contents[$products_id][AUCTION_ID_TEXT];
         if ($auctionid) {
             $sql = str_replace(ATSIGN, $auctionid, $sql0_auction);
         } else {
             $sql = $sql0_normal;
         }
         $sql = str_replace(HASH, olc_get_prid($products_id), $sql);
         $products_query = olc_db_query($sql);
         if ($product = olc_db_fetch_array($products_query)) {
             $product_tax_class_id = $product['products_tax_class_id'];
             //if auction - get right excl. tax price
             if ($auctionid) {
                 //auctionprice is incl. tax - so you have to get the price without tax (because in cart it automatically added)
                 $product_price = $product['auction_endprice'];
                 $product_tax = olc_get_tax_rate($product_tax_class_id);
                 if ($product_tax) {
                     $product_price = $product_price / (1 + $product_tax / 100);
                 }
             } else {
                 //normal price - normal shopproduct
                 $product_price = $product['products_price'];
             }
             //$product_price = abs(olc_get_products_price($products_id, $price_special=0, $quantity=1,$price_real));
             $product_price = olc_get_products_price($products_id, $price_special = 0, $quantity = 1, $price_real);
             $product_price = abs($price_real);
             $products_array[] = array('id' => $products_id, AUCTION_ID_TEXT => $auctionid, 'name' => $product['products_name'], 'model' => $product['products_model'], 'image' => $product['products_image'], 'price' => $product_price, 'discount_allowed' => $max_product_discount, 'quantity' => $this->contents[$products_id]['qty'], 'min_quantity' => $product['products_min_order_quantity'], 'weight' => $product['products_weight'], 'final_price' => $product_price + $this->attributes_price($products_id), 'tax_class_id' => $products_tax_class_id, 'attributes' => $this->contents[$products_id]['attributes']);
         }
     }
     return $products_array;
 }
 function cart($customer_id = EMPTY_STRING)
 {
     global $currencies;
     if ($customer_id == EMPTY_STRING) {
         $customer_id = CUSTOMER_ID;
     }
     $this->content_type = $_SESSION['cart']->get_content_type();
     $customer_address_query = olc_db_query("\n\t\tselect\n\t\tc.customers_firstname,\n\t\tc.customers_cid,\n\t\tc.customers_gender,\n\t\tc.customers_lastname,\n\t\tc.customers_telephone,\n\t\tc.customers_email_address,\n\t\tc.customers_email_type,\n\t\tab.entry_company,\n\t\tab.entry_street_address,\n\t\tab.entry_suburb,\n\t\tab.entry_postcode,\n\t\tab.entry_city,\n\t\tab.entry_zone_id,\n\t\tab.entry_state,\n\t\tz.zone_name,\n\t\tco.countries_id,\n\t\tco.countries_name,\n\t\tco.countries_iso_code_2,\n\t\tco.countries_iso_code_3,\n\t\tco.address_format_id\n\t\tfrom " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " ab\n\t\tleft join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id)\n\t\tleft join " . TABLE_COUNTRIES . " co on (ab.entry_country_id = co.countries_id)\n\t\twhere\n\t\tc.customers_id = '" . $customer_id . "'\n\t\tand ab.customers_id = '" . $customer_id . "'\n\t\tand c.customers_default_address_id = ab.address_book_id");
     $customer_address = olc_db_fetch_array($customer_address_query);
     $shipping_address_query = olc_db_query("\n\t\tselect\n\t\tab.entry_firstname,\n\t\tab.entry_lastname,\n\t\tab.entry_company,\n\t\tab.entry_street_address,\n\t\tab.entry_suburb,\n\t\tab.entry_postcode,\n\t\tab.entry_city,\n\t\tab.entry_zone_id,\n\t\tab.entry_country_id,\n\t\tab.entry_state,\n\t\tz.zone_name,\n\t\tc.countries_id,\n\t\tc.countries_name,\n\t\tc.countries_iso_code_2,\n\t\tc.countries_iso_code_3,\n\t\tc.address_format_id\n\t\tfrom " . TABLE_ADDRESS_BOOK . " ab\n\t\tleft join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id)\n\t\tleft join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id)\n\t\twhere\n\t\tab.customers_id = '" . $customer_id . "'\n\t\tand ab.address_book_id = '" . $_SESSION['sendto'] . APOS);
     $shipping_address = olc_db_fetch_array($shipping_address_query);
     $billing_address_query = olc_db_query("\n\t\tselect\n\t\tab.entry_firstname,\n\t\tab.entry_lastname,\n\t\tab.entry_company,\n\t\tab.entry_street_address,\n\t\tab.entry_suburb,\n\t\tab.entry_postcode,\n\t\tab.entry_city,\n\t\tab.entry_zone_id,\n\t\tab.entry_state,\n\t\tab.entry_country_id,\n\t\tz.zone_name,\n\t\tc.countries_id,\n\t\tc.countries_name,\n\t\tc.countries_iso_code_2,\n\t\tc.countries_iso_code_3,\n\t\tc.address_format_id\n\t\tfrom " . TABLE_ADDRESS_BOOK . " ab\n\t\tleft join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id)\n\t\tleft join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id)\n\t\twhere ab.customers_id = '" . $customer_id . "'\n\t\tand ab.address_book_id = '" . $_SESSION['billto'] . APOS);
     $billing_address = olc_db_fetch_array($billing_address_query);
     $tax_address_query = olc_db_query("\n\t\tselect\n\t\tab.entry_country_id,\n\t\tab.entry_zone_id\n\t\tfrom " . TABLE_ADDRESS_BOOK . " ab\n\t\tleft join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id)\n\t\twhere ab.customers_id = '" . $_SESSION['$customer_id'] . "' and ab.address_book_id = '" . ($this->content_type == 'virtual' ? $_SESSION['billto'] : $_SESSION['sendto']) . APOS);
     $tax_address = olc_db_fetch_array($tax_address_query);
     $shipping = $_SESSION['shipping'];
     $shipping_class = $shipping['id'];
     //$shipping_class=$shipping['id'];
     $pos = strpos($shipping_class, UNDERSCORE);
     if ($pos > 0) {
         $shipping_class = substr($shipping_class, 0, $pos);
     }
     $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' => $GLOBALS['cc_type'], 'cc_owner' => $GLOBALS['cc_owner'], 'cc_number' => $GLOBALS['cc_number'], 'cc_expires' => $GLOBALS['cc_expires'], 'cc_start' => $GLOBALS['cc_start'], 'cc_issue' => $GLOBALS['cc_issue'], 'cc_cvv' => $GLOBALS['cc_cvv'], 'shipping_class' => $shipping_class, 'shipping_method' => $shipping['title'], 'shipping_cost' => $shipping['cost'], 'comments' => $_SESSION['comments'], 'payment_class' => $_SESSION['payment'], 'customers_order_reference' => $_SESSION['customers_order_reference']);
     if (isset($_SESSION['payment']) && is_object($_SESSION['payment'])) {
         $this->info['payment_method'] = $_SESSION['payment']->title;
         $this->info['payment_class'] = $_SESSION['payment']->title;
         if (isset($_SESSION['payment']->order_status) && is_numeric($_SESSION['payment']->order_status) && $_SESSION['payment']->order_status > 0) {
             $this->info['order_status'] = $_SESSION['payment']->order_status;
         }
     }
     $this->customer = array('firstname' => $customer_address['customers_firstname'], 'lastname' => $customer_address['customers_lastname'], 'csID' => $customer_address['customers_cid'], 'gender' => $customer_address['customers_gender'], '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' => olc_not_null($customer_address['entry_state']) ? $customer_address['entry_state'] : $customer_address['zone_name'], 'zone_id' => $customer_address['entry_zone_id'], 'country' => array('id' => $customer_address['countries_id'], 'title' => $customer_address['countries_name'], 'iso_code_2' => $customer_address['countries_iso_code_2'], 'iso_code_3' => $customer_address['countries_iso_code_3']), 'format_id' => $customer_address['address_format_id'], 'telephone' => $customer_address['customers_telephone'], 'email_address' => $customer_address['customers_email_address'], 'email_type' => $customer_address['customers_email_type']);
     $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' => olc_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' => olc_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;
     $tax_country = $tax_address['entry_country_id'];
     $tax_zone = $tax_address['entry_zone_id'];
     $products = $_SESSION['cart']->get_products();
     for ($i = 0, $n = sizeof($products); $i < $n; $i++) {
         $product = $products[$i];
         $quantity = $product['quantity'];
         $products_id = $product['id'];
         $price = olc_get_products_price($products_id, $price_special = 0, $quantity, $price_real);
         $price = abs($price_real);
         $products_attributes = $product['attributes'];
         if ($products_attributes) {
             $attributes_price = $_SESSION['cart']->attributes_price($products_id);
             if ((double) $attributes_price != 0) {
                 $attributes_price = olc_get_products_attribute_price_checkout($attributes_price, 0, 0, 1, EMPTY_STRING, false);
                 $price += $attributes_price;
             }
         }
         $final_price = $price * $quantity;
         $tax_class = $product['tax_class_id'];
         $this->products[$index] = array('qty' => $quantity, 'name' => $product['name'], 'model' => $product['model'], 'tax' => olc_get_tax_rate($tax_class, $tax_country, $tax_zone), 'tax_description' => olc_get_tax_description($tax_class, $tax_country, $tax_zone), 'price' => $price, 'final_price' => $final_price, 'weight' => $product['weight'], 'id' => $products_id, 'auctionid' => $product['auctionid']);
         if ($products_attributes) {
             $subindex = 0;
             reset($products_attributes);
             while (list($option, $value) = each($products_attributes)) {
                 $attributes_query = olc_db_query("\n\t\t\t\t\tselect\n\t\t\t\t\tpopt.products_options_name,\n\t\t\t\t\tpoval.products_options_values_name,\n\t\t\t\t\tpa.options_values_price,\n\t\t\t\t\tpa.price_prefix\n\t\t\t\t\tfrom " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n\t\t\t\t\twhere\n\t\t\t\t\tpa.products_id = '" . $products_id . "' and pa.options_id = '" . $option . "'\n\t\t\t\t\tand pa.options_id = popt.products_options_id\n\t\t\t\t\tand pa.options_values_id = '" . $value . "'\n\t\t\t\t\tand pa.options_values_id = poval.products_options_values_id\n\t\t\t\t\tand popt.language_id = '" . SESSION_LANGUAGE_ID . "'\n\t\t\t\t\tand poval.language_id = '" . SESSION_LANGUAGE_ID . APOS);
                 $attributes = olc_db_fetch_array($attributes_query);
                 $attributes_price = $attributes['options_values_price'];
                 if ($attributes_price > 0) {
                     $attributes_price_prefix = $attributes['price_prefix'];
                 } else {
                     $attributes_price_prefix = EMPTY_STRING;
                 }
                 $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);
                 $subindex++;
             }
         }
         $subtotal += $final_price;
         $shown_price = $final_price;
         if (CUSTOMER_SHOW_OT_DISCOUNT) {
             $shown_price_tax = $shown_price - $shown_price / 100 * CUSTOMER_OT_DISCOUNT;
         }
         $products_tax = $this->products[$index]['tax'];
         $products_tax_description = $this->products[$index]['tax_description'];
         if (CUSTOMER_SHOW_PRICE_TAX) {
             if (CUSTOMER_SHOW_OT_DISCOUNT) {
                 $shown_price = $shown_price_tax;
             }
             $products_tax_1 = str_replace(DOT, EMPTY_STRING, $products_tax);
             $products_tax_1 = $products_tax < 10 ? "1.0" . $products_tax_1 : "1." . $products_tax_1;
             $this->info['tax'] += $shown_price - $shown_price / $products_tax_1;
             $this->info['tax_groups'][TAX_ADD_TAX . "{$products_tax_description}"] += $shown_price / (100 + $products_tax) * $products_tax;
         } else {
             if (CUSTOMER_SHOW_OT_DISCOUNT) {
                 $shown_price = $shown_price_tax;
             }
             $shown_price = $shown_price / 100 * $products_tax;
             $this->info['tax'] += $shown_price;
             $this->info['tax_groups'][TAX_NO_TAX . $products_tax_description] += $shown_price;
         }
         $index++;
     }
     $this->info['subtotal'] = $subtotal;
     $this->info['total'] = $subtotal + $this->info['shipping_cost'];
     if (CUSTOMER_SHOW_OT_DISCOUNT) {
         $discount = $subtotal * (CUSTOMER_OT_DISCOUNT / 100);
         $this->info['total'] -= $discount;
         $this->info['orders_discount'] = $discount;
     }
 }
 function get_product_price($product_id)
 {
     global $order, $olPrice;
     $products_id = olc_get_prid($product_id);
     // products price
     $qty = $_SESSION['cart']->contents[$product_id]['qty'];
     $product_query = olc_db_query("select products_id, products_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id='" . $product_id . APOS);
     if ($product = olc_db_fetch_array($product_query)) {
         $products_tax = $olPrice->TAX[$product['products_tax_class_id']];
         $prid = $product['products_id'];
         if ($this->include_tax == TRUE_STRING_S) {
             if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
                 $total_price += olc_get_products_price($product['products_id'], $price_special = 0, $qty) + olc_calculate_tax(olc_get_products_price($product['products_id'], $price_special = 0, $qty), $products_tax);
             } else {
                 $total_price += olc_get_products_price($product['products_id'], $price_special = 0, $qty);
             }
         } else {
             if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 1) {
                 $total_price += olc_get_products_price($product['products_id'], $price_special = 0, $qty) - olc_calculate_tax(olc_get_products_price($product['products_id'], $price_special = 0, $qty) / (100 + $products_tax) * 100, $products_tax);
             } else {
                 $total_price += olc_get_products_price($product['products_id'], $price_special = 0, $qty);
             }
         }
         // attributes price
         if (isset($_SESSION['cart']->contents[$product_id]['attributes'])) {
             reset($_SESSION['cart']->contents[$product_id]['attributes']);
             while (list($option, $value) = each($_SESSION['cart']->contents[$product_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'] == '+') {
                     if ($this->include_tax == TRUE_STRING_S) {
                         if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
                             $total_price += olc_get_products_attribute_price($attribute_price['options_values_price'], $product['products_tax_class_id'], 0, $qty, $attribute_price['price_prefix']) + olc_calculate_tax(olc_get_products_attribute_price($attribute_price['options_values_price'], $product['products_tax_class_id'], 0, $qty, $attribute_price['price_prefix']), $products_tax);
                         } else {
                             $total_price += olc_get_products_attribute_price($attribute_price['options_values_price'], $product['products_tax_class_id'], 0, $qty, $attribute_price['price_prefix']);
                         }
                     } else {
                         $total_price += olc_get_products_attribute_price($attribute_price['options_values_price'], '', 0, $qty, $attribute_price['price_prefix']);
                     }
                 } else {
                     if ($this->include_tax == TRUE_STRING_S) {
                         if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
                             $total_price -= olc_get_products_attribute_price($attribute_price['options_values_price'], $product['products_tax_class_id'], 0, $qty, $attribute_price['price_prefix']) + olc_calculate_tax(olc_get_products_attribute_price($attribute_price['options_values_price'], $product['products_tax_class_id'], 0, $qty, $attribute_price['price_prefix']), $products_tax);
                         } else {
                             $total_price -= olc_get_products_attribute_price($attribute_price['options_values_price'], $product['products_tax_class_id'], 0, $qty, $attribute_price['price_prefix']);
                         }
                     } else {
                         $total_price -= olc_get_products_attribute_price($attribute_price['options_values_price'], '', 0, $qty, $attribute_price['price_prefix']);
                     }
                 }
             }
         }
     }
     return $total_price;
 }
 // Product price
 // elari - changed CS V3.x
 if ($customer_status_value['customers_status_discount'] != 0) {
     $max_product_discount = min($products[$i]['discount_allowed'], $customer_status_value['customers_status_discount']);
     echo $products[$i]['discount_allowed'] . $products[$i]['discount_allowed'] . $customer_status_value['customers_status_discount'];
     if ($max_product_discount > 0) {
         echo '    <td align="right" valign="top" class="main">-' . $max_product_discount . '%</td>';
     } else {
         echo '    <td align="right" valign="top" class="main">&nbsp</td>';
     }
 }
 // elari End CS V3.x
 if (!strstr($PHP_SELF, FILENAME_ACCOUNT_HISTORY_INFO)) {
     echo '    <td align="right" valign="top" class="main"><b>' . olc_get_products_price($products[$i]['id'], $price_special = 1, $quantity = $products[$i]['quantity']) . HTML_B_END . NEW_LINE;
 } else {
     echo '    <td align="right" valign="top" class="main"><b>' . olc_get_products_price($products[$i]['id'], $price_special = 1, $quantity = $products[$i]['quantity']) . HTML_B_END . NEW_LINE;
 }
 // Product options prices
 if ($attributes_exist == 1) {
     reset($products[$i]['attributes']);
     while (list($option, $value) = each($products[$i]['attributes'])) {
         if ($products[$i][$option]['options_values_price'] != 0) {
             if (!strstr($PHP_SELF, FILENAME_ACCOUNT_HISTORY_INFO)) {
                 echo '<br/><small><i>' . olc_get_products_attribute_price($products[$i][$option]['options_values_price'], $tax_class = $products[$i]['tax_class_id'], $price_special = 1, $quantity = $products[$i]['quantity'], $prefix = $products[$i][$option]['price_prefix']) . '</i></small>';
             } else {
                 echo '<br/><small><i>' . olc_get_products_attribute_price($products[$i][$option]['options_values_price'], $tax_class = $products[$i]['tax_class_id'], $price_special = 1, $quantity = $products[$i]['quantity'], $prefix = $products[$i][$option]['price_prefix']) . '</i></small>';
             }
         } else {
             // Keep price aligned with corresponding option
             echo '<br/><small><i>&nbsp;</i></small>';
         }
        if ($order->info['shipping_class'] != 'free') {
            $smarty->assign('SHIPPING_EDIT', olc_href_link(FILENAME_CHECKOUT_SHIPPING, EMPTY_STRING, SSL));
        }
    }
}
$data_products = '				<table width="100%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td>&nbsp;</td>
						<td class="main" align="center" valign="top"><b>' . TEXT_PRICE_SINGLE . '</b></td>
						<td class="main" align="center" valign="top"><b>' . TEXT_PRICE_TOTAL . '</b></td>
					</tr>
';
for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
    $order_products = $order->products[$i];
    $products_qty = $order_products['qty'];
    $price = olc_get_products_price($order_products['id'], 1, $products_qty, $price_real);
    $price = abs($price_real);
    $single_price = olc_format_price($price, true, true);
    if ($products_qty > 1) {
        $total_price = olc_format_price($price * $products_qty, true, true);
    } else {
        $total_price = $single_price;
    }
    $data_products .= '
					<tr>
						<td class="main" nowrap="nowrap" align="left" valign="top" width="">' . $products_qty . ' x ' . $order_products['name'] . '						</td>
						<td class="main" align="right" valign="top">' . $single_price . '</td>
						<td class="main" align="right" valign="top">' . $total_price . '</td>
					</tr>
';
    $products_attributes = $order_products['attributes'];