$val){ #$CustText[$key] = toASCII($val); #$CustText[$key] = makeCleanCustomText($val); $CustText[$key] = htmlentities($CustText[$key],ENT_QUOTES); } } $varList = ""; $varList = $_COOKIE; if($_COOKIE){ fnValidateInputs($varList); } $varList = $_GET; if($varList){ fnValidateInputs($varList); } $varList = $_POST; if($varList){ fnValidateInputs($varList); } //AllowCartWithoutCookie($cart); //include "ups-class.php"; $i=0; $cartupdated=0; /************* Code added for faster multicat 04/15/05 *************/ $shop = 1; $prodopt1 = isset($all['prodopt1']) ? $all['prodopt1'] : ""; $cart = isset($all['cart']) ? htmlentities($all['cart'], ENT_QUOTES) : $cart; $cat = isset($all['cat']) ? htmlentities($all['cat'], ENT_QUOTES) : $cat; $quantity = isset($all['quantity']) ? $all['quantity'] : ""; $submitact = isset($all['submitact']) ? $all['submitact'] : ""; $submitact_x = isset($all['submitact_x']) ? $all['submitact_x'] : "" ; $submitact_y = isset($all['submitact_y']) ? $all['submitact_y'] : "" ; $previous_orders_products = isset($all['previous_orders_products']) ? $all['previous_orders_products'] : "" ; $productandqty = isset($_REQUEST['productandqty']) ? $_REQUEST['productandqty'] : ""; $formshipoptions = isset($_REQUEST['formshipoptions']) ? htmlentities($_REQUEST['formshipoptions'], ENT_QUOTES) : ""; $mypromocode_second = isset($_REQUEST['mypromocode_second']) ? trim($_REQUEST['mypromocode_second']) : trim($mypromocode_second); $mypromocode = isset($_REQUEST['mypromocode']) ? htmlentities($_REQUEST['mypromocode'], ENT_QUOTES) : ""; $mypromocode1 = isset($_REQUEST['mypromocode1']) ? htmlentities($_REQUEST['mypromocode1'], ENT_QUOTES) : ""; $mypromocode1_text = isset($_REQUEST['mypromocode1_text']) ? htmlentities($_REQUEST['mypromocode1_text'], ENT_QUOTES) : ""; $checkedproductoptionids = isset($_REQUEST['checkedproductoptionids']) ? $_REQUEST['checkedproductoptionids'] : ""; $formshipservice = isset($_REQUEST['formshipservice']) ? $_REQUEST['formshipservice'] : ""; $ordershipservice = isset($_REQUEST['ordershipservice']) ? $_REQUEST['ordershipservice'] : ""; if($mypromocode == '' && $mypromocode_second != '') $mypromocode = $mypromocode_second; // this must come first check to set the promo code at very first time if(stripos($mypromocode, $mypromocode_second) !== false) $mypromocode_second = ''; // avoid to enter same promo code more than once if(isset($_FILES['file_upload']['name']) && $_FILES['file_upload']['name']!=""){ if(!preg_match("/.*\.(exe|dl)$/i",$_FILES['file_upload']['name'],$matches)){ $uploadfile_name = "{$cart}_" .$_FILES['file_upload']['name']; move_uploaded_file($_FILES['file_upload']['tmp_name'], BOOK_DIR.$uploadfile_name); } else{ $uploadfile_error = "Invalide file type."; } } if(isset($_POST['r_file'])){ removeUploadFile($cart, $_POST['r_file'],$_POST['r_file_productoptioncombo'],$_POST['r_file_customtext']); } if(!isset($HTTP_REFERER)) $HTTP_REFERER = ""; if(!isset($myreferer)) $myreferer = ""; if(!isset($prodoptscode)) $prodoptscode = ""; if(!isset($gr_id)) $gr_id = ""; //$urlstamp = (isset($_REQUEST['urlstamp'])) ? $_REQUEST['urlstamp'] : ""; $urlstamp = time(); $shop = GetNumericValue($shop); $cart = GetNumericValue($cart); $cat = GetNumericValue($cat); $submitact = GetFilterizedHMTLEntities($submitact,true); $customizableFields=array(); $resQuery = mysql_query_("SELECT label_id,label_text FROM tbl_customizable_labels WHERE area_id='3' OR area_id='2' OR area_id='6'"); if($resQuery && mysql_num_rows_($resQuery)){ while ( $row = mysql_fetch_array_($resQuery)) { $customizableFields[$row["label_id"]]=stripslashes( $row["label_text"]); } mysql_free_result_($resQuery); } $_SESSION['customer_cart_insert'] = isset($_GET['cci']) ? $_GET['cci'] : $_SESSION['customer_cart_insert']; list($cust_email) = mysql_fetch_row_(mysql_query_("SELECT email FROM customer WHERE id='$shopuserid' AND is_deleted='N'")); if($cust_email != 'guest' && !isset($_SESSION['customer_cart_insert']) && $cust_email != ''){ $rs_customer_cart = mysql_query_("Select productoptioncombo, productoptionid, quantity, price, ItemCustomText, gift_registry_id From customer_cart Where email like '%$cust_email%'"); if ($rs_customer_cart && mysql_num_rows_($rs_customer_cart)) { while(list($cust_cart_productoptioncombo, $cust_cart_productoptionid, $cust_cart_quantity, $cust_cart_price, $cust_cart_ItemCustomText, $cust_cart_gift_registry_id) = mysql_fetch_row_($rs_customer_cart)){ if(empty($cart)) continue; $qry_cartproductoption = mysql_query_("Select quantity From cartproductoption Where productoptioncombo = '$cust_cart_productoptioncombo' AND cartid=$cart;"); if(!empty($cart) && mysql_num_rows_($qry_cartproductoption) > 0 ){ $qry_ins_cartproductoption = "Update cartproductoption Set quantity=quantity+$cust_cart_quantity Where productoptioncombo = '$cust_cart_productoptioncombo' AND cartid=$cart;"; } else{ $qry_ins_cartproductoption = "Insert Into cartproductoption (cartid, productoptioncombo, productoptionid, quantity, price, ItemCustomText, gift_registry_id,uploadfile_name) Values ($cart, '$cust_cart_productoptioncombo', $cust_cart_productoptionid, $cust_cart_quantity, $cust_cart_price, '$cust_cart_ItemCustomText', $cust_cart_gift_registry_id, '');"; } mysql_query_($qry_ins_cartproductoption); $_SESSION['customer_cart_insert'] = 1; } } } /************ End of added multicat code ****************************************/ $shop = setshop($shop); $shop = ($shop) ? $shop : 1; if (($all['submitact'] != "$customizableFields[54]") && ($all['submitact'] != "$customizableFields[53]")){} if($HTTP_REFERER != "") { $_SESSION["myreferer"] = $HTTP_REFERER; } $quantity = intval($quantity); if ($quantity < 1) $quantity = 1; if(!isset($passedfrom)) $passedfrom = ""; #If they've not got a valid existing cart, create #them one and redirect to this page again need to check this piece of code $searchbotArray = (DetectBrowserInfo()); $searchbot = $searchbotArray[0]; if($searchbot != "friendlyurl"){ // don not need to crete/validate cart for search bots } else{ if ($passedfrom == 'displaycat'){ $cart = createcart($shop, $shopuserid); exit(); } if(isset($_SESSION["cart"])){ $cart = $_SESSION["cart"]; } else { $cart = ""; } if($_GET['shopuserid']) { $_SESSION['shopuserid'] = $_GET['shopuserid']; } if(isset($_SESSION['shopuserid'])){ // $cart = $GLOBALS['HTTP_REFERER']; $thisuserid = $_SESSION['shopuserid']; $getid = mysql_query_("SELECT cart.id FROM cart INNER JOIN customer ON customer.id=cart.customerid WHERE cart.customerid='{$thisuserid}'"); if($getid && mysql_num_rows_($getid)){ list ($cart) = mysql_fetch_row_($getid); } else { $cart = ""; } } if ($cart == 0) { $cart = createcart($shop, $shopuserid); $prodopt1 = intval($prodopt1); $prodopt1 = ($prodopt1 != 0) ? "&prodopt1=".$prodopt1 : ""; $quantity = ($quantity != 0) ? "&quantity=".$quantity : ""; /************* Code added by hyper horse (Scotty) for faster multicat 04/15/05 *************/ if ($_GET){ if ($submitact != "") $submitact = "&submitact=" . urlencode($submitact); else $submitact = ""; header("Location:cart.php?".sid."&" .$QUERY_STRING."&shop=".$shop."&cat=".$cat."&cart=".$cart); exit; } } /* if (!validcart($cart,$shop,$shopuserid)) { error(5); exit; }*/ } $_SESSION['serverstamp'] = $serverstamp; if(!isset($all['multisubmit'])) $all['multisubmit'] = ""; //only used for multiproductsubmit from outside the cart if($all['multisubmit'] == "Y"){ $urlstamp = $all['urlstamp']; } if ($serverstamp == "" && $urlstamp != "") { $serverstamp = $urlstamp; } elseif ($urlstamp != "" && $serverstamp == $urlstamp) { $serverstamp = $urlstamp; $submitact = ""; } elseif ($urlstamp != "" && $serverstamp != $urlstamp) { $serverstamp = $urlstamp; } $index_string = "./"; $index_string1 = ""; switch ($_REQUEST['submitact']) { # if they pressed a button on this cart page, do the relevant action... # an array of arrays called $actionresult[] is filled in as stuff is done # each element contains ... # a productoption id # AND # a result code # 0 = added OK # 1 = qty updated OK # 2 = removed OK # 3 = qty updated on adding # 4 = qty=0, removed OK # 5 = invalid quantity (when updating) # 6 = invalid quantity (when adding) # 7 = quantity exceeds stock limit (but thats OK) # 8 = quantity exceeds stock limit (couldnt set) case $customizableFields[53]: if ($checkedproductoptionids) { // while (list ($key, $value) = each ($checkedproductoptionids)) { foreach ($checkedproductoptionids as $key => $value) { list($productoptioncode, $CustText) = explode("::", $value); deletecartproductoption($cart,$productoptioncode,$CustText); $actionresult[] = array($productoptioncode,2); } } else{ $errorNoItemSelected = $customizableFields[256]; } break; case $customizableFields[54]: if ($productandqty) { for($i = 0; $i < sizeof($productandqty); $i++) { $k = ""; list($k,$v) = explode("::",$productandqty[$i]); $arr[] = $k; } for ($i = 0; $i < sizeof($arr); $i+= 2) { if (empty($qty[$arr[$i]])){ if(!is_null($qty["" .$arr[$i]. ""])) $qty["" .$arr[$i]. ""] += $arr[$i+1]; } else { $qty["" .$arr[$i]. ""] += $arr[$i+1]; } } $stockcontrolmode = getstockcontrolmode($shop); $odd = true; $j=0; //while (list ($key, $element) = each ($productandqty)) { foreach ($productandqty as $key => $element) { if ($odd) { list($productoptioncode,$ItemCustomText) = explode("::",$element); $odd = false; } else { $newquantity = $element; $ProductOPtionCodes = explode("-",$productoptioncode); for ($Index=0; $Index < sizeof($ProductOPtionCodes); $Index++) { $POC = AutoSelectProdOption($ProductOPtionCodes[$Index],$newquantity); $ProductOPtionCodes[$Index] = $POC; } $productoptioncode_old = $productoptioncode; $productoptioncode = implode("-",$ProductOPtionCodes); if (strcmp($productoptioncode_old,$productoptioncode) != 0) { $SQL = "UPDATE cartproductoption SET productoptioncombo ='".mysql_real_escape_string_($productoptioncode)."' WHERE cartid='{$cart}' AND productoptioncombo ='{$productoptioncode_old}'"; @mysql_query_($SQL); } $currrent_in_order = ""; $current_in_order = $qty["".$productoptioncode.""]; if (validquantityforupdate($newquantity)) { switch (updateqtycartproductoption($cart,$productoptioncode,$newquantity,$stockcontrolmode,$ItemCustomText,$current_in_order,$_REQUEST["productandnewprice"][$j])) { case 0: # no change required break; case 1: # quantity updated ok $actionresult[] = array($productoptioncode,1); break; case 2: # deleted $actionresult[] = array($productoptioncode,4); break; case 3: # quantity updated but not enough stock warning $actionresult[] = array($productoptioncode,7); break; case 4: # quantity NOT updated - not enough stock $actionresult[] = array($productoptioncode,8); break; } } else { $actionresult[] = array($productoptioncode,5); } $odd = true; $j++; } } } break; case BTN_PREVIOUS_ORDER: # If adding product to cart (from index.php) for($i=0; $i < count($previous_orders_products); ) { $previous_order_hash["".$previous_orders_products[$i].""] = $previous_orders_products[$i+1]; $i = $i+2; } //while(list($key,$value) = each ($previous_order_hash)) { foreach($previous_order_hash as $key => $value) { $prodoptscode = $key; $quantity = $value; $prodoptscode = preg_replace("/\-$/","",$prodoptscode); // get rid of last '-'. if (!validquantity($quantity)) { $actionresult[] = array($prodopt1,6); } else { $stockcontrolmode = getstockcontrolmode($shop); $qry = "SELECT quantity FROM cartproductoption WHERE cartid='{$cart}' AND productoptioncombo='{$prodoptscode}'"; $qry_getcurrprodopt = mysql_query_($qry); if ($qry_getcurrprodopt && mysql_num_rows_($qry_getcurrprodopt)) { # if product option already in order, add to quantity list($currqty) = mysql_fetch_row_($qry_getcurrprodopt); $quantity = $currqty + $quantity; switch (updateqtycartproductoption($cart,$prodoptscode,$quantity,$stockcontrolmode,$CustText,$current_ordered_sum)) { case 0: # no change required break; case 1: # quantity updated ok $actionresult[] = array($prodoptscode,3); break; case 2: # deleted $actionresult[] = array($prodoptscode,4); break; case 3: # quantity updated but not enough stock warning $actionresult[] = array($prodoptscode,7); break; case 4: # quantity NOT updated - not enough stock $actionresult[] = array($prodoptscode,8); break; } unset($qry); mysql_free_result_($qry_getcurrprodopt); } else { # product option not already in order- add to order $delete_product_rs = mysql_query_("SELECT product.name as name FROM product, productoption, orderproductoption, cart WHERE cart.id='{$cart}' AND productoptioncombo='{$prodoptscode}' AND orderproductoption.productoptionid=productoption.id AND productoption.productid=product.id AND product.is_deleted='N'"); if(mysql_num_rows_($delete_product_rs) > 0){ switch (addcartproductoption($cart,$prodoptscode,$quantity,$stockcontrolmode,$CustText)) { case 0: # if added ok $actionresult[] = array($prodoptscode,0); break; case 1: # added ok but not enough stock warning $actionresult[] = array($prodoptscode,7); break; case 2: # not added - not enough stock $actionresult[] = array($prodoptscode,8); break; } } else{ $delete_product_rs = "SELECT product.name FROM product, productoption, orderproductoption, cart WHERE cart.id='{$cart}' AND productoptioncombo='{$prodoptscode}' AND orderproductoption.productoptionid=productoption.id AND productoption.productid=product.id;"; $arr_del_prod .= "The item you have attempted to order could not be added to your cart. This item, '".mysql_result_(mysql_query_($delete_product_rs),0)." ', no longer exists in our database.
"; } } } } break; case BTN_ADDTOCART: if($urlstamp == $_SESSION['session_urlstamp'] && $urlstamp!="" && $item_option_button_chk != 1){ // item not added into cart. } else{ $_SESSION['session_urlstamp'] = $urlstamp; if(!isset($ModifiedCustText)) $ModifiedCustText = ""; #If adding product to cart (from index.php) #$CustText = trim ($CustText); #Create product option combination code for ($level=1; $level<=50; $level++) { $varname = $all['prodopt'.$level]; if (isset($varname)) { if (!validproductoption($varname,$shop,$level)) { error(7); exit; } else if (!requiredproductoption($varname,$shop,$level)) { //echo "Level on VARIALBE the tpo : ".$$varname."
"; $restorelevel[] = $level; $actionresult[] = array($prodopt1,9); } //GET PRODUCTOPTIOINCODE AGAINST WHICH DISCOUNT (BASED ON QUANTITY) IS OFFERED $POC = AutoSelectProdOption($varname,$quantity); $prodoptscode .= $POC . "-"; } } $prodoptscode = preg_replace("/\-$/","",$prodoptscode); // get rid of last '-'. if(is_array($actionresult) && in_array(9,$actionresult[0])){ //checks to see if the error code 9 is existing if so do not update } else if (!validquantity($quantity)) { $actionresult[] = array($prodopt1,6); } else { //separate out the custom texts entered and form a string same as the way it is stored to database. //textid^actual text entered##next textid ^ value etc. if(isset($CustText) && is_array($CustText)) { foreach ($CustText as $textid => $textval) { if($textid != "" && $textval != "") ($ModifiedCustText == "") ? ($ModifiedCustText = "$textid^$textval") : ($ModifiedCustText .= "##$textid^$textval"); } } elseif (isset($CustText) && !is_array($CustText)) { $textid = fnInsertCustomText($CustText,$prodopt1); $ModifiedCustText = $textid ."^". $CustText; } else { $ModifiedCustText = ""; } $CustText = $ModifiedCustText; $stockcontrolmode = getstockcontrolmode($shop); $dropdown_inventory_control = mysql_result_(mysql_query_("SELECT dropdown_inventory_control FROM product WHERE is_deleted='N' AND id=".validateInput($_POST['hiddenProdIdAllotted2Elements'], 'int')),0); if($dropdown_inventory_control == 'Y'){ $item_option_val = substr($prodoptscode, (strpos($prodoptscode,"-")+1)); $qry1 = "Select count from productdropdowncount Where dropdown='$item_option_val'"; $item_options_count = mysql_result_(mysql_query_($qry1),0); } $qry = "SELECT quantity FROM cartproductoption WHERE cartid ='{$cart}' AND productoptioncombo='{$prodoptscode}' AND ItemCustomText ='{$ModifiedCustText}' AND uploadfile_name='$uploadfile_name'"; $qry_getcurrprodopt = mysql_query_($qry); if ($qry_getcurrprodopt && mysql_num_rows_($qry_getcurrprodopt) && $_POST['item_with_price']!="Y") { //update quantity $cart_quantity = mysql_result_($qry_getcurrprodopt, 0); $quantity += $cart_quantity; # if product option already in order, add to quantity if($item_options_count >= $quantity){ $stockcontrolmode = 0; } $cartupdated=1; switch (updateqtycartproductoption($cart,$prodoptscode,$quantity,$stockcontrolmode,$CustText,$gr_id)) { case 0: # no change required break; case 1: # quantity updated ok $actionresult[] = array($prodoptscode,3); break; case 2: # deleted $actionresult[] = array($prodoptscode,4); break; case 3: # quantity updated but not enough stock warning $actionresult[] = array($prodoptscode,7); break; case 4: # quantity NOT updated - not enough stock $actionresult[] = array($prodoptscode,8); break; } mysql_free_result_($qry_getcurrprodopt); } else { // if stockcontrol mode restricted and $item_options_count < quantity if($item_options_count < $quantity && $stockcontrolmode == 3 && $dropdown_inventory_control == 'Y'){ # quantity updated but not enough stock warning $actionresult[] = array($prodoptscode,8); } else { if($item_options_count >= $quantity){ $stockcontrolmode = 0; } //echo $stockcontrolmode; die; # product option not already in order- add to order switch (addcartproductoption($cart,$prodoptscode,$quantity,$stockcontrolmode,$CustText,$gr_id)) { case 0: # if added ok $actionresult[] = array($prodoptscode,0); break; case 1: # added ok but not enough stock warning $actionresult[] = array($prodoptscode,7); break; case 2: # not added - not enough stock $actionresult[] = array($prodoptscode,8); break; } } } if (!empty($actionresult)) { $_SESSION['actionresult'] = $actionresult; } } } if(!empty($actionresult[0])) if($urlstamp != '' && !in_array(9,$actionresult[0])) { header("Location: " . $url_start . 'cart.php'); die; } break; #-------------------------start the case for adding the multiple items to the cart ------ case BTN_ADDMULTIPLETOCART: $sizeofproducts = sizeof($all['prodopt1']); for($k = 0; $k < $sizeofproducts; $k++) { $mystorearray = array(); # If adding product to cart (from index.php) $CustText = ""; $prodoptscode = ""; //$CustText = trim ($all['CustText'][$k]); $CustText = $all['CustText']; // Create product option combination code for ($level=1; $level<= 50; $level++) { $varname = ""; $varname = "prodopt".$level; if ($all[$varname][$k] != "") { if (!validproductoption($all[$varname][$k],$shop,$level)) { error(7); exit; } elseif (!requiredproductoption($all[$varname][$k],$shop,$level)) { //echo "Level on VARIALBE the tpo : ".$$varname."
"; $restorelevel[] = $level; $actionresult[] = array($prodopt1,9); } $mystorearray[] = $all[$varname][$k]; } } if($all['multisubmit'] == "Y" && ($k+1) == $sizeofproducts && !empty($actionresult) && $sizeofproducts != sizeof($actionresult)){ unset($restorelevel); unset($actionresult); } $prodoptscode = implode("-",$mystorearray); $quantity = intval($all['quantity'][$k]); if ($quantity < 1 ) { $quantity = 1; continue; } if(is_array($actionresult) && in_array(9,$actionresult[0])){ //checks to see if the error code 9 is existing if so do not update } elseif (!validquantity($quantity)) { $actionresult[] = array($prodopt1,6); } else { if($CustText != "" && is_array($CustText)) { foreach ($CustText as $textid => $textval) { if($textid != "" && $textval != "") { $qry = "SELECT count(*) AS count FROM customtexts ct, product p, productoption po WHERE p.id = ct.productid AND p.id = po.productid AND po.id IN (" . implode(",",$mystorearray) . ") AND ct.id = '{$textid}' "; $rs = mysql_query_($qry); if($rs && mysql_num_rows_($rs)) { $row = mysql_fetch_array_($rs); $totalRec = $row['count']; if($totalRec > 0){ ($ModifiedCustText == "") ? ($ModifiedCustText .= "$textid^$textval") : ($ModifiedCustText .= "##$textid^$textval"); } mysql_free_result_($rs); } } } } $CustText = $ModifiedCustText; $stockcontrolmode = getstockcontrolmode($shop); //$qry = "SELECT quantity FROM cartproductoption WHERE cartid=$cart AND productoptioncombo='$prodoptscode' AND ItemCustomText='$CustText'"; $qry = "SELECT quantity FROM cartproductoption WHERE cartid='{$cart}' AND productoptioncombo='{$prodoptscode}' AND ItemCustomText='{$ModifiedCustText}'"; $qry_getcurrprodopt = mysql_query_($qry); if ($qry_getcurrprodopt && mysql_num_rows_($qry_getcurrprodopt) && $_POST['item_with_price']!="Y") { # if product option already in order, add to quantity list($currqty) = mysql_fetch_row_($qry_getcurrprodopt); $quantity = $currqty + $quantity; switch (updateqtycartproductoption($cart,$prodoptscode,$quantity,$stockcontrolmode,$CustText)) { case 0: # no change required break; case 1: # quantity updated ok $actionresult[] = array($prodoptscode,3); break; case 2: # deleted $actionresult[] = array($prodoptscode,4); break; case 3: # quantity updated but not enough stock warning $actionresult[] = array($prodoptscode,7); break; case 4: # quantity NOT updated - not enough stock $actionresult[] = array($prodoptscode,8); break; } mysql_free_result_($qry_getcurrprodopt); } else { # product option not already in order- add to order switch (addcartproductoption($cart,$prodoptscode,$quantity,$stockcontrolmode,$CustText)) { case 0: # if added ok $actionresult[] = array($prodoptscode,0); break; case 1: # added ok but not enough stock warning $actionresult[] = array($prodoptscode,7); break; case 2: # not added - not enough stock $actionresult[] = array($prodoptscode,8); break; } } } $CustText = ""; $ModifiedCustText = ""; } break; //-------------------------end code for adding the multiple items to the cart ------// case "": # fall through case NULL: break; default: exit("You submitted from an unknown button!"); // - $submitact!"; break; } # end switch if(isset($item_option_button_chk ) && $item_option_button_chk == 1) exit; // for cart popup if(!isset($removecusttext)) $removecusttext = ""; if(!isset($actionresult)) $actionresult = ""; #Remove the Custom Text for Specified Item if ($removecusttext != '') { @mysql_query_("UPDATE cartproductoption SET ItemCustomText='' WHERE cartid='{$cart}' AND productoptionid='{$removecusttext}'"); } #now display the cart echo showhead($shop,$cat,$cart,"- Your Shopping Cart","","", "80%"); /*if(!mobile_detector() && !isset($_SESSION['screen_width'])){ $_SESSION['screen_width'] = 1600; }*/ $getcarthtml = mysql_query_("SELECT name, custom_html_cartpage, checkouttype, shipservice, display_shipping_calculator, shipping_calculator_text, ccauthusername, ccauthpartner, paypalthirdoption, google_third_payment_option, google_third_payment_option_id, google_third_payment_option_key, item_suggestion_with_thumbnail, default_thumbnail_width_cartpage, stockcontrolmode, category_separator, category_columns, globalcats, displaycatlinks, globalcats_atcart, displaycatlinks_atcart, dividercellcolor, html_before_category_links, category_width, header, paypalpro_type, allowunknownlocations, auto_recurring_billing, cart_page, backorder_message, display_update_cart_button, enable_paypal_pages, promocode_cart_page,zip,item_link_cart_page, kiosk_ip, warehouse_location_cart_page, display_weight, min_checkout_amt, alternative_shipping_text, alternative_shipping_cart_page, default_state, default_country, mobile_resolution, mobile_version_enable, NewWindow, above_chekcout_button, item_thumb_cart_page, item_thumb_cart_page_width, haz_charge, haz_domestic, haz_international, haz_text, haz_cart_page, country, custom_html_cartpage_beneath, promocode_case_sensitive, multi_promo_code, req_validate_alternative_ship, altshipdisplay, cat_display FROM shop"); if($getcarthtml && mysql_num_rows_($getcarthtml)){ list($shop_name, $custom_html_cartpage, $checkouttype, $shipservice, $display_shipping_calculator, $shipping_calculator_text, $ccauthusername, $ccauthpartner, $paypalthirdoption, $google_third_payment_option, $google_third_payment_option_id, $google_third_payment_option_key, $item_suggestion_with_thumbnail, $default_thumbnail_width_cartpage, $stockcontrolmode, $category_separator, $category_columns, $globalcats, $displaycatlinks, $globalcats_atcart, $displaycatlinks_atcart, $dividercellcolor, $html_before_category_links, $category_width, $header, $paypalpro_type, $allowunknownlocations, $auto_recurring_billing, $cart_page, $backorder_message, $display_update_cart_button, $enable_paypal_pages, $promocode_cart_page,$shop_zip,$item_link_cart_page, $kiosk_ip, $warehouse_location_cart_page, $ShowWeight, $min_checkout_amt, $alternative_shipping_text, $alternative_shipping_cart_page, $default_state, $default_country, $mobile_resolution, $mobile_version_enable, $NewWindow, $above_chekcout_button, $item_thumb_cart_page, $item_thumb_cart_page_width, $haz_charge_shop, $haz_domestic_shop, $haz_international_shop, $haz_text_shop, $haz_cart_page, $country, $custom_html_cartpage_beneath, $promocode_case_sensitive, $multi_promo_code, $req_validate_alternative_ship, $altshipdisplay, $cat_display ) = mysql_fetch_row_($getcarthtml); mysql_free_result_($getcarthtml); } // disallow multiple promo codes to an order. if($mypromocode != '' && $multi_promo_code == 'N') { $mypromocode_second_new = $mypromocode_second; $mypromocode_second = ''; } $mobile_view = 0; ############## For mobile Settings ############## #if(trim($_SESSION['screen_width']) <= $mobile_resolution && $mobile_version_enable != 'N'){ if(userAgent($_SERVER['HTTP_USER_AGENT']) != 'desktop' && $mobile_version_enable != 'N'){ $category_separator = 'dropdownOnly'; $ShowWeight = 'N'; $mobile_view = 1; $customizableFields[50] = 'Qty'; } // css should include for mobile view if(userAgent($_SERVER['HTTP_USER_AGENT']) != 'desktop') { echo ""; $mobile_style_item_qty = "style='min-width:2.5em'"; $mobile_style_item_name_col = "style='width:50%'"; $mobile_td = "style='padding:2px !important;'"; } else { $mobile_style_item_qty = "style='width:50px'"; $promocodecss = "style='width:200px'"; echo ""; } ################################################# #START HTML before category links option $pos_category_id = strpos($html_before_category_links, "##category number##"); $pos_category_name = strpos($html_before_category_links, "##category name##"); if($pos_category_id === false || $pos_category_name === false){ $html_before_category_links = "##category name##"; } else { $html_before_category_links = stripslashes(str_replace("cat=##", "cart=".$cart."&cat=##",$html_before_category_links)); } #END HTML before category links option #I ASSUME CATEGORY DATA SHOULD FROM HERE if(is_array($actionresult) && in_array(9,$actionresult[0])) { echo "\n"; //while (list ($key , $value) = each ($actionresult)) { foreach($actionresult as $key => $value) { echo ""; } echo "\n"; } echo "
"; switch ($value[1]) { case 9: $ProId = explode ('-',$prodoptscode); $Sql_Qry = "SELECT productid FROM productoption WHERE id ='" .$ProId[$i+1]. "'"; $qry_res = mysql_query_($Sql_Qry); if($qry_res && mysql_num_rows_($qry_res)){ list($idd) = mysql_fetch_row_($qry_res); $qry_getitle = mysql_query_("SELECT name FROM productoptionlevel WHERE 1 AND productid ='{$idd}' AND level= '{$restorelevel[$i]}'"); if($qry_getitle && mysql_num_rows_($qry_getitle)){ list($getname) = mysql_fetch_row_($qry_getitle); mysql_free_result_($qry_getitle); } mysql_free_result_($qry_res); } else { $getname = ""; } if ($HTTP_REFERER <> "" ){ $linkback = $HTTP_REFERER; } elseif($_SESSION['myreferer'] <> "") { $linkback = $_SESSION['myreferer']; } else{ $linkback = $_SERVER['HTTP_REFERER']; } echo "Product not added to the cart as the required product option ( ", GetFilterizedHMTLEntities($getname), " ) is not selected. back
"; $i++; break; echo "
\n"; } if(isset($custom_html_cartpage) && trim($custom_html_cartpage) != ""){ echo "
", stripslashes($custom_html_cartpage), "
"; } ?> Please review items carefully. Items previously in your account are also added."; unset($_SESSION['cart_previous_items']); } ?> "; for ($a=1; $a < count($CatSet); $a++){ $html_before_category_links_text = str_replace("##category number##", $CatSet[$a], $html_before_category_links); $html_before_category_links_text = str_replace("##category name##", showCategoryName($CatSet[$a]), $html_before_category_links_text); $html_before_category_links_text = str_replace("##cart##", $cart, $html_before_category_links_text); echo ""; } echo "
", $html_before_category_links_text, " » ", showCategoryName($cat), "

"; } else { if(isset($cat) && trim(showCategoryName($cat)) != '') { echo "
", showCategoryName($cat), "

"; } } } ?> 0){ $sel = explode(":",$_GET['ddCats']); $sel = $sel[1]; }else{ $sel = $cat; } echo "", "", "", "", "", "", "", "", "
 ", "", ""; if(($globalcats_atcart && $displaycatlinks_atcart) || (!$globalcats_atcart && $displaycatlinks_atcart)){ $GetCategories = mysql_query_($SQL); if($GetCategories AND mysql_num_rows_($GetCategories)>0) { echo ""; } } elseif($globalcats_atcart && $displaycatlinks_atcart != true) { $selcat = "SELECT * FROM category WHERE parentcatid <=1 AND is_deleted='N' ORDER BY sequence"; $SubCategories = mysql_query_($selcat); if($SubCategories && mysql_num_rows_($SubCategories)>0) { echo ""; } } echo "
"; } if($category_separator=='dropdownOnly'){ ?> 0){ $sel = explode(":",$_GET['ddCats']); $sel = $sel[1]; }else{ $sel = $cat; } echo "", "", "", "", "", "", "", "", "
 ", "", "";; if(($globalcats_atcart && $displaycatlinks_atcart) || (!$globalcats_atcart && $displaycatlinks_atcart)){ $GetCategories = mysql_query_($SQL); if($GetCategories AND mysql_num_rows_($GetCategories)>0) { echo ""; } } elseif($globalcats_atcart && $displaycatlinks_atcart != true) { $selcat = "SELECT * FROM category WHERE parentcatid <=1 AND is_deleted='N' ORDER BY sequence"; $SubCategories = mysql_query_($selcat); if($SubCategories && mysql_num_rows_($SubCategories)>0) { echo ""; } } echo "
"; } ?>
1 && $cntArbProduct >= 1){ $arb_product_not_allowed = 'Y'; } } if($checkouttype == 42 || $checkouttype == 21){ # Feature #12581 $arb_product_not_allowed = 'N'; } $show_checkout_button = 1; if(($checkouttype == 20 && $paypalpro_type == 'D')){ $show_checkout_button = 1; } elseif(($checkouttype == 20 && $paypalpro_type == 'E')){ $show_checkout_button = 0; } ##### Checkout Button above the item table START ##### if (mysql_num_rows_($qry_getproducts) > 0 && $above_chekcout_button) { if ($show_checkout_button && ( $checkouttype != 26 || $paypalthirdoption != 'N' ) && ($checkouttype != 7 || $enable_paypal_pages != "C") && ($paypalthirdoption != 'Y' || $enable_paypal_pages != "C")) { if(!$tshophost) { $Crypto = new Crypto(); $tshophost = rawurlencode($Crypto->encrypt($passphrase,$_SERVER["SERVER_NAME"])); } echo "
"; if($arb_product_not_allowed == 'Y'){ echo "
"; } else{ echo ($NewWindow == 1) ? "" : ""; } ?>
"; } } ##### Checkout Button above the item table END ##### ?> \n"; echo ""; ?> "); } ?>  "; $tbl_td_width = "width='100'"; } if($item_thumb_cart_page){ if(!$mobile_view) { $ColSpan_Add = 1; echo ""; } } else{ $ColSpan_Add = 0; } if($ShowWeight != 'N') { $ColSpan = 4 + $ColSpan_Add; echo ""; } else { $ColSpan = 3 + $ColSpan_Add; echo ""; } // in mobile view no need to add checkbox for delete items so col-1 // item would be delete after set qty = 0 and update $ColSpan = (!$mobile_view) ? $ColSpan : $ColSpan - 1; ?> $uploadfile_error"; } ####################################### FREE ITEM ###################################### if($data[0]['promocode_case_sensitive'] == 'N'){ $promocode_check = "BINARY LOWER(TRIM(p.codestring)) = '". mysql_real_escape_string_(strtolower(trim($mypromocode))) ."'"; } else{ $promocode_check = "BINARY TRIM(p.codestring) = '". mysql_real_escape_string_(trim($mypromocode)) ."'"; } $sql_promocode = "SELECT p.codetype, p.code_validity, pc.category_id as catid, TO_DAYS(promocode_enddate)-TO_DAYS(NOW()) AS ExpiryDay, promocode_productids, TO_DAYS(NOW())-TO_DAYS(promocode_startdate) AS EffectiveDay, freeitem_catid_itemid, product_limit_freeitem, amount_freeitem, only_applied_specified_items, promocode_minAmount FROM promocodes p LEFT JOIN promocodes_category pc ON p.id=pc.promocodes_id WHERE $promocode_check" . " AND p.code_validity <>-1 "; $result = mysql_query_($sql_promocode); if ($result) { $arrCatid = array(); while ($row = mysql_fetch_array_($result)) { $promo_validity = $row["code_validity"]; $ExpiryDay = $row["ExpiryDay"]; $promocodetype_new = $row["codetype"]; $promocode_productids = $row["promocode_productids"]; $freeitem_category_rs = explode("|", $row['freeitem_catid_itemid']); $freeitem_catid_itemid = $freeitem_category_rs[1]; $product_limit_freeitem = $row["product_limit_freeitem"]; $amount_freeitem = $row["amount_freeitem"]; $only_applied_specified_items = $row["only_applied_specified_items"]; $promocode_minAmount = $row["promocode_minAmount"]; $cat_exist = mysql_result_(mysql_query_("SELECT is_deleted FROM category WHERE is_deleted='N' AND id=" . $row["catid"]), 0); if ($cat_exist == 'N') { $arrCatid[] = $row["catid"]; } } $subtotal_promocode_items = mysql_result_(mysql_query_("SELECT SUM(price*quantity) FROM cartproductoption WHERE cartid = $cart;"), 0); if ($promocodetype_new == 6 && $ExpiryDay >= 0 && ($subtotal_promocode_items/100) >= $promocode_minAmount) { $stockcontrolmode = getstockcontrolmode($shop = 1); $quantity = 1; if ($arrCatid) { $catid = implode(",", $arrCatid); } if ($catid != "" && $promocode_productids != "") { $promocode_productids_qry = "SELECT (cartproductoption.quantity) FROM productoption, cartproductoption, product_category WHERE cartproductoption.cartid = $cart AND product_category.category_pc_id IN($catid) AND productoption.productid IN($promocode_productids) AND productoption.productid = product_category.product_pc_id AND productoption.id = cartproductoption.productoptionid group by productoption.productid "; } elseif ($catid != "") { $promocode_productids_qry = "SELECT SUM(cartproductoption.quantity) FROM productoption, cartproductoption, product_category WHERE cartproductoption.cartid = $cart AND product_category.category_pc_id IN($catid) AND productoption.productid = product_category.product_pc_id AND productoption.id = cartproductoption.productoptionid"; } elseif ($promocode_productids != "") { $promocode_productids_qry = "SELECT SUM(cartproductoption.quantity) FROM productoption, cartproductoption WHERE cartproductoption.cartid = $cart AND productoption.productid IN($promocode_productids) AND productoption.id = cartproductoption.productoptionid"; } $pid_quantity = mysql_result_(mysql_query_($promocode_productids_qry), 0); $free_item_add = 0; if ($pid_quantity >= $product_limit_freeitem) { $free_item_add = 1; if ($amount_freeitem == 2) { $quantity = floor($pid_quantity / $product_limit_freeitem); } } $prodoptscode = mysql_result_(mysql_query_("select id from productoption where productid=$freeitem_catid_itemid AND $free_item_add"), 0); if (!isset($_SESSION['promo_free_item'])) $_SESSION['promo_free_item'] = 0; deletecartproductoption($cart, $_SESSION['promo_free_item']); $_SESSION['promo_free_item'] = 0; if ($_SESSION['promo_free_item'] == 0) { addcartproductoption($cart, $prodoptscode, $quantity, $stockcontrolmode); $_SESSION['promo_free_item'] = $prodoptscode; } } else { if ($_SESSION['promo_free_item'] != 0) { deletecartproductoption($cart, $_SESSION['promo_free_item']); $_SESSION['promo_free_item'] = 0; } } } // end result ####################################### FREE ITEM ###################################### ///////////////////////////////////////////////////// if(isset($arr_del_prod)){ echo $msg_arb = "$arr_del_prod"; } if($_REQUEST['arb_product_check'] == 'Y'){ echo $msg_arb = "Your cart contains a subscription item. In order to check out correctly, you must remove the other items from your cart before proceeding."; } $hasitem = false; $totalsofar = 0; if( $checkouttype == 26 || strtoupper($google_third_payment_option) == 'Y' ){ if($checkouttype == 26) { $merchant_id = $ccauthusername; //"501423699386935"; $merchant_key = $ccauthpartner; //"Y1MksXEgv7YTwRg8tGZEeg"; } else { $merchant_id = $google_third_payment_option_id; $merchant_key = $google_third_payment_option_key; } $Items_for_Google = array(); $ItemIndex = 0; } $haz_domestic = $haz_international = $overweight_product = $total_overweight_product = 0; $domestic_shipping = 1; // Display each item $no_of_cart_items = mysql_num_rows_($qry_getproducts); if($qry_getproducts && $no_of_cart_items){ #$html_on_cart_page_array to store value if any of each product to display it further $html_on_cart_page_array = $List_of_Suggested_Items = array(); //FOR SUGGESTED ITEMS $SuggestedItemIndex = 0; //FOR SUGGESTED ITEMS ########################### Insert into customer_cart ####################### $qry_del_customer_cart = "Delete From customer_cart Where email = ''"; mysql_query_($qry_del_customer_cart); if($cust_email != 'guest' && $cust_email != ""){ $qry_del_customer_cart = "Delete From customer_cart Where email like '%$cust_email%'"; mysql_query_($qry_del_customer_cart); } ############################################################################# $product_id_array = array(); $only_downloadable_items = 0; while (list($isgiftcert,$isebook,$sku_pno, $prodoptid,$CustomText,$ItemCustomText,$prodname,$prodoptdesc,$prodweight,$pprice,$price,$quantity, $prodoptcode,$prodid,$taxable, $html_on_cart_page, $item_with_price, $item_location, $gift_registry_id, $uploadfile_name, $haz_fee) = mysql_fetch_row_($qry_getproducts)) { ########################### Insert into customer_cart ####################### if($cust_email != 'guest' && $cust_email != ""){ $qry_ins_customer_cart = "Insert Into customer_cart (email, productoptioncombo, productoptionid, quantity, price, ItemCustomText, gift_registry_id) Values ('$cust_email', '$prodoptcode', $prodoptid, $quantity, $price, '$ItemCustomText', $gift_registry_id)"; mysql_query_($qry_ins_customer_cart); } ############################################################################# if(!$isebook){ $product_id_array[] = $prodid; } // if cart only has downloadable item then shipping zip code will not display for paypal if($no_of_cart_items == 1 && $isebook){ $only_downloadable_items = 1; } $hasitem = true; if($html_on_cart_page) $html_on_cart_page_array[$prodoptid] = stripslashes($html_on_cart_page); // Level 1 has description - start brackets and description.... if($item_link_cart_page == 'Y'){ $url_start_item = str_replace("/shop/","",$url_start); $item_name = showItemName($prodid); $url_item = $url_start_item.URL_SHOP_ALIAS_ITEM."$item_name-$prodid "; $prodname = "$prodname"; } $prodname .= " ($prodoptdesc"; // build rest of description out of level 2+ product options $prodoptcodewithout1 = preg_replace("/^[0-9]+\-(.*)/","\\1",$prodoptcode); // get rid of first productoption code $prodoptcodes = explode("-",$prodoptcodewithout1); $prodoptweight = 0; $prodoptprice = 0; $opttypeflag = false; if( $checkouttype == 26 || strtoupper($google_third_payment_option) == 'Y' ){ $Items_for_Google[$ItemIndex]['ItemId'] = $prodid; $Items_for_Google[$ItemIndex]['ItemName'] = $prodname; $Items_for_Google[$ItemIndex]['ItemSKU'] = $sku_pno; } //SUGGESTED ITEMS STARTS HERE $SuggestedItemKeepInStore[] = $prodid; //echo "SELECT ItemIdsToSuggest FROM product WHERE id='{$prodid}'"; $RS_SuggestedItems = mysql_query_("SELECT ItemIdsToSuggest FROM product WHERE id='{$prodid}'"); if($RS_SuggestedItems && mysql_num_rows_($RS_SuggestedItems)){ $row = mysql_fetch_row_($RS_SuggestedItems); if(strlen(trim($row[0]))){ $List_of_Suggested_Items[$SuggestedItemIndex]['BaseItemId'] = $prodid ; $SuggestedItem_Id_Name = array(); $IdList = explode(",", $row[0]); for($i=0; $i0 ORDER BY image_sequence"); if($rsPImageURLs && mysql_num_rows_($rsPImageURLs)) { $firstImgURL = ''; #catch first imageurl while($topExistingImgRow = mysql_fetch_row_($rsPImageURLs)) { $firstImgURL = ($firstImgURL == '') ? $topExistingImgRow[0] : $firstImgURL; $thumb_imagename = str_replace(".".pathinfo($topExistingImgRow[0], PATHINFO_EXTENSION), "_th.".pathinfo($topExistingImgRow[0], PATHINFO_EXTENSION), basename($topExistingImgRow[0])); #find imageurl that has thumbnail (if exists) if(file_exists(IMGS_DIR.$thumb_imagename)){ $SuggestedItem_Id_Name[$i]['imageurl'] = $topExistingImgRow[0]; break; } } #set that imageurl that has its thumbnail, if not so then set first imageurl available in the db $SuggestedItem_Id_Name[$i]['imageurl'] = (isset($SuggestedItem_Id_Name[$i]['imageurl']) && strlen($SuggestedItem_Id_Name[$i]['imageurl'])) ? $SuggestedItem_Id_Name[$i]['imageurl'] : $firstImgURL; } } } } } $List_of_Suggested_Items[$SuggestedItemIndex]['SuggestedIds'] = $SuggestedItem_Id_Name; $SuggestedItemIndex++; } } //SUGGESTED ITEMS ENDS HERE $loop_sku = 0; //while (list($key,$prodopt) = each($prodoptcodes)) { foreach ($prodoptcodes as $key => $prodopt) { $qry_getprodoptdesc = mysql_query_("SELECT description, weight, price, type,level, stockqty, sku, dropdown_haz_mat FROM productoption WHERE id='{$prodopt}'"); if($qry_getprodoptdesc && mysql_num_rows_($qry_getprodoptdesc)){ list ($description, $optweight, $optprice, $opttype,$optlevel, $stockqty, $sku, $dropdown_haz_mat) = mysql_fetch_row_($qry_getprodoptdesc); mysql_free_result_($qry_getprodoptdesc); } if($dropdown_haz_mat != '0') $haz_fee = $dropdown_haz_mat; if(trim($sku) != "" && $loop_sku == 0){ $loop_sku = 1; $sku_pno = ""; } if(trim($sku) != ""){ $sku_pno .= "$sku "; } if ($description != '') { $prodname .= ", $description"; } if ($opttypeflag == false) { if ($opttype == 1) {// Option ADD $prodoptprice = $prodoptprice + $optprice; if($optlevel == 1){ //for options haveing level one only $prodoptweight = $optweight; } else { $prodweight += $optweight; } } elseif ($opttype == 2) { // Option SUBTRACT $prodoptprice = $prodoptprice - $optprice; $prodoptweight = $prodweight - $optweight; } elseif ($opttype == 3) {// Option OVERRIDE $prodoptweight = $optweight; if ($optprice != 0) { $prodoptprice = $optprice; $opttypeflag = true; } } elseif ($opttype == 4) {// Option MULTIPLY $prodoptprice = (($prodoptprice + $pprice) * $optprice)/100; $pprice = 0; $prodoptweight = $prodweight * $optweight; } } } $prodname = str_replace("(, ", "(", $prodname); $prodname .= ")"; $prodname = str_replace(" ()", "", $prodname); if( $checkouttype == 26 || strtoupper($google_third_payment_option) == 'Y' ){ $Items_for_Google[$ItemIndex]['ItemDesc'] = $prodname; $Items_for_Google[$ItemIndex]['ItemDesc'] = str_replace($Items_for_Google[$ItemIndex]['ItemName'],"",$Items_for_Google[$ItemIndex]['ItemDesc']); $Items_for_Google[$ItemIndex]['ItemQty'] = $quantity; } if ($price <> ($pprice + $prodoptprice) and $item_with_price=="N") { $price = ($opttypeflag == true) ? $prodoptprice : ($pprice + $prodoptprice); @mysql_query_("UPDATE cartproductoption SET price='{$price}' WHERE cartid='{$cart}' AND productoptioncombo='{$prodoptcode}'"); } if( $checkouttype == 26 || strtoupper($google_third_payment_option) == 'Y' ){ $Items_for_Google[$ItemIndex]['ItemPrice'] = doubleval($price/100); $Items_for_Google[$ItemIndex]['ItemTaxable'] = $taxable; ++$ItemIndex; } if ($prodoptweight == 0) $prodoptweight = $prodoptweight + $prodweight; echo "\n"; if(!$mobile_view) { echo "\n"; } if($item_thumb_cart_page){ $pid = $productdetails['id']; $product_images_rs = mysql_query_("SELECT image_id, image_url FROM product_images WHERE image_product_id='{$prodid}' ORDER BY image_sequence Limit 0, 1"); list($image_id, $imageurl) = mysql_fetch_row_($product_images_rs); if(preg_match("/.*\.(jpg|jpeg|jpe|gif|png)$/i",$imageurl,$eregarray)){ $imgext = $eregarray[1]; } $lpos = strrpos($imageurl,"/"); $imgname = trim(substr($imageurl,$lpos+1,strlen($imageurl))); $imgname_without_extention = substr($imgname,0,strrpos($imgname,".")); $cart_item_image = null; $show_image = 0; // no need to create cart image only set the width for original image if(file_exists(IMGS_DIR.$imgname_without_extention.'_th.'.$imgext)) { $cart_item_image = IMGS_DIR_URL.$imgname_without_extention."_th.".$imgext; $show_image = 1; } elseif(file_exists(IMGS_DIR.$imgname_without_extention.'.'.$imgext)) { $cart_item_image = IMGS_DIR_URL.$imgname_without_extention.".".$imgext; $show_image = 1; } // end /*if($imgname_without_extention != '') { if(file_exists(IMGS_DIR.$imgname)) { makeThumbnailCustom($imgname, $item_thumb_cart_page_width, "_cart_item_th.", $isThumb = 1); } else { copyImage($imageurl, IMGS_DIR . $imgname); makeThumbnailCustom($imgname, $item_thumb_cart_page_width, "_cart_item_th.", $isThumb = 1); } $cart_item_image = IMGS_DIR_URL.$imgname_without_extention."_cart_item_th.".$imgext; } else{ $cart_item_image = IMGS_DIR_URL.$imgname_without_extention."_cart_item_th.".$imgext; }*/ if (!$mobile_view) { if($cart_item_image && $show_image) echo ""; else echo ""; } } // end item_thumb_cart_page echo "\n"; if($ShowWeight != 'N') { echo "\n"; } if($haz_fee != '0'){ if($haz_charge_shop == 'PS'){ if($haz_fee == '1'){ if($domestic_shipping) $haz_value = $haz_domestic_shop; } elseif($haz_fee == '2'){ if(!$domestic_shipping) $haz_value = $haz_international_shop; } else{ if($domestic_shipping) $haz_value = $haz_domestic_shop; else $haz_value = $haz_international_shop; } } else{ if($haz_fee == '1'){ if($domestic_shipping) $haz_value += $haz_domestic_shop; } elseif($haz_fee == '2'){ if(!$domestic_shipping) $haz_value += $haz_international_shop; } else{ if($domestic_shipping) $haz_value += $haz_domestic_shop; else $haz_value += $haz_international_shop; } } } $priceOfProduct=showmoney($price, $shop)."\n"; echo "\n", ""; $total = $price * $quantity; $total += $additional_char_cost*$quantity; $totalsofar += $total; echo "\n", "\n\n"; $ItemCustomText = ""; } mysql_free_result_($qry_getproducts); echo ""; echo ""; echo ""; } $total_display_shipping_calculator = $totalsofar; if (!$hasitem) { ?>
The product was ".$grBackText." your cart. To Go Back to registry click here Here
 ".$customizableFields[47]."".$customizableFields[48]."".$customizableFields[47]." class='tdcartheading' > class='tdcartheading' > class='tdcartheading' >
 "; if ($mobile_view) { if($cart_item_image) { echo "
"; } } echo "$prodname
"; if ($isgiftcert == 0 && $warehouse_location_cart_page == 'Y'){ echo ($item_location != "") ? "$customizableFields[327] $item_location
" : "$customizableFields[327] *
"; } if ($isgiftcert == 0 && $sku_pno_display == 1){ echo ($sku_pno != "") ? "$customizableFields[239] $sku_pno
" : "$customizableFields[239] *
"; } if($cart_page && $stockcontrolmode == 2){ if($quantity > $stockqty){ echo "$backorder_message"; } } $additional_char_cost = 0; if ($ItemCustomText != '') { #$ItemCustomTextString = fnGetCustomTextString($ItemCustomText, $prodid); $additional_char_cost = getAdditionalCharCost($ItemCustomText,$prodid); $ItemCustomTextStringTemp=fnGetCustomTextString($ItemCustomText, $prodid); if(!trim($ItemCustomTextStringTemp)=="") echo "
", wordwrap($ItemCustomTextStringTemp, 85, "
"), "
"; } if($uploadfile_name != ""){ $uploadfile_name_array = explode('||',$uploadfile_name); foreach($uploadfile_name_array as $val){ if(trim($val) != ""){ echo "View File "; echo "Remove File
"; } } } echo "
".showweight($prodoptweight,$shop)."", $priceOfProduct , "", "\n", "\n", "", showmoney($total, $shop), "



colspan=''>  align='right' bgcolor='' > align='right' bgcolor=''> colspan='' class="td_haz">  align='right' bgcolor='' class="td_haz_cells">: align='right' bgcolor='' class="td_haz_cells"> 0) || $promodiscount_chk == "ZeroPromoCode") { //$promodiscount += calculatePromoDiscount($codestring, $cart, $subtotal, $promocodetype, $promocode_negative, $promocodesql, $promocode_catid, $promo_validity, $promo_products, $useCart=1); $promodiscount += $promodiscount_chk; $promo_found = 1; $mypromocode .= $codestring . "[Auto] "; $promo_custom_message .= mysql_result_(mysql_query_("SELECT custom_message FROM promocodes WHERE codestring='" . mysql_real_escape_string_($codestring) . "'"), 0); $promo_custom_message .= "  "; } elseif ($promo_found == 0) { $promodiscount = $promodiscount_chk; } } } // end while } $GoogleDiscountProductName = ''; if($promodiscount != "0" AND $promodiscount == "Invalid") { //$promocode_msg = "$customizableFields[180]"; $promocode_msg = "Promo code \"$mypromocode\" is not valid, or is expired"; $promodiscount = 0; } elseif($promodiscount != "0" AND $promodiscount == "Expired") { $promocode_msg = "$customizableFields[181]"; $promodiscount = 0; } elseif($promodiscount != "0" AND $promodiscount == "NotEffective") { $promocode_msg = "$customizableFields[182]"; $promodiscount = 0; } elseif($promodiscount != "0" AND $promodiscount == "NotFallIn") { $promocode_msg = "$customizableFields[183]"; $promodiscount = 0; } elseif($promodiscount === "ZeroPromoCode") { $promocode_msg = ""; //$promodiscount = 0; } else { $promocode_msg = ""; $GoogleDiscountProductName = $mypromocode; } if(isset($mypromocode1)){ $mypromocode1 = trim($mypromocode1); } if(isset($mypromocode1_text)){ $mypromocode1 = $mypromocode1.'||'.trim($mypromocode1_text); } $promodiscount1 =0; $mypromocode1_array = array_unique(explode("||", $mypromocode1)); $mypromocode1_array_new = array(); foreach($mypromocode1_array as $mypromocode1_val){ if ($mypromocode1_val){ $getgiftcert = mysql_query_("SELECT balance FROM giftcerts WHERE BINARY certcode = TRIM('$mypromocode1_val') AND active = 'Y' AND balance > 0"); if ($getgiftcert && mysql_num_rows_($getgiftcert)){ list($certbalance) = mysql_fetch_row_($getgiftcert); $promodiscount1 += $certbalance; $mypromocode1_array_new[] = $mypromocode1_val; } else { $mypromocode = ""; } } } $mypromocode1 = implode("||",$mypromocode1_array_new); if($promodiscount1 != "0" AND $promodiscount1 == "Invalid") { $promocode_msg1 = "$customizableFields[180]"; $promodiscount1 = 0; } elseif($promodiscount1 != "0" AND $promodiscount1 == "Expired") { $promocode_msg1 = "$customizableFields[181]"; $promodiscount1 = 0; } elseif($promodiscount1 != "0" AND $promodiscount1 == "NotEffective") { $promocode_msg1 = "$customizableFields[182]"; $promodiscount1 = 0; } elseif($promodiscount1 != "0" AND $promodiscount1 == "NotFallIn") { $promocode_msg1 = "$customizableFields[183]"; $promodiscount1 = 0; } else { $promocode_msg1 = ""; $GoogleDiscountProductName .= ' '.$mypromocode1; } $qry_getshippingmode = mysql_query_("SELECT shippingtype, showshippingincart FROM shop"); if($qry_getshippingmode && mysql_num_rows_($qry_getshippingmode)){ list ($shippingmode, $showshippingincart) = mysql_fetch_row_($qry_getshippingmode); mysql_free_result_($qry_getshippingmode); } if ((isset($shippingmode) && $shippingmode !=5) && (isset($showshippingincart) && $showshippingincart=="Y")){ ?> colspan=''>  align='right' bgcolor=''> align='right' bgcolor=''> 0 || !empty($promocode_msg)){ $shipping = calculateshipping($shop,$cart,$totalsofar, $promocodetype); for ($ii = 0; $ii<2; $ii++) { if(is_numeric($shipping)){ break; } else { $attampt ++; echo "
"; $shipping = calculateshipping($shop,$cart,$totalsofar, $promocodetype); } } } else{ $shipping = calculateshipping($shop,$cart,$totalsofar, $promocodetype); for ($ii = 0; $ii<2; $ii++) { if(is_numeric($shipping)){ break; } else { $attampt ++; echo "
"; $shipping = calculateshipping($shop,$cart,$totalsofar, $promocodetype); } } } if(isset($formshipoptions) && $formshipoptions != 0){ $selectshipoptions = mysql_query_("SELECT price, pricemode FROM altshipoptions WHERE id='{$formshipoptions}'"); if($selectshipoptions && mysql_num_rows_($selectshipoptions)){ list($shipoptprice, $shipoptpricemode) = mysql_fetch_row_($selectshipoptions); } if($shipoptpricemode == 1){ $shipping += ($shipoptprice*100); } elseif($shipoptpricemode == 4){ $shipping *= ($shipoptprice); } elseif($shipoptpricemode == 2){ $shipping -= ($shipoptprice*100); } elseif($shipoptpricemode == 3){ $shipping = ($shipoptprice*100); } } if($only_downloadable_items) $shipping = 0; echo showmoney($shipping,$shop); $totalsofar += $shipping; } ?>
0 || $promodiscount1>0 || $promodiscount === "ZeroPromoCode"){ ?> colspan=''>  align='right' bgcolor='' class="discountonpurchase"> align='right' bgcolor=''> $totalsofar){ $checkouttype = 14; } //this code is added so that if the grand total is 0 then the checkout type will be converted to secure checkout //added on date march 01 else if($totalsofar <= 0) { $checkouttype = 6; } } ?> colspan=''>  align='right' bgcolor=''> align='right' bgcolor=''>
";} //if($_GET['cart'] != "") $formMethod = 'post'; //else //$formMethod = 'POST'; if(strpos($contshoplink,"/shop/")){ $formMethod = 'post'; } ?>
encrypt($passphrase,validateInput($_SERVER["SERVER_NAME"]))); } if($arb_product_not_allowed == 'Y'){ echo "
"; } else { echo ($NewWindow == 1) ? "" : ""; } echo ""; echo ""; ?>
"; echo $customizableFields[73]. "
"; if ($alternative_shipping_text != "" && $alternative_shipping_text != 'None Selected') { echo $alternative_shipping_text . "
"; } while (list($shipoptid, $shipoptname, $shipoptprice, $shipoptpricemode) = mysql_fetch_row_($selectshipoptions)) { if ($shipoptid == $formshipoptions) { $checkedshippingoption = "checked"; $altshippingprice = $shipoptprice; $altshippingpricemode = $shipoptpricemode; } if ($shipoptpricemode == 1) $shipoptpricemode = "+"; elseif ($shipoptpricemode == 2) $shipoptpricemode = "-"; elseif ($shipoptpricemode == 4) $shipoptpricemode = "*"; else $shipoptpricemode = ""; echo "
$shipoptname ($shipoptpricemode".showmoney($shipoptprice*100, $shop).")

"; $checkedshippingoption = ""; } echo ""; } else { echo " \n"; } ?>
Applied: Remove
: /> >
()
>
()
 
$subtotal && $hasitem == true) { $min_checkout_amt = showmoney($min_checkout_amt, $shop); $error_message_minimum_checkout = str_ireplace("[xx]",$min_checkout_amt,$customizableFields[255]); ?>
>




"; else echo ""; ?>
"; if ($cust_email == 'guest' && !$only_downloadable_items ) { echo ""; echo ""; $rs_location = mysql_query_("Select tax From location Where tax > 0 AND type = 1;"); //if(mysql_num_rows_($rs_location) > 0){ echo ""; echo ""; //echo "
{$space}$customizableFields[343]"; //} } else{ if ($only_downloadable_items) { echo ""; } else { echo ""; } } echo ""; echo "
"; if ($shippingmode == 5) { $selectshopshipping = mysql_query_("SELECT shipservice, defaultshippingservice, defaultshippingservice_international FROM shop WHERE id='{$shop}'"); if($selectshopshipping && mysql_num_rows_($selectshopshipping)){ list ($shipservice, $defaultshippingservice, $defaultshippingservice_international) = mysql_fetch_row_($selectshopshipping); } $cartshipservicearray = explode(",", $shipservice); $update_shipservices = false; $isCodes = array('UGN' => "GND", 'U2D' => "2DA", 'U2A' => "2DM",'U3S' => "3DS", 'UNS' => "1DP", 'UND' => "1DA", 'UNA' => "1DM", 'UWE' => "UPSWWE", 'UWP' => "UPSWWEXPP", 'UWX' => "UPSWWX", 'UCX' => "UPSSTD", 'UCE' => "UPSSTD", 'UCP' => "UPSSTD", 'UCS' => "UPSSTD"); foreach ( $cartshipservicearray as $key => $value ){ $ups_code_key = array_search($value, $isCodes); if($ups_code_key !== false){ $cartshipservicearray[$key] = $ups_code_key; $update_shipservices = true; } } if($update_shipservices){ $is_shipservice_list = implode(",", $cartshipservicearray); @mysql_query_("UPDATE shop SET shipservice='".$is_shipservice_list."'"); } $space = ""; if(!$mobile_view){ //$space = "     "; } $temparray = array("UGN","U2D","U2A","U3S","UND","UNA","UNS","FPO","FSO","F2D","FES","FFO","FGD","Express","Priority","Parcel","USPSBPM","USPSMM","USPSFCM","USPSFRBD","DON","DOL","DNL","DNP","DAL","DAP","D2L","D2P","DGN","DGH","DGM","DGB","CRG","CPC","CCX","CCE", "UCX","UCE","UCP","UCS","UWX", "UWE", "UWP", "FIE","FIP","USPSFRBI","USPSGXG","USPSEMI","USPSPMI","USPSFCMI","DIL","DID","DPE","DGP","DGS","CPL","CUX","CUE"); for($i = 0 ; $i< sizeof($cartshipservicearray); $i++) { if(in_array($cartshipservicearray[$i],$temparray)){ $shipservicearray[] = $cartshipservicearray[$i]; } } if(sizeof($shipservicearray) > 0){ echo ""; } else{ echo "$customizableFields[101]"; $shipping_allowed = 0; } } // end if echo "
"; echo "$customizableFields[342]"; echo ""; echo ""; echo "
 "; echo ""; echo "
 "; echo ""; echo "
 "; echo "
".wordwrap($_SESSION['shipping_error'],50,"
\n")."
"; if($_SESSION['shipping_error'] != '') { echo ""; } unset($_SESSION['shipping_zip']); unset($_SESSION['shipping_error']); if($mobile_view) { ?>
"; } ?>
" : "
"; ?> encrypt($passphrase,$_SERVER["SERVER_NAME"])); } ?>

/>
/>
"> SetIssuedAt(time()); $payload->SetExpiration(time()+3600); $payload->AddProperty("name", "{$shop_name}"); #$payload->AddProperty("description","Virtual chocolate cake to fill your virtual tummy"); $payload->AddProperty("price", "$grandtotal"); $payload->AddProperty("currencyCode", "USD"); #$payload->AddProperty("sellerData","user_id:1224245,offer_code:3098576987,affiliate:aksdfbovu9j"); // Creating payload of the product. $Token = $payload->CreatePayload($sellerIdentifier); // Encoding payload into JWT format. $jwtToken = JWT::encode($Token, $sellerSecretKey); #echo ""; ?>
$value) { echo "", "", ""; } ?>
"; // Make description from code $prodoptcode = $value[0]; preg_match("/^([0-9]+)/",$prodoptcode,$eregarray); $prodopt1 = $eregarray[1]; $QueryGetProductDesc = "SELECT product.name, productoption.description FROM product, productoption WHERE productoption.productid = product.id AND productoption.id = ".validateInput($prodopt1); $qry_getproductdesc = mysql_query_($QueryGetProductDesc); unset($QueryGetProductDesc); if($qry_getproductdesc && mysql_num_rows_($qry_getproductdesc)){ list ($prodname, $prodoptdesc) = mysql_fetch_row_($qry_getproductdesc); mysql_free_result_($qry_getproductdesc); } if ($prodoptdesc) { // Level 1 has description - start brackets and description.... $prodname .= " ($prodoptdesc"; // build rest of description out of level 2+ product options $prodoptcode = preg_replace("/^[0-9]+\-(.*)/","\\1",$prodoptcode); // get rid of first productoption code $prodoptcodes = explode("-",$prodoptcode); //while (list($key,$prodopt) = each($prodoptcodes)) { foreach($prodoptcodes as $key => $prodopt) { $qry_getprodoptdesc = mysql_query_("SELECT description FROM productoption WHERE id='{$prodopt}'"); if($qry_getprodoptdesc && mysql_num_rows_($qry_getprodoptdesc)){ list ($description) = mysql_fetch_row_($qry_getprodoptdesc); mysql_free_result_($qry_getprodoptdesc); } $prodname .= ", $description"; } $prodname .= ")"; } echo ""; switch ($value[1]) { case 0 : #added OK if ($quantity > 0) $customizableFields[47] ." '". GetFilterizedHMTLEntities(strip_tags($prodname))."' ". $customizableFields[59]; break; case 1 : echo $customizableFields[47] ." '". GetFilterizedHMTLEntities(strip_tags($prodname))."' ". $customizableFields[50] . " " . $customizableFields[60]; break; case 2: echo $customizableFields[47] ." '". GetFilterizedHMTLEntities(strip_tags($prodname))."' ". $customizableFields[58]; break; case 3: echo "$customizableFields[220] ", GetFilterizedHMTLEntities(strip_tags($prodname)), " $customizableFields[60]"; break; case 4: echo "$customizableFields[47] ", GetFilterizedHMTLEntities(strip_tags($prodname)), " $customizableFields[58]."; break; case 5: echo "$customizableFields[221] ", GetFilterizedHMTLEntities(strip_tags($prodname)), " $customizableFields[222]"; break; case 6: echo "$customizableFields[221] ", GetFilterizedHMTLEntities(strip_tags($prodname)), " $customizableFields[223]"; break; case 7: $qry_getstockmsg = mysql_query_("SELECT stockcontrolmsg FROM shop"); if($qry_getstockmsg && mysql_num_rows_($qry_getstockmsg)){ list ($stockmsg) = mysql_fetch_row_($qry_getstockmsg); mysql_free_result_($qry_getstockmsg); } echo GetFilterizedHMTLEntities($stockmsg); # display stock message break; case 8: $qry_getstockmsg = mysql_query_("SELECT stockcontrolmsg FROM shop"); if($qry_getstockmsg && mysql_num_rows_($qry_getstockmsg)){ list ($stockmsg) = mysql_fetch_row_($qry_getstockmsg); mysql_free_result_($qry_getstockmsg); } echo html_entity_decode("$customizableFields[47]". GetFilterizedHMTLEntities($prodname). " $customizableFields[224] - ". GetFilterizedHMTLEntities($stockmsg)); # display stock message break; } echo "", "
"; } ?>
 
", $val, "
 
", stripslashes($custom_html_cartpage_beneath), ""; } if (is_array($List_of_Suggested_Items) && count($List_of_Suggested_Items)) { ?>
"; echo ""; $ShowSuggestedItemTitle = false; } if($ItemName){ #Display Item Suggestions on Cart page STARTS HERE $suggested_item_thumbnail_val = ""; $item_name_display = showItemName($ItemId); $suggested_item_link = URL_SHOP_ALIAS_ITEM."$item_name_display-{$ItemId}"; if($item_suggestion_with_thumbnail =='Y') { $imgext = ""; if($ImageURL != ""){ if (preg_match("/.*\.(jpg|jpeg|jpe|gif|png)$/i", $ImageURL, $eregarray)) { $imgext = $eregarray[1]; } } $lpos = strrpos($ImageURL,"/"); $imgname = trim(substr($ImageURL,$lpos+1,strlen($ImageURL))); $imgname_without_extention = substr($imgname,0,strrpos($imgname,".")); $IsThumbAlreadyExists = substr($imgname,0,strrpos($imgname,".")); $posAlias = strpos(IMGS_DIR_URL_ALIAS, $_SERVER['SERVER_NAME']); $show_image = 0; if(file_exists(IMGS_DIR.$imgname_without_extention.'_th.'.$imgext)) { $suggested_image = IMGS_DIR_URL.$imgname_without_extention."_th.".$imgext; $show_image = 1; } elseif(file_exists(IMGS_DIR.$imgname_without_extention.'.'.$imgext)) { $suggested_image = IMGS_DIR_URL.$imgname_without_extention.".".$imgext; $show_image = 1; } if(file_exists(IMGS_DIR.$imgname) && $imgname != ""){ $suggested_item_thumbnail_val = "\"".htmlentities($ItemName)."\"
"; } /* if(file_exists(IMGS_DIR.$imgname) && $imgname != ""){ makeThumbnailCustom($imgname,$default_thumbnail_width_cartpage,"_suggested_item_th.",$isThumb=1); $suggested_image = IMGS_DIR_URL.$imgname_without_extention."_suggested_item_th.".$imgext; $suggested_item_thumbnail_val = "\"".htmlentities($ItemName)."\"
"; } elseif(strlen($ImageURL) > 1){ copyImage($ImageURL,IMGS_DIR.$imgname); makeThumbnailCustom($imgname,$default_thumbnail_width_cartpage,"_suggested_item_th.",$isThumb=1); $suggested_image = IMGS_DIR_URL.$imgname_without_extention."_suggested_item_th.".$imgext; unlink(IMGS_DIR.$imgname); $suggested_item_thumbnail_val = "\"".htmlentities($ItemName)."\"
"; } else{ // nothing display }*/ } if ($j == 0) echo "\n"; $j = $j + 1; // "", htmlentities($ItemName), "", echo ""; if ($j >= $thumbnails_per_row_cartpage){ echo "\n"; $j = 0; } $ItemsHasBeenShown[] = $ItemId; } } } } // end if } ?>
 
", stripslashes($suggested_items_html_text), "
", $suggested_item_thumbnail_val, "", html_entity_decode($ItemName, ENT_QUOTES), "", "