$i = 0; $max = count($tracking_products_history); while ($i < $max) { $products_id = $tracking_products_history[$i]; $product_history_query = olc_db_query(SELECT_ALL . TABLE_PRODUCTS . "\n\t\twhere\n\t\tproducts_status = 1 and\n\t\tproducts_id = " . $products_id); $history_product = olc_db_fetch_array($product_history_query); if ($history_product['products_status'] != 0) { $products_name = olc_get_products_name($products_id); $products_image = $history_product['image']; $products_price = olc_get_products_price_specials($products_id, $price_special = 1, $quantity = 1, $price_special_info, $products_price_real); if ($products_price_real < 0) { $products_price = olc_format_price(abs($products_price_real), true, true, true); } $buy_now = str_replace(HASH, $products_id, $buy_now_link); $buy_now = str_replace(ATSIGN, $products_name, $buy_now); $cpath = olc_get_product_path($products_id); $products_image = str_replace(HASH, $products_image, $img); $products_image = str_replace(ATSIGN, $products_name, $products_image); $products_history[] = array('PRODUCTS_NAME' => $products_name, 'PRODUCTS_IMAGE' => $products_image, 'PRODUCTS_PRICE' => $products_price, 'PRODUCTS_URL' => str_replace(HASH, $products_id, $product_link), 'PRODUCTS_CATEGORY_URL' => str_replace(HASH, $cpath, $cat_path), 'BUY_NOW_BUTTON' => $buy_now); $i++; } } $smarty->assign('products_history', $products_history); } else { $order_content = array(); if (olc_count_customer_orders() > 0) { $orders_query = olc_db_query("\n\t\tselect\n\t o.orders_id,\n\t o.date_purchased,\n\t o.delivery_name,\n\t o.delivery_country,\n\t o.billing_name,\n\t o.billing_country,\n\t ot.text as order_total,\n\t s.orders_status_name\n\t from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_TOTAL . " ot, " . TABLE_ORDERS_STATUS . " s\n\t where\n\t o.customers_id = '" . CUSTOMER_ID . "' and\n\t o.orders_id = ot.orders_id and\n\t ot.class = 'ot_total' and\n\t o.orders_status = s.orders_status_id and\n\t s.language_id = '" . SESSION_LANGUAGE_ID . "'\n\t order by orders_id desc limit 3"); while ($orders = olc_db_fetch_array($orders_query)) { $order_name = $orders['delivery_name']; if ($order_name) { $order_country = $orders['delivery_country'];
function calculate_credit($amount) { global $order, $olPrice; $od_amount = 0; if (isset($_SESSION['cc_id'])) { $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); $this->coupon_code = $coupon_result['coupon_code']; $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); $c_deduct = $olPrice->olcFormat($get_result['coupon_amount'], true, 0, true); //$c_deduct = $get_result['coupon_amount']; if ($get_result['coupon_type'] == 'S') { $c_deduct = $order->info['shipping_cost']; } // original code if ($olPrice->olcFormat($get_result['coupon_minimum_order'], true, 0, true) <= $this->get_order_total()) { if ($olPrice->olcFormat($get_result['coupon_minimum_order'], true, 0, true) <= $order->info['total']) { if ($get_result['restrict_to_products'] || $get_result['restrict_to_categories']) { for ($i = 0; $i < sizeof($order->products); $i++) { if ($get_result['restrict_to_products']) { $pr_ids = split("[,]", $get_result['restrict_to_products']); for ($ii = 0; $ii < count($pr_ids); $ii++) { if ($pr_ids[$ii] == olc_get_prid($order->products[$i]['id'])) { if ($get_result['coupon_type'] == 'P') { /* Fixes to Gift Voucher module 5.03 ================================= Submitted by Rob Cote, robc@traininghott.com original code: $od_amount = olc_precision($amount*10)/10*$c_deduct/100; $pr_c = $order->products[$i]['final_price']*$order->products[$i]['qty']; $pod_amount = olc_precision($pr_c*10)/10*$c_deduct/100; */ //$pr_c = $order->products[$i]['final_price']*$order->products[$i]['qty']; //$pr_c = $this->product_price($pr_ids[$ii]); //Fred 2003-10-28, fix for the row above, otherwise the discount is calc based on price excl VAT! //$pod_amount = olc_precision($pr_c * 10) / 10 * $c_deduct / 100; //$od_amount = $od_amount + $pod_amount; $od_amount = $amount * $get_result['coupon_amount'] / 100; } else { $od_amount = $c_deduct; } } } } else { $cat_ids = split("[,]", $get_result['restrict_to_categories']); for ($i = 0; $i < sizeof($order->products); $i++) { $my_path = olc_get_product_path(olc_get_prid($order->products[$i]['id'])); $sub_cat_ids = split("[_]", $my_path); for ($iii = 0; $iii < count($sub_cat_ids); $iii++) { for ($ii = 0; $ii < count($cat_ids); $ii++) { if ($sub_cat_ids[$iii] == $cat_ids[$ii]) { if ($get_result['coupon_type'] == 'P') { /* Category Restriction Fix to Gift Voucher module 5.04 Date: August 3, 2003 ================================= Nick Stanko of UkiDev.com, nick@ukidev.com original code: $od_amount = olc_precision($amount*10)/10*$c_deduct/100; $pr_c = $order->products[$i]['final_price']*$order->products[$i]['qty']; $pod_amount = olc_precision($pr_c*10)/10*$c_deduct/100; */ //$od_amount = olc_precision($amount*10)/10*$c_deduct/100; //$pr_c = $order->products[$i]['final_price']*$order->products[$i]['qty']; //$pr_c = $this->product_price(olc_get_prid($order->products[$i]['id'])); //Fred 2003-10-28, fix for the row above, otherwise the discount is calc based on price excl VAT! //$pod_amount = olc_precision($pr_c * 10) / 10 * $c_deduct / 100; //$od_amount = $od_amount + $pod_amount; $od_amount = $amount * $get_result['coupon_amount'] / 100; } else { $od_amount = $c_deduct; } } } } } } } } else { if ($get_result['coupon_type'] != 'P') { $od_amount = $c_deduct; } else { $od_amount = $amount * $get_result['coupon_amount'] / 100; } } } } if ($od_amount > $amount) { $od_amount = $amount; } } return $od_amount; }
(c) 2000-2001 The Exchange Project (earlier name of osCommerce) (c) 2002-2003 osCommerce(shopping_cart.php,v 1.18 2003/02/10); www.oscommerce.com (c) 2003 nextcommerce (shopping_cart.php,v 1.15 2003/08/17); www.nextcommerce.org (c) 2004 XT - Commerce; www.xt-commerce.com Released under the GNU General Public License --------------------------------------------------------------------------------------- */ // calculate category path $manufacturers_id = $_GET['manufacturers_id']; $products_id = $_GET['products_id']; $cPath = $_GET['cPath']; if (!$cPath) { if ($products_id) { if (!$manufacturers_id) { $cPath = olc_get_product_path((int) $products_id); } } } if (olc_not_null($cPath)) { $cPath_array = olc_parse_category_path($cPath); $cPath = implode(UNDERSCORE, $cPath_array); $current_category_id = $cPath_array[sizeof($cPath_array) - 1]; } else { $current_category_id = 0; } // add category names or the manufacturer name to the breadcrumb trail if (!$manufacturers_id) { $manufacturers_id = $_GET['filter_id']; } if (!$manufacturers_id) {