assign('european', $european); //-----------------------------------------------------header- Us and european if ($settings['markup'] != 'none') { $percent_markup = ($settings['markup'] == 'increase') ? $settings['percentage'] : -$settings['percentage']; } $percent_markup = ($percent_markup) ? $percent_markup : 0; $percent_markup = ($percent_markup > 200) ? 200 : $percent_markup; $percent_markup = ($percent_markup < -10) ? -10 : $percent_markup; if (!empty($settings['ssl'])) { $cfg['https_checkout'] = ($settings['ssl'] == 'https') ? 1 : 0; } $best_seller_no = ($settings['bestsellers']) ? $settings['bestsellers'] : 20; $reorder_discount = 15; //percent if (!isset($_SESSION['HTTP_REFERER'])) { $_SESSION['HTTP_REFERER'] = $_SERVER['HTTP_REFERER']; } function individual_increase($array, $items, $marker = "id"){ global $product_increase; if (count($array) <= 0 || !is_array($array)) { return false; } if (is_array($product_increase) && count($product_increase) > 0) { foreach($array AS $a) { $i = $a[$marker]; if (array_key_exists($i,$product_increase)) { $pi = $product_increase[$i]; foreach($items AS $item) { $a[$item] = (($a[$item]/100)*$pi)+$a[$item]; } } $result[] = $a; } return $result; } else { return $array; } } function clean_name($name) { $special_chars = array ("#","$","%","^","&","*","!","~","‘","\"","’","'","=","?","/","[","]","(",")","|","<",">",";","\\",",","."); $name = preg_replace("/^[.]*/","",$name); // remove leading dots $name = preg_replace("/[.]*$/","",$name); // remove trailing dots $name = str_replace($special_chars, "_", $name); // replace special characters with - $name = str_replace(' ','_',$name); // replace spaces with - return strtolower(trim($name)); } $url = $app->getURL(); $urlsig = $url; if (trim($_POST['section'])) { $section = strtolower(trim($_POST['section'])); } else { $section = strtolower(trim($_GET['section'])); $page = strtolower(trim($_GET['page'])); } //only allow https for checkout if (isset($_SERVER['HTTPS']) && $section != "checkout") { $redirect = substr($app->getURL('http',80),0,-1) . $_SERVER['REQUEST_URI']; header("Location: {$redirect}"); exit(); } if ($_GET['lng']) { $_SESSION['language'] = strtolower($_GET['lng']); } //set currency if ($_GET['cv']) { $_SESSION['currency'] = strtolower($_GET['cv']); } $currency = ($_SESSION['currency']) ? strtolower($_SESSION['currency']) : 'us'; switch ($currency) { case 'eu': $_SESSION['curr_symbol'] = '€'; $_SESSION['curr_factor'] = $_SESSION['EU_FACTOR']; break; case 'po': $_SESSION['curr_symbol'] = '£'; $_SESSION['curr_factor'] = $_SESSION['PO_FACTOR']; break; case 'aud': $_SESSION['curr_symbol'] = '$'; $_SESSION['curr_factor'] = $_SESSION['AUD_FACTOR']; break; case 'cad': $_SESSION['curr_symbol'] = '$'; $_SESSION['curr_factor'] = $_SESSION['CAD_FACTOR']; break; case 'nzd': $_SESSION['curr_symbol'] = '$'; $_SESSION['curr_factor'] = $_SESSION['NZD_FACTOR']; break; case 'sgd': $_SESSION['curr_symbol'] = '$'; $_SESSION['curr_factor'] = $_SESSION['SGD_FACTOR']; break; case 'jpy': $_SESSION['curr_symbol'] = '¥'; $_SESSION['curr_factor'] = $_SESSION['JPY_FACTOR']; break; default: $_SESSION['curr_symbol'] = '$'; $_SESSION['curr_factor'] = $_SESSION['US_FACTOR']; } //set language $language = ($_SESSION['language']) ? strtolower($_SESSION['language']) : 'us'; if ($multi_lingual == true) { if ($_GET['lng'] && $_GET['cv']) { if ($_SERVER['HTTP_REFERER']) { extract(parse_url(strtolower($_SERVER['HTTP_REFERER']))); if ($host == strtolower($app->getDomain())) { $app->redirect(false); } } } //auto set language for first time visitors if (!isset($_SESSION['first_visit'])) { $_SESSION['first_visit'] = 1; if ($_SESSION['language'] == "" || $_SESSION['currency'] == "") { $gi = geoip_open(GEOIP_DB,GEOIP_STANDARD); $c_code = trim(geoip_country_code_by_addr($gi, $_SERVER['REMOTE_ADDR'])); $language = strtolower($c_code); switch($c_code) { case "ITA": //$_SESSION['data_lang'] = "it"; //$language = "it"; $_SESSION['currency'] = "eu"; break; case "DEU": //$_SESSION['data_lang'] = "de"; //$language = "de"; $_SESSION['currency'] = "eu"; break; case "FRA": //$_SESSION['data_lang'] = "fr"; //$language = "fr"; $_SESSION['currency'] = "eu"; break; case "ESP": //$_SESSION['data_lang'] = "es"; //$language = "es"; $_SESSION['currency'] = "eu"; break; case "JPB": $_SESSION['currency'] = "jpy"; break; case "CAN": $_SESSION['currency'] = "cad"; break; case "AUS": $_SESSION['currency'] = "aud"; break; case "SGP": $_SESSION['currency'] = "sgd"; break; case "NZL": $_SESSION['currency'] = "nzd"; break; default: //$_SESSION['data_lang'] = ""; $_SESSION['currency'] = "usd"; } } } } else { $_SESSION['curr_symbol'] = '$'; $_SESSION['curr_factor'] = $_SESSION['US_FACTOR']; } $tpl->assign('cf', $_SESSION['curr_factor']); $tpl->assign('cs', $_SESSION['curr_symbol']); switch ($language) { case 'it': $_SESSION['data_lang'] = "it"; break; case 'es': $_SESSION['data_lang'] = "es"; break; case 'fr': $_SESSION['data_lang'] = "fr"; break; case 'de': $_SESSION['data_lang'] = "de"; break; default: $_SESSION['data_lang'] = ""; } $lang_suffix = ($_SESSION['data_lang'] == "") ? "" : "-".$_SESSION['data_lang']; $cfg['theme'] = $cfg['theme'] . $lang_suffix; //cart stuff $coupons = array(15 => 98210, 10 => 98211, 5 => 98212, 10 =>98213); if (trim($_POST['section']) == 'cart') { //handle cart events first switch(trim(strtolower($_POST['action']))) { case 'clear cart': case 'warenkorb leeren': case 'abierto de compra': case 'svuota carrello': case 'vider le panier': case 'effacer': case 'cesta clara': $_SESSION['orders'] = array(); unset($orders); break; case "apply coupon discount": case "appliquez l escompte de bon": case "wenden sie kupon-diskont an": case "applichi lo sconto del buono": case "aplique el descuento de la cupn": case "bewerben coupon rabatt": case 'aplicar cupn descuento': case 'appliquer le rabais coupon': case 're-calculate': case 'recalculate': case 'neu berechnen': case 'volver a calcular': case 'ricalcolare': case 're calculer': case 'actualizacin del carrito': case 'update cart': case 'update warenkorb': case 'aggiornamento del carrello': case 'mise jour panier': foreach($_POST As $key => $val) { if (is_numeric($key) && (int)$val > 0) { $_SESSION['orders'][$key] = $val; } } if ($_POST['coupon']) { $discount = array_search($_POST['coupon'],$coupons); $_SESSION['coupon_discount'] = ($discount) ? $discount : 0;; } else { $_SESSION['coupon_discount'] = 0; } $_SESSION['coupon'] = strip_tags($_POST['coupon']); break; case 'remove selected items': case 'Remove items': case 'remove items': case 'annuler les articles slectionns': case 'auswahl entfernen': case 'eliminar elementos seleccionados': case 'rimuovi elementi selezionati': case 'supprimer les elements selectionnes': $ids = $_POST['id']; if (count($ids)) { foreach($ids as $id) { unset($_SESSION['orders'][$id]); } } break; case 'caisse': case 'checkout': case 'check out': case 'prfung': case 'verifica': case 'comprobacin': case 'contrle': case 'abmelden': case 'hora de salida': case 'concordare': case 'rgler sa note': default: if($_POST['billing_cust_country']=="") { $cart_error="Please Select Country and Card Type"; $_SESSION['cart_error'] = $_POST['cart_error']; $checkout_url = "cart.htm"; header("Location: {$checkout_url}"); exit(); } $_SESSION['reorder'] = $_POST['reorder']; $_SESSION['reorder_dt'] = $_POST['reorder_year'].'/'.$_POST['reorder_month'].'/'.$_POST['reorder_date']; $_SESSION['country'] = $_POST['billing_cust_country']; $_SESSION['cc_type'] = $_POST['cc_type']; $_SESSION['billingopt'] = $_POST['billingopt']; /* echo "
";
			print_r($_SESSION);
			echo "
"; */ $checkout_url = ($cfg['https_checkout']) ? $app->getURL('https') : $url; $checkout_url .= "checkout.htm"; header("Location: {$checkout_url}"); exit(); break; } } elseif (trim($_GET['section']) == 'cart') { if (is_numeric($_GET['upgrade']) && is_numeric($_GET['to'])) { $td = $_GET['upgrade']; $ta = $_GET['to']; $orders = $_SESSION['orders']; //delete previous item unset($orders[$td]); //replace with if (count($orders) && is_array($orders)) { $orders[$ta] = (array_key_exists($ta, $orders)) ? $orders[$ta]+1 : 1; } else { $orders[$ta] = 1; } $_SESSION['upgrades'][$ta] = $orders[$ta]; $_SESSION['orders'] = $orders; $app->redirect("{$url}cart.htm"); } if (is_numeric($_GET['removeid']) ) { $td = $_GET['removeid']; //$ta = $_GET['to']; $orders = $_SESSION['orders']; //delete previous item unset($orders[$td]); //replace with $_SESSION['orders'] = $orders; $app->redirect("{$url}cart.htm"); } } $tpl->assign('coupon',$_SESSION['coupon']); $tpl->assign('discount',$_SESSION['coupon_discount']); //orders for the cart $orders = $_SESSION['orders']; if (is_array($orders)) { foreach($orders AS $key => $val) { $orders[$key] = $val; } } $upgrades = $_SESSION['upgrades']; if (is_array($upgrades)) { foreach($upgrades AS $key => $val) { $upgrades[$key] = $val; } } $order_ids = (count($orders)) ? array_keys($orders) : 0; $upgrades_ids = (count($upgrades)) ? array_keys($upgrades) : array(); $cart_total = 0; $cart_items = 0; if (count($order_ids) && is_array($order_ids)) { $db->select("SELECT k.id,k.ts,k.group_id,k.product_id,k.quantity,k.quantityType,k.notes,k.shipping, ((k.price/100)*$percent_markup)+k.price AS price, (((k.price/k.quantity)/100)*$percent_markup)+(k.price/k.quantity) AS unitPrice, ((k.savings/100)*$percent_markup)+k.savings AS savings, g.name AS gname, p.generic_name, p.name AS pname FROM ".DB_PREFIX."packages k LEFT JOIN ".DB_PREFIX."groups g ON k.group_id = g.id LEFT JOIN ".DB_PREFIX."products p ON k.product_id = p.id WHERE k.id IN (".implode($order_ids,",").")", true); $packages = individual_increase($db->data, array('price','unitPrice','savings'),'product_id'); if (count($packages)) { foreach($packages as $package) { $qty = $orders[$package['id']]; $price = $package['price']; if ($upgrade_discount_value > 0 && count($upgrades_ids)) { if (in_array($package['id'],$upgrades_ids)) { $upgrade_discount = ($upgrade_discount_value/100)*$price; $price = $price - $upgrade_discount; } } $cart_total += ($price*$qty); $cart_items++; } } unset($packages); } if ($_SESSION['coupon_discount']) { $dv = ($_SESSION['coupon_discount']/100)*$cart_total; $cart_total -= $dv; } $tpl->assign("cart_total",$cart_total); $tpl->assign("cart_items",$cart_items); //letters $letters[] = chr(49); for ($i = 65; $i <= 90; $i++) {$letters[] = chr($i);} $tpl->assign("letters",$letters); $lang = (strtolower($_SESSION['data_lang']) == "en" || $_SESSION['data_lang'] == "") ? "" : "_".$_SESSION['data_lang']; $db->select("SELECT id,name,generic_name,category_id, ((pricePerItem/100)*$percent_markup)+pricePerItem AS pricePerItem FROM ".DB_PREFIX."products ORDER BY bestseller_weight DESC, name ASC"); $products_tmp = individual_increase($db->data, array('pricePerItem')); //Restrict products $removed_products = unserialize(file_get_contents('data/removed_products')); if (is_array($removed_products)) { foreach ($products_tmp as $product) { if(!in_array($product[id], $removed_products)) { $products[] = $product; } } } else { $products = $products_tmp; } //End Restrict products foreach ($products AS $product) { $pn = clean_name($product['name']); $product_prices[$pn] = $product['pricePerItem']; } $db->select("SELECT id,name{$lang} AS name FROM ".DB_PREFIX."categories ORDER BY weight DESC, name ASC"); $categories_tmp = $db->data; //Restrict categories $removed_categories = unserialize(file_get_contents('data/removed_categories')); $categories_order = unserialize(file_get_contents('data/categories_order')); if (is_array($categories_order)) { if(sizeof($categories_order) != sizeof($categories_tmp)) { $length = sizeof($categories_order); foreach ($categories_tmp as $category) { if (!array_key_exists($category[id], $categories_order)) { $categories_order{$category[id]} = $length++; } } } } else { $categories_order = array(); $count = 0; foreach ($categories_tmp as $category) { $categories_order{$category[id]} = $count++; } file_put_contents('data/categories_order', serialize($categories_order)); } if (!is_array($removed_categories)) { $removed_categories = array(); } foreach ($categories_tmp as $category) { if(!in_array($category[id], $removed_categories)) { $order = $categories_order{$category[id]}; $categories[$order] = $category; } } $categories = array_values($categories); //End Restrict categories //echo $section."####".$page;exit; //bestsell $best_seller_array = @ unserialize(file_get_contents('data/best_sellersorder')); asort($best_seller_array); $best_seller_ids = array_keys($best_seller_array); if(is_array($best_seller_ids)) { $clause = "id in (".implode(",", $best_seller_ids).") "; } else { $clause = "bestseller=1"; } $db->select("SELECT id,ts,category_id,name,generic_name,bestseller,bestseller_weight, ((pricePerItem/100)*$percent_markup)+pricePerItem AS pricePerItem, type{$lang} AS type, shortDescription{$lang} AS shortDescription, productDescription{$lang} AS productDescription, safetyInformation{$lang} AS safetyInformation, sideEffects{$lang} AS sideEffects FROM ".DB_PREFIX."products WHERE $clause ORDER BY bestseller_weight DESC"); $bestsellers_tmp = individual_increase($db->data,array('pricePerItem')); if(is_array($bestsellers_tmp)) { foreach($bestsellers_tmp as $bestseller) { $key = array_search($bestseller[id], $best_seller_ids); $bestsellers1[$key] = $bestseller; } } if(!is_array($bestsellers1)) { $bestsellers1 = $bestsellers_tmp; } /* echo '
 test';



		print_r($bestsellers);



		echo '
'; */ foreach($bestsellers1 as $key => $value) { if($value["name"] == "Cialis") { $cialis_banner = $value["pricePerItem"]; $cialis_banner = number_format($cialis_banner, 2); } if($value["name"] == "Viagra") { $viagra_banner = $value["pricePerItem"]; $viagra_banner = number_format($viagra_banner, 2); } } //echo "pppr ".$viagra_banner." "; //echo "pppr ".$cialis_banner." "; $tpl->assign('viagra_banner', $viagra_banner); $tpl->assign('cialis_banner', $cialis_banner); switch($section) { case 'categories': $page = str_replace("-", "%",utf8_decode($_GET['page'])); if ($db->select("SELECT id,name{$lang} AS name FROM ".DB_PREFIX."categories WHERE name LIKE '%$page%' OR name_fr LIKE '%$page%' OR name_de LIKE '%$page%' OR name_es LIKE '%$page%' OR name_it LIKE '%$page%' LIMIT 1")) { $catdata = $db->data[0]; $category = $catdata['name']; $db->select("SELECT id,ts,category_id,name,generic_name,bestseller,bestseller_weight, ((pricePerItem/100)*$percent_markup)+pricePerItem AS pricePerItem, type{$lang} AS type, shortDescription{$lang} AS shortDescription, productDescription{$lang} AS productDescription, safetyInformation{$lang} AS safetyInformation, sideEffects{$lang} AS sideEffects FROM ".DB_PREFIX."products WHERE category_id LIKE '%{$catdata['id']}%'"); $productsArray = individual_increase($db->data, array('pricePerItem')); } //Restrict products $products_tmp=$productsArray; $products_cat=array(); $removed_products = unserialize(file_get_contents('data/removed_products')); if (is_array($removed_products)) { $hit=0; foreach ($products_tmp as $product) { if(!in_array($product['id'], $removed_products)) { $products_cat[] = $product; } $hit++; } } else { $products_cat = $products_tmp; } $productsArray=$products_cat; //End Restrict products $heading = "Category listing: $category"; $tpl->assign('active_category', $catdata['id']); $tpl->assign('heading', $heading); $tpl->assign('page_title', strip_tags($heading)); $tpl->assign('data', $productsArray); $template = "{$cfg['theme']}/list.tpl"; break; case 'catalogue': $files = array(); if ($page == 1) { $where = "( SUBSTRING( name, 1, 1 ) BETWEEN '0' AND '9')"; } else { $where = "SUBSTRING(name, 1, 1) LIKE '$page'"; } $db->select("SELECT id,ts,category_id,name,generic_name,bestseller,bestseller_weight, ((pricePerItem/100)*$percent_markup)+pricePerItem AS pricePerItem, type{$lang} AS type, shortDescription{$lang} AS shortDescription, productDescription{$lang} AS productDescription, safetyInformation{$lang} AS safetyInformation, sideEffects{$lang} AS sideEffects FROM ".DB_PREFIX."products WHERE $where"); $productsArray = individual_increase($db->data, array('pricePerItem')); //Restrict products $products_tmp=$productsArray; $products_cat=array(); $removed_products = unserialize(file_get_contents('data/removed_products')); if (is_array($removed_products)) { $hit=0; foreach ($products_tmp as $product) { if(!in_array($product['id'], $removed_products)) { $products_cat[] = $product; } $hit++; } } else { $products_cat = $products_tmp; } $productsArray=$products_cat; //End Restrict products $heading = "Catalogue listing: $page"; $tpl->assign('active_category', $page); $tpl->assign('heading', $heading); $tpl->assign('page_title', strip_tags($heading)); $tpl->assign('data', $productsArray); $template = "{$cfg['theme']}/list.tpl"; break; case 'search': if(isset($_REQUEST['search'])) $_REQUEST['q']=$_REQUEST['search']; if (trim(strlen($_REQUEST['q'])) > 2) { $q = strip_tags(addslashes($_REQUEST['q'])); $q = str_replace("/","",$q); $terms = explode(' ', $q); $bits = array(); foreach ($terms as $term) { $bits[] = "name LIKE '%".$term."%' OR generic_name LIKE '%".$term."%'"; } $db->select("SELECT id,ts,category_id,name,generic_name,bestseller,bestseller_weight, ((pricePerItem/100)*$percent_markup)+pricePerItem AS pricePerItem, type{$lang} AS type, shortDescription{$lang} AS shortDescription, productDescription{$lang} AS productDescription, safetyInformation{$lang} AS safetyInformation, sideEffects{$lang} AS sideEffects FROM ".DB_PREFIX."products WHERE (".implode(' OR ', $bits).")"); $productsArray = individual_increase($db->data, array('pricePerItem')); //Restrict products $products_tmp=$productsArray; $products_cat=array(); $removed_products = unserialize(file_get_contents('data/removed_products')); if (is_array($removed_products)) { $hit=0; foreach ($products_tmp as $product) { if(!in_array($product['id'], $removed_products)) { $products_cat[] = $product; } $hit++; } } else { $products_cat = $products_tmp; } $productsArray=$products_cat; //End Restrict products $heading = "Search results for: {$q}"; $tpl->assign('heading', $heading); $tpl->assign('page_title', strip_tags($heading)); $tpl->assign('data', $productsArray); } else { $err_msg[en] = "Search term must be atleast 3 characters"; $err_msg[de] = "Suchbegriff muss atleast 3 Zeichen"; $err_msg[es] = "Trmino de bsqueda debe ser al menos 3 caracteres"; $err_msg[fr] = "Le terme de recherche doit tre au moins 3 caractres"; $err_msg[it] = "Termini di ricerca devono essere atleast 3 caratteri"; if(!in_array($language,array('en','de','es','fr','it'))) $msg_lang='en'; else $msg_lang = $language; $tpl->assign('search_alert', $err_msg[$msg_lang]); } $template = "{$cfg['theme']}/list.tpl"; break; case 'products': $page = str_replace("-", "%",$page); if ($db->select("SELECT id,ts,category_id,name,generic_name,bestseller,bestseller_weight, ((pricePerItem/100)*$percent_markup)+pricePerItem AS pricePerItem, type{$lang} AS type, shortDescription{$lang} AS shortDescription, productDescription{$lang} AS productDescription, safetyInformation{$lang} AS safetyInformation, sideEffects{$lang} AS sideEffects FROM ".DB_PREFIX."products WHERE name LIKE '$page' LIMIT 1")) { $productsArray = individual_increase($db->data, array('pricePerItem')); //Restrict products $products_tmp=$productsArray; $products_cat=array(); $removed_products = unserialize(file_get_contents('data/removed_products')); if (is_array($removed_products)) { $hit=0; foreach ($products_tmp as $product) { if(!in_array($product['id'], $removed_products)) { $products_cat[] = $product; } $hit++; } } else { $products_cat = $products_tmp; } $productsArray=$products_cat; //End Restrict products if ($productsArray[0]['id'] == "" || $productsArray[0]['id'] <= 0) { header("Location: $url"); exit(); } $db->select("SELECT id,ts,group_id,product_id,quantity,quantityType, notes{$lang} AS notes, shipping{$lang} AS shipping, ((price/100)*$percent_markup)+price AS price, ROUND((((price/quantity)/100)*$percent_markup)+(price/quantity),3) AS unitPrice, ((savings/100)*$percent_markup)+savings AS savings FROM ".DB_PREFIX."packages WHERE product_id={$productsArray[0]['id']} ORDER BY quantity ASC"); $packagesArray = individual_increase($db->data, array('price','unitPrice','savings'),'product_id'); /* echo "
";
                        print_r($db->data);
                        echo "
"; */ $metaarray = @ unserialize(file_get_contents('data/meta_details')); @asort($metaarray); $listid=$productsArray[0]['id']; $key_array=array_keys($metaarray); if(in_array($listid,$key_array)) { $product_title=$metaarray[$listid]['title']; $meta_keywords=$metaarray[$listid]['meta']; $meta_description=$metaarray[$listid]['desc']; } else { $product_title=$productsArray[0]['name']; } // $db->select("SELECT * FROM ".DB_PREFIX."groups g WHERE product_id={$productsArray[0]['id']} ORDER by name ASC"); $db->select("SELECT DISTINCT(g.id),g.name,g.product_id FROM ".DB_PREFIX."groups g,".DB_PREFIX."packages p WHERE g.product_id={$productsArray[0]['id']} AND g.id=p.group_id ORDER by p.dosage DESC "); $groupsArray = $db->data; $cid = explode(",",trim($productsArray[0]['category_id'])); for($x = 0; $x < count($categories); $x++) { if ($cid[0] == $categories[$x]['id']) { $category = $categories[$x]['name']; $category_id = $categories[$x]['id']; break; } } $db->select("select distinct(dosage), dosage_type from ".DB_PREFIX."packages WHERE product_id={$productsArray[0]['id']} order by dosage desc "); $strengthArray=$db->data; for($h=0;$hassign('strength',$gp); $count_strength=count($strengthArray); $tpl->assign('count_strength',$count_strength); $tpl->assign('category_name', $category); $tpl->assign('active_category',$cid[0]); $tpl->assign('active_product', $id); $tpl->assign('heading', "Category: $category"); if($meta_keywords) { $tpl->assign('meta_keywords', "$meta_keywords"); } if($meta_description) { $tpl->assign('meta_description', "$meta_description"); } $tpl->assign('page_title', $product_title); $tpl->assign('product', $productsArray[0]); $tpl->assign('groups', $groupsArray); $tpl->assign('packages', $packagesArray); //bestsellers $db->select("SELECT id,ts,category_id,name,generic_name,bestseller,bestseller_weight, ((pricePerItem/100)*$percent_markup)+pricePerItem AS pricePerItem, type{$lang} AS type, shortDescription{$lang} AS shortDescription, productDescription{$lang} AS productDescription, safetyInformation{$lang} AS safetyInformation, sideEffects{$lang} AS sideEffects FROM ".DB_PREFIX."products WHERE bestseller=1 ORDER BY bestseller_weight DESC"); $bestsellers = $db->data; $tpl->assign('bestsellers', $bestsellers); } else { header("Location: $url"); exit(); } $template = "{$cfg['theme']}/product.tpl"; break; case 'cart': //-----------------------------------------------------------------------------------------------------------------------------------------------Bestseller in cart------------------------------ $best_seller_array = @ unserialize(file_get_contents('data/best_sellersorder')); asort($best_seller_array); $best_seller_ids = array_keys($best_seller_array); $best_seller_ids=array('31','34','43','767','37','46','44'); if(is_array($best_seller_ids)) { $clause = "id in (".implode(",", $best_seller_ids).") "; } else { $clause = "bestseller=1"; } $db->select("SELECT id,ts,category_id,name,generic_name,bestseller,bestseller_weight, ((pricePerItem/100)*$percent_markup)+pricePerItem AS pricePerItem, type{$lang} AS type, shortDescription{$lang} AS shortDescription, productDescription{$lang} AS productDescription, safetyInformation{$lang} AS safetyInformation, sideEffects{$lang} AS sideEffects FROM ".DB_PREFIX."products WHERE $clause ORDER BY bestseller_weight DESC"); $bestsellers_tmp = individual_increase($db->data,array('pricePerItem')); $co=count($bestsellers_tmp); //echo "count is".$co; if(is_array($bestsellers_tmp)) { foreach($bestsellers_tmp as $bestseller) { $key = array_search($bestseller[id], $best_seller_ids); $bestsellers[$key] = $bestseller; } } if(!is_array($bestsellers)) { $bestsellers = $bestsellers_tmp; } /* echo '
 in cart';
	print_r($bestsellers);
	echo '
'; */ foreach($bestsellers as $key=>$pdtid) { $db->select("SELECT ROUND( MIN( ( store_packages.price ) / ( store_packages.quantity ) ) , 2 ) as perpill, id FROM ".DB_PREFIX."packages WHERE product_id={$pdtid['id']} GROUP BY id "); $valarr = $db->data; $my_MIN=0; foreach($valarr as $row) { if($my_MIN==0 or $row['perpill'] < $my_MIN ) { $my_MIN=$row['perpill']; $my_id =$row['id']; } } $x= $my_MIN; $db->select("SELECT id,quantity FROM ".DB_PREFIX."packages WHERE ROUND((store_packages.price) / ( store_packages.quantity ),2)={$x} and product_id={$pdtid['id']} "); $groupsArray = $db->data; $bestsellers[$key]['minperpill'] = $groupsArray[0]['id']; $bestsellers[$key]['minpack'] = $groupsArray[0]['quantity']; } //-----------------------------------------------------------------------------------------------------------------------------------------------Bestseller in cart------------------------------ if ((int)$page > 0) { if($db->select("SELECT id,ts,group_id,product_id,quantity,quantityType, notes{$lang} AS notes, shipping{$lang} AS shipping, ((price/100)*$percent_markup)+price AS price, (((price/quantity)/100)*$percent_markup)+(price/quantity) AS unitPrice, ((savings/100)*$percent_markup)+savings AS savings FROM ".DB_PREFIX."packages WHERE id=$page ORDER BY quantity ASC")) { $packages = $db->data; $id = $packages[0]['id']; if ((int)$id > 0) { if (count($orders) && is_array($orders)) { $orders[$id] = (array_key_exists($id, $orders)) ? $orders[$id]+1 : 1; } else { $orders[$id] = 1; } } $_SESSION['orders'] = $orders; $app->redirect("{$url}cart.htm"); } } if (count($order_ids) && is_array($order_ids)) { $db->select("SELECT k.id,k.ts,k.group_id,k.product_id,k.quantity,k.quantityType, k.notes{$lang} AS notes, k.shipping{$lang} AS shipping,k.dosage, ((k.price/100)*$percent_markup)+k.price AS price, (((k.price/k.quantity)/100)*$percent_markup)+(k.price/k.quantity) AS unitPrice, ((k.savings/100)*$percent_markup)+k.savings AS savings, g.name AS gname, p.generic_name, p.name AS pname FROM ".DB_PREFIX."packages k LEFT JOIN ".DB_PREFIX."groups g ON k.group_id = g.id LEFT JOIN ".DB_PREFIX."products p ON k.product_id = p.id WHERE k.id IN (".implode(",",$order_ids).") ORDER BY k.quantity ASC",true); $ordered_packages = individual_increase($db->data, array('price','unitPrice','savings'),'product_id'); foreach ($ordered_packages AS $op) { //apply upgrade discount if any if ($upgrade_discount_value > 0 && count($upgrades_ids)) { if (in_array($op['id'],$upgrades_ids)) { $upgrade_discount = ($upgrade_discount_value/100)*$price; $price = $price - $upgrade_discount; $op['price'] = $price; } } $ordered_packages_parsed[] = $op; } //get product id's foreach($ordered_packages_parsed AS $op) { $package_products[] = $op['product_id']; } if (count($package_products)) { $db->select("SELECT k.id,k.ts,k.group_id,k.product_id,k.quantity,k.quantityType,k.notes, k.shipping{$lang} AS shipping,k.dosage, ((k.price/100)*$percent_markup)+k.price AS price, (((k.price/k.quantity)/100)*$percent_markup)+(k.price/k.quantity) AS unitPrice, ((k.savings/100)*$percent_markup)+k.savings AS savings, p.name, g.name AS gname FROM ".DB_PREFIX."packages k LEFT JOIN ".DB_PREFIX."products p ON k.product_id = p.id LEFT JOIN ".DB_PREFIX."groups g ON k.group_id = g.id WHERE p.id IN (".implode(",",$package_products).") ORDER by k.dosage ASC, k.quantity ASC",true); $other_packages = individual_increase($db->data, array('price','unitPrice','savings'),'product_id'); } } $tpl->assign('bestsellers', $bestsellers); $tpl->assign('heading', "Today's Best Sellers"); //--------------------------------------------------------------------------------------------------------------------------------------cart changes---------------- $gi = geoip_open(GEOIP_DB,GEOIP_STANDARD); $c_code = trim(geoip_country_code_by_addr($gi, $_SERVER['REMOTE_ADDR'])); //$cities=trim(file_get_contents("http://myredmaple.com/city/explode.php?ip=".$_SERVER['REMOTE_ADDR'])); //echo "Country Code:".$c_code; //$tpl->assign('cities',$cities); if($c_code=='US' or $c_code=='CA') { $tpl->assign('From_Ip',1); } else { $tpl->assign('From_Ip',0); } $db->select("Select id from store_categories where name like '%Erectile Dysfunction%'",true); $R_data=$db->data ; $R1 = $R_data[0]['id']; $db->select("Select id from store_products where category_id like '%".$R1."%'",true); foreach($db->data as $key => $value) { $list1[]=$value['id']; } $db->select("Select id from store_products where name like 'ED Discount pack%'",true); foreach($db->data as $key => $value) { $list2[] =$value['id']; } $checklist = array_merge($list1,$list2); foreach($_SESSION['orders'] as $key=>$value) { $db->select("Select product_id from store_packages where id ='$key'",true); $p_data=$db->data ; $p1 = $p_data[0]['product_id']; $p_list[]=$p1; } foreach($p_list as $value) { if(!in_array($value,$checklist)) { $Other[]=$value; } } $form = new generateForm(null,null,"cart"); $countries=($Other)?$countries_restricted:$countries; $form->add(array("type" => "select","label" => "Country","required" => 1, "options" => $countries, "attributes" => array("name" => "billing_cust_country", "id" => "billing_cust_country", "class" => "select"), "rules" => array("required" => "true"))); $form->add(array("type" => "select","label" => "Date","required" => 1, "options" => $card_date, "attributes" => array("name" => "reorder_date", "id" => "reorder_date", "class" => "select_reorder"), "rules" => array("required" => "true"))); $form->add(array("type" => "select","label" => "Date","required" => 1, "options" => $card_month, "attributes" => array("name" => "reorder_month", "id" => "reorder_month", "class" => "select_reorder"), "rules" => array("required" => "true"))); $form->add(array("type" => "select","label" => "Date","required" => 1, "options" => $card_year, "attributes" => array("name" => "reorder_year", "id" => "reorder_year", "class" => "select_reorder"), "rules" => array("required" => "true"))); $tpl->assign_by_ref('form', $form); $tpl->assign('orders', $orders); $wu_opt = (round($cart_total,2) < 99)?'disabled':''; $tpl->assign('wuenable', $wuenable); $form->add(array("type" => "radio","label" => "", "checked" => array($_POST['cc']), "attributes" => array("name" => "billingopt", "value" => "cc", "id" => "cc", "class" => "radio" ,"checked" => "checked"))); /*$form->add(array("type" => "radio","label" => "", "checked" => array($_POST['cc']), "attributes" => array("name" => "billingopt", "value" => "wu", "id" => "wu", "class" => "radio", "$wu_opt" => "$wu_opt"))); $form->add(array("type" => "radio","label" => "", "checked" => array($_POST['cc']), "attributes" => array("name" => "billingopt", "value" => "ach", "id" => "ach", "class" => "radiobutton1"))); */ // $form->add(array("type" => "radio","label" => "", "checked" => array($_POST['cc']), // // "attributes" => array("name" => "billingopt", "value" => "wu", "id" => "wu", "class" => "radio", "$wu_opt" => "$wu_opt"))); $form->add(array("type" => "radio","label" => "", "checked" => array($_POST['cc_type']), "attributes" => array("name" => "cc_type", "value" => "visa", "id" => "cc_visa", "class" => "radio"), "rules" => array("ccrequired" => "true"))); $form->add(array("type" => "radio","label" => "", "checked" => array($_POST['cc_type']), "attributes" => array("name" => "cc_type", "value" => "JCB", "id" => "cc_jcb", "class" => "radio"), "rules" => array("ccrequired" => "true"))); $form->add(array("type" => "radio","label" => "", "checked" => array($_POST['cc_type']), "attributes" => array("name" => "cc_type", "value" => "Diners Club", "id" => "cc_diners", "class" => "radio"), "rules" => array("ccrequired" => "true"))); $form->add(array("type" => "radio","label" => "", "checked" => array($_POST['cc_type']), "attributes" => array("name" => "cc_type", "value" => "American Express", "id" => "cc_amex", "class" => "radio"), "rules" => array("required" => "true"))); $form->add(array("type" => "radio","label" => "", "checked" => array($_POST['cc_type']), "attributes" => array("name" => "cc_type", "value" => "mastercard", "id" => "cc_mastercard", "class" => "radio"), "rules" => array("ccrequired" => "true"))); $form->add(array("type" => "select","label" => "Reorder Date","required" => 1, "options" => $card_date, "attributes" => array("name" => "reorder_date", "id" => "reorder_date", "class" => "select"))); $form->add(array("type" => "select","label" => "Reorder Month","required" => 1, "options" => $card_month, "attributes" => array("name" => "reorder_month", "id" => "reorder_month", "class" => "select"))); $form->add(array("type" => "select","label" => "Reorder Year","required" => 1, "options" => $card_year, "attributes" => array("name" => "reorder_year", "id" => "reorder_year", "class" => "select"))); $tpl->assign('reorder_discount', $reorder_discount); $tpl->assign('cart_error', $_SESSION['cart_error']); $tpl->assign('data', $ordered_packages_parsed); $tpl->assign('other_packages', $other_packages); $tpl->assign('heading', "Your shopping cart"); if($_SESSION['language']=="fr"){ $tpl->assign('page_title', "Your shopping cart"); }else if($_SESSION['language']=="es"){ $tpl->assign('page_title', "Su cesta de la compra"); }else if($_SESSION['language']=="it"){ $tpl->assign('page_title', "Il vostro carrello"); }else if($_SESSION['language']=="de"){ $tpl->assign('page_title', "Ihr Warenkorb"); }else{ $tpl->assign('page_title', "Your shopping cart"); } $template = "{$cfg['theme']}/cart.tpl"; //------------------------------------------------------------------------------------------------------cart changes-------------------------------- break; case 'faq': $tpl->assign('heading', "Frequently Asked Questions"); if($_SESSION['language']=="fr"){ $tpl->assign('page_title', "Foire aux questions"); }else if($_SESSION['language']=="es"){ $tpl->assign('page_title', "Preguntas ms frecuentes"); }else if($_SESSION['language']=="it"){ $tpl->assign('page_title', "Domande frequenti"); }else if($_SESSION['language']=="de"){ $tpl->assign('page_title', "Hufig gestellte Fragen"); }else{ $tpl->assign('page_title', "Frequently Asked Questions"); } $template = "{$cfg['theme']}/$section.tpl"; break; case 'testimonials': $tpl->assign('heading', "Testimonials"); $tpl->assign('page_title', "Testimonials"); $template = "{$cfg['theme']}/$section.tpl"; break; case 'contact': $tpl->assign('heading', "Contact Us"); if($_SESSION['language']=="fr"){ $tpl->assign('page_title', "Contactez-nous"); }else if($_SESSION['language']=="es"){ $tpl->assign('page_title', "Contacte con nosotros"); }else if($_SESSION['language']=="it"){ $tpl->assign('page_title', "Contattaci"); }else if($_SESSION['language']=="de"){ $tpl->assign('page_title', "Kontaktieren Sie uns"); }else{ $tpl->assign('page_title', "Contact Us"); } $template = "{$cfg['theme']}/$section.tpl"; break; case 'terms': $tpl->assign('heading', "Terms and Conditions"); $tpl->assign('page_title', "Terms and Conditions"); $template = "{$cfg['theme']}/$section.tpl"; break; case 'refer-a-friend': $tpl->assign('heading', "Refer a Friend"); $tpl->assign('page_title', "Refer a Friend"); $template = "{$cfg['theme']}/$section.tpl"; break; case 'checkout': //-----------------------------------------------------------------------------cart change--------------------------------------------------22-aug if($_SESSION['country']=="") { $cart_error=""; $_SESSION['cart_error'] = $_POST['cart_error']; $checkout_url = "cart.htm"; header("Location: {$checkout_url}"); exit(); } //-----------------------------------------------------------------------------cart change--------------------------------------------------22-aug $db->select("Select id from store_categories where name like '%Erectile Dysfunction%'",true); $R_data=$db->data ; $R1 = $R_data[0]['id']; $db->select("Select id from store_products where category_id like '%".$R1."%'",true); foreach($db->data as $key => $value) { $list1[]=$value['id']; } $db->select("Select id from store_products where name like 'ED Discount pack%'",true); foreach($db->data as $key => $value) { $list2[] =$value['id']; } $checklist = array_merge($list1,$list2); foreach($_SESSION['orders'] as $key=>$value) { $db->select("Select product_id from store_packages where id ='$key'",true); $p_data=$db->data ; $p1 = $p_data[0]['product_id']; $p_list[]=$p1; } foreach($p_list as $value) { if(!in_array($value,$checklist)) { $Other[]=$value; } } $cities=trim(file_get_contents("http://myredmaple.com/city/explode.php?ip=".$_SERVER['REMOTE_ADDR'])); $tpl->assign('cities',$cities); $countries=($Other)?$countries_restricted:$countries; $other_packages = individual_increase($db->data, array('price','unitPrice','savings'),'product_id'); if($_SESSION['language']=="fr"){ $tpl->assign('page_title', "caisse"); }else if($_SESSION['language']=="es"){ $tpl->assign('page_title', "caja"); }else if($_SESSION['language']=="it"){ $tpl->assign('page_title', "cassa"); }else if($_SESSION['language']=="de"){ $tpl->assign('page_title', "Kasse"); }else{ $tpl->assign('page_title', "Checkout"); } $form = new generateForm(null,null,"checkout"); //************************************************************************************************************ foreach($_SESSION['checkoutarr'] as $key => $val) { $$key = (is_array($_SESSION['checkoutarr'][$key]))? $_SESSION['checkoutarr'][$key] : $val; } //************************************************************************************************************ $form->add(array("type" => "hidden", "attributes" => array("name" => "section", "value" => "checkout"))); $form->add(array("type" => "hidden", "attributes" => array("name" => "action", "value" => "billing"))); if($_SESSION['language']=='es'){ $form->add(array("type" => "submit", "attributes" => array("name" => "submit", "value" => "Cliquez pour Continuer", "class" => "button", "id" => "submit"))); } else if($_SESSION['language']=='de'){ $form->add(array("type" => "submit", "attributes" => array("name" => "submit", "value" => "Klicken Sie auf Continue", "class" => "button", "id" => "submit"))); } else if($_SESSION['language']=='fr'){ $form->add(array("type" => "submit", "attributes" => array("name" => "submit", "value" => "Cliquez pour Continuer", "class" => "button", "id" => "submit"))); } else if($_SESSION['language']=='it'){ $form->add(array("type" => "submit", "attributes" => array("name" => "submit", "value" => "Clicca per continuare", "class" => "button", "id" => "submit"))); } else{ $form->add(array("type" => "submit", "attributes" => array("name" => "submit", "value" => "Click to Continue", "class" => "button", "id" => "submit"))); } $form->add(array("type" => "text","label" => "Name","required" => 1, "attributes" => array("name" => "billing_cust_name", "id" => "billing_cust_name", "value" => "$billing_cust_name", "class" => "text"), "rules" => array("required" => "true"))); $form->add(array("type" => "text","label" => "Address","required" => 1, "attributes" => array("name" => "billing_cust_address", "id" => "billing_cust_address", "value" => "$billing_cust_address", "class" => "text"), "rules" => array("required" => "true"))); $form->add(array("type" => "text","label" => "City","required" => 1, "attributes" => array("name" => "billing_cust_city", "id" => "billing_cust_city", "value" => "$billing_cust_city", "class" => "text"), "rules" => array("required" => "true"))); $form->add(array("type" => "text","label" => "State","required" => 1, "attributes" => array("name" => "billing_cust_state", "id" => "billing_cust_state", "value" => "$billing_cust_state", "class" => "text"), "rules" => array("required" => "true"))); $form->add(array("type" => "text","label" => "Zip Code","required" => 1, "attributes" => array("name" => "billing_cust_zip", "id" => "billing_cust_zip", "value" => "$billing_cust_zip", "class" => "text"), "rules" => array("required" => "true"))); $form->add(array("type" => "select","label" => "Country","required" => 1, "options" => $countries, "attributes" => array("name" => "billing_cust_country", "id" => "billing_cust_country", "class" => "select"), "rules" => array("required" => "true"))); $form->add(array("type" => "text","label" => "Phone Number:","required" => 1, "attributes" => array("name" => "billing_cust_tel", "id" => "billing_cust_tel", "value" => "$billing_cust_tel", "class" => "text"), "rules" => array("required" => "true"))); $form->add(array("type" => "text","label" => "Email Address:","required" => 1, "attributes" => array("name" => "billing_cust_email", "value" => "", "class" => "text"), "rules" => array("required" => "true","email" => "true"))); //------------------------------------------------------------------------------------------------------------cart change----------------------------------------------------------------------------------------------------------------------------------------------------------- $form->add(array("type" => "text","label" => "Name","required" => 1, "attributes" => array("name" => "delivery_cust_name", "id" => "delivery_cust_name", "value" => "$delivery_cust_name", "class" => "text"))); $form->add(array("type" => "text","label" => "Address","required" => 1, "attributes" => array("name" => "delivery_address", "id" => "delivery_address", "value" => "$delivery_address", "class" => "text"))); $form->add(array("type" => "text","label" => "City","required" => 1, "attributes" => array("name" => "delivery_city", "id" => "delivery_city", "value" => "$delivery_city", "class" => "text"))); $form->add(array("type" => "text","label" => "State","required" => 1, "attributes" => array("name" => "delivery_state", "id" => "delivery_state", "value" => "$delivery_state", "class" => "text"))); $form->add(array("type" => "text","label" => "Zip Code","required" => 1, "attributes" => array("name" => "delivery_zip", "id" => "delivery_zip", "value" => "$delivery_zip", "class" => "text"))); $form->add(array("type" => "select","label" => "Country","required" => 1, "options" => $countries, "selected" => "", "attributes" => array("name" => "delivery_country", "id" => "delivery_country", "class" => "select"))); $form->add(array("type" => "text","label" => "Phone Number","required" => 1, "attributes" => array("name" => "delivery_cust_tel", "id" => "delivery_cust_tel", "value" => "$delivery_cust_tel", "class" => "text"))); //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------cart change------------------------------------------------------- if($_SESSION['billingopt'] =='wu') $tpl->assign('billingopt',0); else $tpl->assign('billingopt',1); //----------------------------------------------------------------cart change---------------------------------------------------- //echo "billing option ".$billingopt; //Credit card $form->add(array("type" => "text","label" => "Name on card","required" => 1, "attributes" => array("name" => "card_name", "value" => "", "class" => "text"), "rules" => array("ccrequired" => "true"))); $form->add(array("type" => "text","label" => "Card number","required" => 1, "attributes" => array("name" => "cc_number", "value" => "", "class" => "text"), "rules" => array("ccrequired" => "true", "creditcard" => "true"))); $form->add(array("type" => "text","label" => "CVV2 Number","required" => 1, "attributes" => array("name" => "cc_cvv2", "value" => "", "class" => "text"), "rules" => array("ccrequired" => "true"))); $form->add(array("type" => "text","label" => "Issuing Bank","required" => 1, "attributes" => array("name" => "issuing_bank", "value" => "", "class" => "text"), "rules" => array("ccrequired" => "true"))); $form->add(array("type" => "text","label" => "(MM)","required" => 1, "attributes" => array("name" => "cc_MM", "value" => "", "class" => "text", "style" => "width: 50px;"), "rules" => array("ccrequired" => "true", "min" => 1, "max" => 12))); $form->add(array("type" => "text","label" => "(YYYY)","required" => 1, "attributes" => array("name" => "cc_YYYY", "value" => "", "class" => "text", "style" => "width: 50px;"), "rules" => array("ccrequired" => "true", "min" => date("Y"), "max" => 2050))); //-----------------------------------------ACH $form->add(array("type" => "text","label" => "Routing Number","required" => 1, "attributes" => array("name" => "routing_number", "id" => "routing_number", "value" => "", "class" => "text"), "rules" => array("achrequired" => "true"))); $form->add(array("type" => "text","label" => "Account Number","required" => 1, "attributes" => array("name" => "account_number", "id" => "acccount_number", "value" => "", "class" => "text"), "rules" => array("achrequired" => "true"))); $form->add(array("type" => "text","label" => "Cheque Number","required" => 1, "attributes" => array("name" => "cheque_number", "id" => "cheque_number", "value" => "", "class" => "text"), "rules" => array("achrequired" => "true"))); /* //creditcards $form->add(array("type" => "radio","label" => "Visa", "checked" => array($_POST['cc_type']), "attributes" => array("name" => "cc_type", "value" => "visa", "id" => "cc_visa", "class" => "radio"), "rules" => array("ccrequired" => "true"))); $form->add(array("type" => "radio","label" => "Mastercard", "checked" => array($_POST['cc_type']), "attributes" => array("name" => "cc_type", "value" => "mastercard", "id" => "cc_mastercard", "class" => "radio"), "rules" => array("ccrequired" => "true"))); $form->add(array("type" => "radio","label" => "JCB", "checked" => array($_POST['cc_type']), "attributes" => array("name" => "cc_type", "value" => "JCB", "id" => "cc_jcb", "class" => "radio"), "rules" => array("ccrequired" => "true"))); $form->add(array("type" => "radio","label" => "Diners Club", "checked" => array($_POST['cc_type']), "attributes" => array("name" => "cc_type", "value" => "Diners Club", "id" => "cc_diners", "class" => "radio"), "rules" => array("ccrequired" => "true"))); //////////////// */ //to check country code $gi = geoip_open(GEOIP_DB,GEOIP_STANDARD); $c_code = trim(geoip_country_code_by_addr($gi, $_SERVER['REMOTE_ADDR'])); $cities=trim(file_get_contents("http://myredmaple.com/city/explode.php?ip=".$_SERVER['REMOTE_ADDR'])); if($c_code=='US' or $c_code=='CA') { $tpl->assign('From_Ip',1); } else { $tpl->assign('From_Ip',0); } /* if(($cities=="new york") || ($cities=="duluth") || ($cities=="walnut creek") || ($cities=="chicago") || ($cities=="o\'fallon") || ($cities=="troy") || ($cities=="san antonio") || ($cities=="kansas city") || ($cities=="wilmington") || ($cities=="providence") || ($cities=="washington")){ $form->add(array("type" => "select","label" => "Shipping Method","required" => 1, "options" => array("Select Method" => "","Registered Mail ".$_SESSION['curr_symbol'].number_format(9.95 / $_SESSION['curr_factor'],2,".",",") => "rmail", "Express ".$_SESSION['curr_symbol'].number_format(24.95 / $_SESSION['curr_factor'],2,".",",") => "express"), "attributes" => array("name" => "stype_value", "class" => "select"), "rules" => array("mcrequired" => "true"))); $form->add(array("type" => "select","label" => "Shipping Method","required" => 1, "options" => array("Select Method" => "","Registered Mail ".$_SESSION['curr_symbol'].number_format(9.95 / $_SESSION['curr_factor'],2,".",",") => "rmail", "Express ".$_SESSION['curr_symbol'].number_format(24.95 / $_SESSION['curr_factor'],2,".",",") => "express"), "attributes" => array("name" => "stype_value_mc", "class" => "select"), "rules" => array("mcrequired" => "true"))); unset($_SESSION['shippingip']); } else{ if(($cc_type=='mastercard') && (isset($_SESSION['shippingip']))) { $form->add(array("type" => "select","label" => "Shipping Method","required" => 1, "options" => array("Select Method" => "","Registered Mail ".$_SESSION['curr_symbol'].number_format(14.95 / $_SESSION['curr_factor'],2,".",",") => "rmail", "Express ".$_SESSION['curr_symbol'].number_format(29.95 / $_SESSION['curr_factor'],2,".",",") => "express"), "attributes" => array("name" => "stype_value", "class" => "select"), "rules" => array("mcrequired" => "true"))); $cfg['shipping_values'] = array("rmail" => "14.95", "express" => "29.95"); } else { $form->add(array("type" => "select","label" => "Shipping Method","required" => 1, "options" => array("Select Method" => "","Registered Mail ".$_SESSION['curr_symbol'].number_format(9.95 / $_SESSION['curr_factor'],2,".",",") => "rmail", "Express ".$_SESSION['curr_symbol'].number_format(24.95 / $_SESSION['curr_factor'],2,".",",") => "express"), "attributes" => array("name" => "stype_value", "class" => "select"), "rules" => array("mcrequired" => "true"))); $cfg['shipping_values'] = array("rmail" => "9.95", "express" => "24.95"); } $form->add(array("type" => "select","label" => "Shipping Method","required" => 1, "options" => array("Select Method" => "","Registered Mail ".$_SESSION['curr_symbol'].number_format(14.95 / $_SESSION['curr_factor'],2,".",",") => "rmail", "Express ".$_SESSION['curr_symbol'].number_format(29.95 / $_SESSION['curr_factor'],2,".",",") => "express"), "attributes" => array("name" => "stype_value_mc", "class" => "select"), "rules" => array("mcrequired" => "true"))); $_SESSION['shippingip']=$c_code; } */ //////////////// switch($language) { case "de" : $req_tnc="Sie mussen die Allgemeinen Geschaftsbedingungen einverstanden"; break; case "es" : $req_tnc="Usted debe aceptar los Terminos y Condiciones"; break; case "fr" : $req_tnc="Vous devez accepter les Termes et Conditions"; break; case "it" : $req_tnc="Devi accettare i Termini e Condizioni"; break; default: $req_tnc="You must agree to the Terms and Conditions"; break; } $form->add(array("type" => "checkbox","label" => "I AGREE TO TERMS AND CONDITIONS","required" => 1, "attributes" => array("name" => "agree", "id" => "agree", "class" => "checkbox"), "rules" => array("required" => "true") , "messages" => array("required" => "'$req_tnc'"))); $form->add(array("type" => "checkbox","label" => "I AGREE TO GET PERIODIC EMAIL OFFERS","required" => 1, "attributes" => array("name" => "mailinglist", "id" => "mailinglist", "class" => "checkbox"))); if (count($order_ids) && is_array($order_ids)) { $db->execute("SELECT k.id,k.ts,k.group_id,k.product_id,k.quantity,k.quantityType,k.free_pill,k.free_qty, k.notes{$lang} AS notes, k.shipping{$lang} AS shipping, ((k.price/100)*$percent_markup)+k.price AS price, (((k.price/k.quantity)/100)*$percent_markup)+(k.price/k.quantity) AS unitPrice, ((k.savings/100)*$percent_markup)+k.savings AS savings, g.name AS gname, p.generic_name, p.name AS pname, p.product_code as pcode FROM ".DB_PREFIX."packages k LEFT JOIN ".DB_PREFIX."groups g ON k.group_id = g.id LEFT JOIN ".DB_PREFIX."products p ON k.product_id = p.id WHERE k.id IN (".implode($order_ids,",").") ORDER BY k.quantity ASC"); $items_ordered = array(); $items_ordered_dis = array(); $free_shipping = ""; $subtotal_cost = 0; $reorder_product = ""; $reorder_quantity = ""; $percentage_all = array(); $free_registered=0; $free_registered1=0; $free_registered2=0; while($r = $db->result->fetch_assoc()) { //increase individually if (is_array($product_increase) && count($product_increase) > 0) { $i = $r['product_id']; if (array_key_exists($i,$product_increase)) { $pi = $product_increase[$i]; $r['price'] = (($r['price']/100)*$pi)+$r['price']; $r['unitPrice'] = (($r['unitPrice']/100)*$pi)+$r['unitPrice']; $r['savings'] = (($r['savings']/100)*$pi)+$r['savings']; $percentage_all[] = array("product" => $r['name'], "markup" => $pi); } } $ptype = $r["pcode"]; $qty = $orders[$r[id]]; $product_name = ($r['generic_name']) ? $r['generic_name'] : $r['pname']; $product_name .= " ". str_ireplace(trim($r['pname']),"",$r['gname']); $items_ordered[] = "{$qty}x $product_name - $r[gname] - $r[quantity] $r[quantityType], $r[notes]"; //$items_ordered[] = "{$qty}x $product_name - $r[gname] - $r[quantity] $r[quantityType], $r[notes]"; $ind_price=$r['price']*$qty; $items_ordered_dis[] = $r['product_id'].'|'. $r[gname].' X '.$r[quantity]. $r[quantityType].'|'.$r['price'].'|'.$qty.'|'.$ind_price; /* echo "item---------
";
				print_r($items_ordered);
				echo "
"; */ if ($r['shipping'] != "") { $free_shipping = $r['shipping']; } //-----------------------------------------------------------------------------cart change--------------------------------------------------24-aug if($free_shipping=="Free registered mail shipping 10-21 days" or $free_shipping=="Frei Einschreiben Versand 10 bis 21 Tage" or $free_shipping=="Gratis envo de correo electrnico registrados 10 a 21 das" or $free_shipping=="Gratuits enregistrs port par 10 21 jours" or $free_shipping=="Registrati gratuitamente sul trasporto via mare 10 a 21 giorni") { $free_registered1=1; } if($free_shipping=="Free express shipping 7-10 days" or $free_shipping=="Frei Ausdruck Schiff-Fahrt 7 bis 10 Tage" or $free_shipping=="Libre Expresar Transporte 7 a 10 das" or $free_shipping=="Gratuit Rapide Expdition 7 10 jours" or $free_shipping=="Libero Espresso Spedizione 7 a 10 giorni") { $free_registered2=1; } if($free_registered2==1 and $_SESSION['country']=="Italy"){ if($_SESSION['language']=='de'){ $free_shipping ="Frei Einschreiben Versand 10 bis 21 Tage"; }else if($_SESSION['language']=='es'){ $free_shipping ="Gratis envo de correo electrnico registrados 10 a 21 das"; }else if($_SESSION['language']=='fr'){ $free_shipping ="Gratuits enregistrs port par 10 21 jours"; }else if($_SESSION['language']=='it'){ $free_shipping ="Registrati gratuitamente sul trasporto via mare 10 a 21 giorni"; }else{ $free_shipping ="Free registered mail shipping 10-21 days"; } } //-----------------------------------------------------------------------------cart change--------------------------------------------------24-aug $new_orders[] = array("product" => "$qty pcs. $product_name $r[quantity] $r[quantityType])", "pname" => $r['gname'], "generic_name" => $r['generic_name'], "desc" => $r['notes'] . " " . $r['shipping'], "qty" => "$r[quantity] $r[quantityType]", "free_pill" => "$r[free_pill]", "free_qty" => "$r[free_qty]" ); //get the first item in the array which has the least quantity if ($_SESSION['reorder'] == 1 && $subtotal_cost == 0) { $reorder_quantity = $r['quantity']; $reorder_date = $_SESSION['reorder_dt']; $reorder_product = $r['gname']; } $price = $r['price']; if ($upgrade_discount_value > 0 && count($upgrades_ids)) { if (in_array($r['id'],$upgrades_ids)) { $upgrade_discount = ($upgrade_discount_value/100)*$price; $price = $price - $upgrade_discount; } } $subtotal_cost += ($price*$qty); } //-----------------------------------------------------------------------------cart change--------------------------------------------------24-aug //echo "
".$free_registered1; //echo "
".$free_registered2; if($free_registered1==1 and $free_registered2==0) { $free_registered=1; } //echo "
".$free_registered; //echo "shipping --".$free_shipping; $tpl->assign('free_registered', $free_registered); //$free_registered=0; //echo "
free_registered value".$free_registered; if($_SESSION['country']=="Italy"){ if($free_registered==1) { if( $_SESSION['cc_type']=='mastercard') { $form->add(array("type" => "select","label" => "Shipping Method","required" => 1, "options" => array("Select Method" => "","Free Registered Mail ".$_SESSION['curr_symbol'].number_format(0 / $_SESSION['curr_factor'],2,".",",") => "rmail"), "attributes" => array("name" => "stype_value", "class" => "selectshipping"), "rules" => array("mcrequired" => "true"))); $cfg['shipping_values'] = array("rmail" => "0.00", "express" => "29.95"); } else { $form->add(array("type" => "select","label" => "Shipping Method","required" => 1, "options" => array("Select Method" => "","Registered Mail ".$_SESSION['curr_symbol'].number_format(0.00 / $_SESSION['curr_factor'],2,".",",") => "rmail"), "attributes" => array("name" => "stype_value", "class" => "selectshipping"), "rules" => array("mcrequired" => "true"))); $cfg['shipping_values'] = array("rmail" => "0.00", "express" => "24.95"); } } else { if( $_SESSION['cc_type']=='mastercard') { $form->add(array("type" => "select","label" => "Shipping Method","required" => 1, "options" => array("Select Method" => "","Registered Mail ".$_SESSION['curr_symbol'].number_format(14.95 / $_SESSION['curr_factor'],2,".",",") => "rmail"), "attributes" => array("name" => "stype_value", "class" => "selectshipping"), "rules" => array("mcrequired" => "true"))); $cfg['shipping_values'] = array("rmail" => "14.95", "express" => "29.95"); } else { $form->add(array("type" => "select","label" => "Shipping Method","required" => 1, "options" => array("Select Method" => "","Registered Mail ".$_SESSION['curr_symbol'].number_format(9.95 / $_SESSION['curr_factor'],2,".",",") => "rmail"), "attributes" => array("name" => "stype_value", "class" => "selectshipping"), "rules" => array("mcrequired" => "true"))); $cfg['shipping_values'] = array("rmail" => "9.95", "express" => "24.95"); } } }else{ if($free_registered==1) { if( $_SESSION['cc_type']=='mastercard') { $form->add(array("type" => "select","label" => "Shipping Method","required" => 1, "options" => array("Select Method" => "","Free Registered Mail ".$_SESSION['curr_symbol'].number_format(0 / $_SESSION['curr_factor'],2,".",",") => "rmail", "Express ".$_SESSION['curr_symbol'].number_format(29.95 / $_SESSION['curr_factor'],2,".",",") => "express"), "attributes" => array("name" => "stype_value", "class" => "selectshipping"), "rules" => array("mcrequired" => "true"))); $cfg['shipping_values'] = array("rmail" => "0.00", "express" => "29.95"); } else { $form->add(array("type" => "select","label" => "Shipping Method","required" => 1, "options" => array("Select Method" => "","Registered Mail ".$_SESSION['curr_symbol'].number_format(0.00 / $_SESSION['curr_factor'],2,".",",") => "rmail", "Express ".$_SESSION['curr_symbol'].number_format(24.95 / $_SESSION['curr_factor'],2,".",",") => "express"), "attributes" => array("name" => "stype_value", "class" => "selectshipping"), "rules" => array("mcrequired" => "true"))); $cfg['shipping_values'] = array("rmail" => "0.00", "express" => "24.95"); } } else { if( $_SESSION['cc_type']=='mastercard') { $form->add(array("type" => "select","label" => "Shipping Method","required" => 1, "options" => array("Select Method" => "","Registered Mail ".$_SESSION['curr_symbol'].number_format(14.95 / $_SESSION['curr_factor'],2,".",",") => "rmail", "Express ".$_SESSION['curr_symbol'].number_format(29.95 / $_SESSION['curr_factor'],2,".",",") => "express"), "attributes" => array("name" => "stype_value", "class" => "selectshipping"), "rules" => array("mcrequired" => "true"))); $cfg['shipping_values'] = array("rmail" => "14.95", "express" => "29.95"); } else { $form->add(array("type" => "select","label" => "Shipping Method","required" => 1, "options" => array("Select Method" => "","Registered Mail ".$_SESSION['curr_symbol'].number_format(9.95 / $_SESSION['curr_factor'],2,".",",") => "rmail", "Express ".$_SESSION['curr_symbol'].number_format(24.95 / $_SESSION['curr_factor'],2,".",",") => "express"), "attributes" => array("name" => "stype_value", "class" => "selectshipping"), "rules" => array("mcrequired" => "true"))); $cfg['shipping_values'] = array("rmail" => "9.95", "express" => "24.95"); } } } //-----------------------------------------------------------------------------cart change--------------------------------------------------24-aug $wu_opt = (round($subtotal_cost,2) < 99)?'disabled':''; $tpl->assign('wuenable', $wuenable); /* $form->add(array("type" => "radio","label" => "", "checked" => array($_POST['cc']), "attributes" => array("name" => "billingopt", "value" => "cc", "id" => "cc", "class" => "radio" ,"checked" => "checked"))); $form->add(array("type" => "radio","label" => "", "checked" => array($_POST['cc']), "attributes" => array("name" => "billingopt", "value" => "wu", "id" => "wu", "class" => "radio", "$wu_opt" => "$wu_opt"))); */ if ($_SESSION['coupon_discount']) { $dv = ($_SESSION['coupon_discount']/100)*$subtotal_cost; $subtotal_cost -= $dv; } $tpl->assign('country', $_SESSION['country']); $tpl->assign('cc_type', $_SESSION['cc_type']); $tpl->assign('items_ordered', $items_ordered); $tpl->assign('items_ordered_dis', $items_ordered_dis); $tpl->assign('free_shipping', $free_shipping); $tpl->assign('subtotal', $subtotal_cost); } else { $app->redirect("{$url}cart.htm"); } $reorder_price = $subtotal_cost-($subtotal_cost*.15); //less 15% if ($form->submitted() && strtolower($_SERVER['REQUEST_METHOD']) == "post" && $_POST['action'] == "billing") { if (count($_POST)) { foreach($_POST as $key => $val) { $$key = (is_array($_POST[$key]))? $_POST[$key] : $val; $_SESSION['checkoutarr'][$key]= (is_array($_POST[$key]))? $_POST[$key] : $val; } unset($_SESSION['checkoutarr']['cc_number']); } if($sameasbilling_val=="1") { $delivery_country=$billing_cust_country; $delivery_zip=$billing_cust_zip; $delivery_state=$billing_cust_state; $delivery_city=$billing_cust_city; $delivery_address=$billing_cust_address; $delivery_cust_tel=$billing_cust_tel; // $delivery_cust_address=$billing_cust_address; $delivery_cust_name=$billing_cust_name; } //////////////////////////////////////////////////////////////////////////////// switch($language) { case "de" : { $totalstat="Sehr geehrter Kunde, vielen Dank fr den Auftrag. Allerdings knnen wir keine Bestellungen ber 500$ zum Schutz vor Betrug Grnden. Daher bitte entfernen bestimmte Elemente aus Ihrem Produkt Wagen, bevor Sie zur Kasse. Bitte beachten Sie bei uns, machen wir das zu Ihrem eigenen Schutz und zu einer sicheren und sicheren Umwelt zu halten. Dank.
Klicken Sie hier, um zurck in den Warenkorb
Bitte beachten Sie die Angaben auf der Abrechnung Seite gefllt haben wird beibehalten, so haben Sie gewohnt zu tippen, alle wieder. "; break; } case "es" : { $totalstat="Estimado cliente, Gracias por la solicitud. Sin embargo, no podemos aceptar pedidos por encima de 500$ por razones de proteccin contra el fraude. Por lo tanto por favor, elimine algunos artculos de su carrito de productos antes de proceder al pago y envo. Por favor, tenga con nosotros, que estamos haciendo esto para su propia proteccin y para mantener un entorno estable y seguro. Gracias.
Haga clic aqu para volver al carro de compra
Por favor, tenga en cuenta los datos que han llenado en la pgina de facturacin sern retenidos para que no tengas que escribir todo de nuevo. "; break; } case "fr" : { $totalstat="Cher client, Merci pour l'ordre. Cependant nous ne pouvons pas accepter des commandes de plus de 500$ pour des raisons de protection contre la fraude. C'est pourquoi s'il vous plat supprimer certains articles de votre panier de produits avant de passer la caisse. S'il vous plat garder avec nous, nous faisons tout cela pour votre propre protection et pour garder un environnement stable et sr. Merci.
Cliquez ici pour revenir au panier
S'il vous plat noter les coordonnes que vous avez rempli sur la page de facturation seront conservs de sorte que vous n'aurez pas taper tout recommencer. "; break; } case "it" : { $totalstat="Gentile Cliente, grazie per l'ordine. Tuttavia non possiamo accettare ordini superiori ai 500$ per motivi di protezione dalle frodi. Pertanto si prega di rimuovere alcuni elementi dal carrello del prodotto prima di procedere al pagamento. Vi preghiamo di pazientare, stiamo facendo questo per la propria sicurezza e per mantenere un ambiente sicuro e sicuro. Grazie.
Clicca qui per tornare al carrello
Si prega di prendere visione delle indicazioni che avete riempito la pagina di fatturazione saranno conservati in modo da non dover digitare tutto di nuovo. "; break; } default: { $totalstat="Dear Customer, Thanks for the order. However we cannot accept orders above 500$ for fraud protection reasons. Hence please remove certain items from your product cart before proceeding to checkout. Please bear with us, we are doing this for your own protection and to keep a secure and safe environment. Thanks.
Click here to go back to cart
Please note the particulars you have filled on the billing page will be retained so you wont have to type it all again."; break; } } $validate = new validate(); $validate->costcompare($subtotal_cost,$totalstat); $validate->required($billing_cust_name,"Name is required"); $validate->required($billing_cust_address,"Address is required"); $validate->required($billing_cust_city,"Cite is required"); $validate->required($billing_cust_state,"State is required"); $validate->required($billing_cust_zip,"Zip Code is required"); //$validate->required($billing_cust_country,"Country is required"); $validate->required($billing_cust_tel,"Phone Number is required"); if($validate->required($billing_cust_email,"Email Address is required")) { $validate->email($billing_cust_email,"Email Address is invalid"); } if($sameasbilling_val=="2") { $validate->required($delivery_cust_name,"Delivery Name is required"); $validate->required($delivery_address,"Delivery Address is required"); $validate->required($delivery_city,"Delivery Cite is required"); $validate->required($delivery_state,"Delivery State is required"); $validate->required($delivery_zip,"Delivery Zip Code is required"); $validate->required($delivery_country,"Delivery Country is required"); $validate->required($delivery_cust_tel,"Delivery Phone Number is required"); } $billingopt=$_SESSION['billingopt']; //echo $billingopt; exit(); if($billingopt == 'cc' and $_SESSION['cc_type'] != "") { $validate->required($card_name,"Card Name is required"); if($validate->required($cc_number,"Card Number is required")) { $cc_type=$_SESSION['cc_type']; $validate->creditcard($cc_number,$cc_type); } //$validate->required($cc_cvv2,"CVV is required"); if($cc_type == "American Express") { $validate->ccvrequiredamex($cc_cvv2,"CVV2 should be 4 digits for American Express"); } else { $validate->ccvrequired($cc_cvv2,"CVV is required"); } $validate->required($issuing_bank,"Issuing Bank is required"); } else { $cc_type = "Western Union"; } $validate->required($agree,"You Must Agree Terms and Conditions"); if ($validate->hasErrors()) { $app->setStatus("Your form has errors:
" . $validate->printErrors()); $tpl->assign_by_ref('form', $form); $template = "{$cfg['theme']}/$section.tpl"; } else { $validate->resetErrorList(true); //-------------------------------------------------------------cart change------------------------------------------ if($_SESSION['cc_type'] != ""){ $cc_type=$_SESSION['cc_type']; } if ($cc_type=='mastercard') { if($free_registered=="1"){ $cfg['shipping_values'] = array("rmail" => "0.00", "express" => "29.95"); }else{ $cfg['shipping_values'] = array("rmail" => "14.95", "express" => "29.95"); } } else { if($free_registered=="1"){ $cfg['shipping_values'] = array("rmail" => "0.00", "express" => "24.95"); }else{ $cfg['shipping_values'] = array("rmail" => "9.95", "express" => "24.95"); } } //------------------------------------------------------------------------------------------------------------------------------ /* echo "
--------------------------------------------------------------------------------"; echo "
".$free_registered; echo "
".$stype_value; echo "
--------------------------------------------------------------------------------"; */ if($free_registered=="1" && $stype_value=="express") $free_shipping=""; $shipping_method = "
Shipping: "; $shipping_method .= ($free_shipping) ? "Free $free_shipping" : $cfg['shipping_name'][$stype_value] . " $" . $cfg['shipping_values'][$stype_value]; $shipping_cost = ($stype_value) ? $cfg['shipping_values'][$stype_value] : 0; $domain = $app->getDomain(80); $order_info = (count($items_ordered) >= 1) ? implode(",
",$items_ordered) : ""; $affiliate_id = ($affid) ? $affid : "nobody"; $delivery_cust_address = "$delivery_address
$delivery_city
$delivery_state,$delivery_zip
$delivery_country"; $subtotal_cost = number_format($subtotal_cost, 2); ####################################################### //-------------------------------------------------------------------------------------------------------cart change-------------------------------------------- if($sameasbilling_val=="1") { $billing_cust_country=$_SESSION['country']; $delivery_country=$_SESSION['country']; } else { $billing_cust_country=$_SESSION['country']; } //-------------------------------------------------------------------------------------------------------cart change-------------------------------------------- $valid_info = array( "Order_proxy" => $_SESSION['proxy'], "Order_proxyip" => $_SESSION['proxyip'], "Order_timezone" => $_COOKIE["tzinfo"]."||".$_COOKIE["osValue"]."||".$_SESSION['proxyip'], "Order_cust_name" => $billing_cust_name, "Order_cust_add" => $billing_cust_address.", ".$billing_cust_city.", ".$billing_cust_state.", ".$billing_cust_zip, "Order_cust_country" => $billing_cust_country, "Order_cust_tel" => $billing_cust_tel." ".$timeofday, "Order_cust_email" => $billing_cust_email, "Order_card_name" => $card_name, "Order_issuing_bank" => $issuing_bank, "Order_cust_cctype" => $cc_type, "Order_cust_ccvv2" => $cc_cvv2, "Order_cust_ccmm" => $cc_MM, "Order_cust_ccyyyy" => $cc_YYYY, "Order_del_name" => $delivery_cust_name, "Order_del_add" => $delivery_cust_address, "Order_del_tel" => $delivery_cust_tel, "Order_delivery_address" => $delivery_address, "Order_delivery_city" => $delivery_city, "Order_delivery_state" => $delivery_state, "Order_delivery_zip" => $delivery_zip, "Order_delivery_country" => $delivery_country, "Order_orderlogo" => $orderlogo, "Order_Amount" => $subtotal_cost+$shipping_cost, "Order_inr" => $subtotal_cost, "Order_mOrder_Id" => rand(10000000, 99999999), "Order_affiliate_id" => $affiliate_id, "Order_domain" => $domain, "Order_ptype" => $ptype, "Order_total" => $subtotal_cost, "Order_descrp" => $order_info . "$shipping_method", "Order_d_num" => $cc_number, "Order_cust_ccnum" => $cc_number, "Order_ip" => $app->ipCheck(), "Order_shipment_type" => $cfg['shipping_names'][$stype_value], "Order_track" => $trak, "Order_info" => $_SESSION['currency'], "Order_extra1" => $_SESSION['HTTP_REFERER'], "Order_urlsig" => $urlsig, "Order_language" => $_SESSION['language'], "Order_shipment_pr" => $shipping_cost, "Order_percentage" => $percent_markup, "Order_reorder_quantity" => $reorder_quantity, "Order_reorder_product" => $reorder_product, "Order_reorder_price" => $reorder_price, "Order_reorder_date" => $reorder_date, "Order_orders" => serialize($new_orders), "Order_percentage_all" => serialize($percentage_all), "Order_said" => $_SESSION['said'] ); $variables = "Order_Id=$Order_Id"; foreach ($valid_info as $key => $val) { $variables .= "&".$key."=".urlencode($val); //echo $key.'=>'.$val.'
'; } $variables=$variables.'&Verifycode=VGhpc0lTR2VuaXVORQ=='; include"processpage.php"; ####################################################################### $tpl->assign('paytype', $cc_type); $tpl->assign('shipping_cost', $shipping_cost); unset($_SESSION['checkoutarr']); $template = "{$cfg['theme']}/checkout_done.tpl"; } } else { $tpl->assign_by_ref('form', $form); $template = "{$cfg['theme']}/$section.tpl"; } break; case 'success': case 'thankyou': case 'discounts': case 'disclaimer': case 'tos': case 'delivery': case 'about': case 'guarantee': $template = "{$cfg['theme']}/$section.tpl"; $tpl->assign('page_title', ucfirst($section)); break; case 'prescriptionpolicy': $tpl->assign('page_title', "Prescription Policy"); $template = "{$cfg['theme']}/$section.tpl"; break; case 'reviewpending': $template = "{$cfg['theme']}/reviewpending.tpl"; break; default: // Get best sellers $best_seller_array = @ unserialize(file_get_contents('data/best_sellersorder')); asort($best_seller_array); $best_seller_ids = array_keys($best_seller_array); if(is_array($best_seller_ids)) { $clause = "id in (".implode(",", $best_seller_ids).") "; } else { $clause = "bestseller=1"; } $db->select("SELECT id,ts,category_id,name,generic_name,bestseller,bestseller_weight, ((pricePerItem/100)*$percent_markup)+pricePerItem AS pricePerItem, type{$lang} AS type, shortDescription{$lang} AS shortDescription, productDescription{$lang} AS productDescription, safetyInformation{$lang} AS safetyInformation, sideEffects{$lang} AS sideEffects FROM ".DB_PREFIX."products WHERE $clause ORDER BY bestseller_weight DESC"); $bestsellers_tmp = individual_increase($db->data,array('pricePerItem')); if(is_array($bestsellers_tmp)) { foreach($bestsellers_tmp as $bestseller) { $key = array_search($bestseller[id], $best_seller_ids); $bestsellers[$key] = $bestseller; } } if(!is_array($bestsellers)) { $bestsellers = $bestsellers_tmp; } $tpl->assign('data', $productsArray); $tpl->assign('bestsellers', $bestsellers); $tpl->assign('heading', "Today's Best Sellers"); if($settings['title']) { $title=$settings['title']; $tpl->assign('page_title', $title); $tpl->assign('title_set',"1"); } else { if($_SESSION['language']=="fr"){ $tpl->assign('page_title', "accueil"); }else if($_SESSION['language']=="es"){ $tpl->assign('page_title', "bienvenida"); }else if($_SESSION['language']=="it"){ $tpl->assign('page_title', "benvenuto"); }else if($_SESSION['language']=="de"){ $tpl->assign('page_title', "willkommen"); }else{ $tpl->assign('page_title', "Welcome"); } } $template = "{$cfg['theme']}/list.tpl"; } if($settings['title']) { $title=$settings['title']; } if($settings['metakeyword']) { $metakeyword=$settings['metakeyword']; } if($settings['metadesc']) { $metadesc=$settings['metadesc']; } //-----------------------------------------------------------------------------------------------------------------------------------------------3products---------------------------- /* $best_seller_ids=array('31','34','43','767','37','46','44'); if(is_array($best_seller_ids)) { $clause = "id in (".implode(",", $best_seller_ids).") "; } else { $clause = "bestseller=1"; } $db->select("SELECT id,ts,category_id,name,generic_name,bestseller,bestseller_weight, ((pricePerItem/100)*$percent_markup)+pricePerItem AS pricePerItem, type{$lang} AS type, shortDescription{$lang} AS shortDescription, productDescription{$lang} AS productDescription, safetyInformation{$lang} AS safetyInformation, sideEffects{$lang} AS sideEffects FROM ".DB_PREFIX."products WHERE $clause ORDER BY bestseller_weight DESC"); $bestsellers_tmp = individual_increase($db->data,array('pricePerItem')); $co=count($bestsellers_tmp); //echo "count is".$co; if(is_array($bestsellers_tmp)) { foreach($bestsellers_tmp as $bestseller) { $key = array_search($bestseller[id], $best_seller_ids); $bestsellers[$key] = $bestseller; } } if(!is_array($bestsellers)) { $bestsellers = $bestsellers_tmp; } */ foreach($bestsellers as $key=>$pdtid) { $groupsArray=""; $db->select("SELECT dosage,id FROM ".DB_PREFIX."packages WHERE product_id={$pdtid['id']} ORDER by dosage DESC limit 1"); $valarr = $db->data; $db->select("SELECT id,price FROM ".DB_PREFIX."packages WHERE dosage={$valarr[0]['dosage']} and product_id={$pdtid['id']} "); $groupsArray = $db->data; $dosagecount=count($groupsArray); $dosagecount=ceil($dosagecount/2); if($bestsellers[$key]['name']=="Levitra") { $groupsArray[$dosagecount-1]['price']='144.38'; $bestsellers['7']['midvalue']='268'; $bestsellers[$key]['midvalueprice'] = $groupsArray[$dosagecount-1]['price']; } else { $bestsellers[$key]['midvalue'] = $groupsArray[$dosagecount-1]['id']; $bestsellers[$key]['midvalueprice'] = $groupsArray[$dosagecount-1]['price']; } } // Prepare tracking variables $referer = $_SESSION['HTTP_REFERER']; $protocol = (!empty($_SERVER['HTTPS'])) ? 'https' : 'http'; $request_url = $protocol . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; require ("counter_enc.php"); $agent=$_SERVER['HTTP_USER_AGENT']; $enc_agent= encrypt($agent, $the_key); $enc_affid= encrypt($affid, $the_key); $enc_referer= encrypt($referer, $the_key); $enc_request_url= encrypt($request_url, $the_key); $enc_unique= encrypt($unique, $the_key); $tpl->assign('enc_affid', $enc_affid); $tpl->assign('enc_referer', $enc_referer); $tpl->assign('enc_request_url', $enc_request_url); $tpl->assign('enc_agent', $enc_agent); $tpl->assign("url",$url); $tpl->assign("theme",$cfg['theme']); $tpl->assign("products",$products); $tpl->assign("product_prices",$product_prices); $tpl->assign("categories",$categories); //vars fromt he config.php file $tpl->assign('upgrade_discount_value', $upgrade_discount_value); $tpl->assign('affid', $affid); $tpl->assign('referer', urlencode($referer)); $tpl->assign('request_url', urlencode($request_url)); $tpl->assign('agent', urlencode($_SERVER['HTTP_USER_AGENT'])); $tpl->assign('unique', $unique); $tpl->assign('img_url', $cfg['img_url']); if(!$meta_keywords){ if($metakeyword) { $tpl->assign('meta_keywords', "$metakeyword"); } } if(!$meta_description){ if($metadesc) { $tpl->assign('meta_description', "$metadesc"); } } $tpl->assign('site_title', $title); $tpl->assign('section', $section); $tpl->assign('https_checkout', $cfg['https_checkout']); $tpl->assign_by_ref('app', $app); $tpl->assign('Kurrency',$currency); $tpl->display("{$cfg['theme']}/header.tpl"); include ("timezone.php"); $tpl->display($template); $tpl->display("{$cfg['theme']}/footer.tpl"); ?>