PHP 7.4.33
Preview: review-order.php Size: 268.66 KB
//home/justbyquicklly-old/public_html/test/review-order.php

<?php
include("include/config.php");
include("include/functions.php");
include_once("include/CourierService.php");
$qpassdefaultcouponcode='';
$qpasscouponarray=array();

$btpayment=false;
$platformservicefeequery = $obj->query("select platform_service_fees_delivery,platform_service_fees_pickup  from  tbl_setting where id=1 and status=1 ");
 $platformservicefeeRes = $obj->fetchNextObject($platformservicefeequery);	
if ($_COOKIE['grocery_tab_index'] == 1) {
	$_SESSION['platform_service_fees']=$platformservicefeeRes->platform_service_fees_pickup;
} else {
	$_SESSION['platform_service_fees']=$platformservicefeeRes->platform_service_fees_delivery;
}
 if($_SESSION['value_user_id']!='' && $_SESSION['value_plan_id']>0 && isset($_SESSION['value_user_type']) && $_SESSION['value_user_type'] == '0'){
$quickllyCheckPassPlan = $obj->query("SELECT b.plan_pickup_orders_off,b.plan_extra_off_percentage,b.platform_service_fees_pickup,b.platform_service_fees_delivery FROM `tbl_quicklly_pass_subscription` as a left join tbl_quicklly_pass_plan as b on
b.id=a.plan_id where a.subscription_status=1 and a.user_id='".$_SESSION['value_user_id']."'");
             $Count = $obj->numRows($quickllyCheckPassPlan);
			 if($Count > 0){ 
			 $plancheckdetails = $obj->fetchNextObject($quickllyCheckPassPlan);
			 }

if ($_COOKIE['grocery_tab_index'] == 1) {
		 
	$_SESSION['value_member_price_off']=$plancheckdetails->plan_extra_off_percentage+$plancheckdetails->plan_pickup_orders_off;
	$_SESSION['platform_service_fees']=$plancheckdetails->platform_service_fees_pickup;
			 
} else {
	$_SESSION['value_member_price_off']=$plancheckdetails->plan_extra_off_percentage;
	$_SESSION['platform_service_fees']=$plancheckdetails->platform_service_fees_delivery;
}
}
unset($_SESSION['grocerydeliverytime']);
unset($_SESSION['fooddeliverytime']);
unset($_SESSION['grocery_deliverytime']);
unset($_SESSION['food_deliverytime']);
unset($_SESSION['giftcard_deliverytime']);
unset($_SESSION['event_deliverytime']);
unset($_SESSION['puja_deliverytime']);
unset($_SESSION['apparel_deliverytime']);
unset($_SESSION['blackfriday_deliverytime']);
unset($_SESSION['subtotal']);
unset($_SESSION['totalsavings']);
unset($_SESSION['membersavings']);
unset($_SESSION['platinumsavings']);
$mealmemsg="";
if($_SESSION['case']==0 || $_SESSION['case']==1){
	$quickllyPasstopPlan = $obj->query("SELECT * FROM `tbl_quicklly_pass_plan` where plan_type='platinum'");
             $Count = $obj->numRows($quickllyPasstopPlan);
			 if($Count > 0){ 
			 $platinumplandetails = $obj->fetchNextObject($quickllyPasstopPlan);
			 }
}

if(!isset($_COOKIE['postalcode']) || trim($_COOKIE['postalcode']) == ''){
   // header("location:" . SITE_URL);
}

if (trim($_COOKIE['url']) != '' && trim($_COOKIE['url']) != ',') {
    $urlarr = explode(',', $_COOKIE['url']);
    $url = $urlarr[0] . '-' . $urlarr[1];
} else {
    $url = '';
}


if (!isset($_COOKIE['tip']) || $_COOKIE['tip'] == '') {
    ?>
    <script language="javascript">
        document.cookie = "tip" + "=" + 10 + ";" + "path=/";
    </script>
    <?php
}

/*if ($_COOKIE['grocery_tab_index'] == 0) {
if (isset($_REQUEST['pincode'])) {
    if ($_REQUEST['pincode'] != $_COOKIE['postalcode']) {
        //echo $_REQUEST['pincode'];
        //echo $_COOKIE['postalcode'];
        include('unset_sessions.php');
        echo "<script>   localStorage.clear();  refreshPhpCart();</script>";
        setcookie('postalcode', $_REQUEST['pincode'], time() + (86400 * 30 * 12), "/"); // 86400 = 1 day
        //header("Location:".SITE_URL."indian-grocery/");
        //exit;
    }
}
}*/

if ($_REQUEST['changerequest'] == 'yes' || $_REQUEST['guestuser'] == 'yes') {
    $_SESSION['guestuser'] = 'yes';
	$_SESSION['fname'] = strip_tags($_REQUEST['fname']);
}
/*
  if(isset($_POST['jsonData'])) {
  $obj = $_POST['jsonData'];
  $arr_grocery_cart = $obj['lstCartGrocery'];
  $arr_food_cart = $obj['lstCartFood'];

  $GroceriesSubtotal  = 0;
  $FoodSubtotal  = 0;
  $storearrid=array();
  $productidarray=array();

  foreach($arr_grocery_cart as $data)
  {
  //$GroceriesSubtotal += floatval($data['total']);
  array_push($storearrid, $data['sid']);
  }

  //hikek
  //


  $result = array("grandTotal"=>$GroceriesSubtotal, "storeids"=>$storearrid, "tax"=>50);
  echo json_encode($result);
 */
if (isset($_POST['cartsubmit']) && $_POST['cartsubmit'] == 'CARTSUBMIT') {
    
    $cartgrocery = $_POST['hdnCartGrocery'];
    $cartfood = $_POST['hdnCartFood'];
    $cartgiftcard = $_POST['hdnCartGiftCard'];
	$cartevent = $_POST['hdnCartEvents'];
	$cartapparel = $_POST['hdnCartApparel'];
    $cart_grocery = json_decode($_POST['hdnCartGrocery'], TRUE);
    $cart_food = json_decode($_POST['hdnCartFood'], TRUE);
    $cart_giftcard = json_decode($_POST['hdnCartGiftCard'], TRUE);
	$cart_event = json_decode($_POST['hdnCartEvents'], TRUE);
	$cart_puja = json_decode($_POST['hdnCartPuja'], TRUE);
	$cart_apparel = json_decode($_POST['hdnCartApparel'], TRUE);
    $_SESSION['f_cart']= $cart_food;
	//print_r($cart_food);

//Common
    $prodDBCheckarr = array();
	$prodDBCheckarrmealme = array();

//Grocery
    $storeidarrg = array();
    $productidarrg = array();
    $qtyarrg = array();
    $taxarrg = array();
    $subtotalg = array();
	$storeidblackfriday = array();
	

//Gift Card
    $storeidarrgc = array();
    $productidarrgc = array();
    $qtyarrgc = array();
    $taxarrgc = array();
    $subtotalgc = array();
    $cardtypegc = array();
    $cardcatgc = array();
    $unitpricegc = array();
//Event
$storeidarre = array();
    $productidarre = array();
    $qtyarre = array();
    $taxarre = array();
    $subtotale = array();
	$servicefeeoneventlevel=array();
	$conveniencefeevalue=array();

    $deliverydatee = array();
    $deliveryfromtimee = array();
    $deliverytotimee = array();
    
    $deliverydatenexte = array();
    $deliveryfromtimenexte = array();
    $deliverytotimenexte = array();
    
    $custome = array();
    $remarkse = array();
    $addonIDse = array();
    $add_on_sizeide = array();
    $addonQtyse = array();
    $sizeIDe = array();
    $sectione= array();
	$deliverytypee = array();
	$cartid = array();
    //$pickup_grocery = false;
	$uremarkse = array();
	$eventtotatcalqty = array();

//Puja
    $storeidarrp = array();
    $productidarrp = array();
    $qtyarrp = array();
    $taxarrp = array();
    $subtotalp = array();
    $deliverydatep = array();
	$deliverytodatep = array();
	$sevicetype = array();
	$pujday = array();
    $deliveryfromtimep = array();
    $deliverytotimep = array();
    $deliverydatenextp = array();
    $deliveryfromtimenextp = array();
    $deliverytotimenextp = array();
    $customp = array();
    $remarksp = array();
    $addonIDsp = array();
    $add_on_sizeidp = array();
    $addonQtysp = array();
    $sizeIDp = array();
	$username = array();
	$useremail = array();
	$dob = array();
	$birthplace = array();
	$birthcountry = array();
	$questiontodiscussion = array();
	$slotid = array();
    $sectionp= array();
	$deliverytypep = array();
	$uremarksp = array();
 //Apparel
    $storeidarra = array();
    $productidarra = array();
    $qtyarra = array();
    $taxarra = array();
    $subtotala = array();
    $deliverydatea = array();
    $deliveryfromtimea = array();
    $deliverytotimea = array();
    $customa = array();
    $remarksa = array();
    $sectiona= array();
	$deliverytypea = array();
	$uremarksa= array();

//recipe
    $chefidarrg = array();

//Food

    $specificCouponArr = array();
	$specificCouponArrg = array();
	$specificCouponArrf = array();
	$specificCouponArrfpj = array();
	$specificCouponArrfap = array();
	$foodsarrayon = array();
   
    $storeidarrf = array();
    $productidarrf = array();
    $qtyarrf = array();
    $taxarrf = array();
    $subtotalf = array();

    $deliverydatef = array();
    $deliveryfromtimef = array();
    $deliverytotimef = array();
    
    $deliverydatenextf = array();
    $deliveryfromtimenextf = array();
    $deliverytotimenextf = array();
    
    $customf = array();
    $remarksf = array();
    $addonIDsf = array();
    $add_on_sizeids = array();
    $addonQtysf = array();
    $sizeIDf = array();
    $sectionf = array();
	$subscriptiontypef = array();
	$deliverytypef = array();
    $pickup_grocery = false;
	$uremarksf = array();
	$mmOID = array();
	$platinumprodsavings=array();
	$memberprodsavings=array();
	$recipentDetails=array();
	$uniqueRecipent=array();
    $i = 0;
	$prodPriceDBCheckarr=array();
    foreach ($cart_grocery as $data) {
        //Product Removal Code Start
        //$prodDBCheckarr //pid, name, i, cart_grocery
		$specificCouponData = array(
		  "pID" => $data['pid'],
		  "storeID" => $data['sid'],
          "sPrice" => $data['price'],
		  "sQty" => $data['qty']
		);
		array_push($specificCouponArrg, $specificCouponData);
		
        $prdctItemTobeRemovedCheck = array(
            "pid" => $data['pid'],
            "name" => $data['name'],
            "section" => 'cart_grocery',
            "indx" => $i
        );
		$prdctItemToCheckPrice = array(
            "pid" => $data['pid'],
			"sid" =>  $data['sid'],
            "name" => $data['name'],
            "section" => 'grocery',
			"cost" =>  $data['price'],
			"tax" => $data['baseTax']
        );
        $i++;
        array_push($prodDBCheckarr, $prdctItemTobeRemovedCheck);
		array_push($prodPriceDBCheckarr, $prdctItemToCheckPrice);
        //Product Removal Code Ends
        if($data['sid']==111146){
			array_push($storeidblackfriday, $data['sid']);
		}
        array_push($storeidarrg, $data['sid']);
		array_push($chefidarrg, $data['chefid']);
		if($data['uremarks']!=''){
			$uremarksf[$data['pid']]=$data['uremarks'];
		}
        array_push($productidarrg, $data['pid']);
        array_push($qtyarrg, $data['qty']);

        if($data['source']!=''){
			$sourcegrocery[$data['pid']]=$data['source'];
		}
       
		if($_SESSION['value_member_price_off'] > 0) {
			
		$datatotal= number_format($data['price'] -($data['price'] * $_SESSION['value_member_price_off'] / 100),2);
		$datatotal=number_format($datatotal*$data['qty'],2);
		     $yousaved=$data['total']-$datatotal;
		      array_push($memberprodsavings,$yousaved);
			 array_push($taxarrg,  $data['tax']);
			 array_push($subtotalg, $datatotal);
		} else {
			array_push($taxarrg, $data['tax']);
			array_push($subtotalg, $data['total']);
		}
	if($_SESSION['case']==0 || $_SESSION['case']==1){
		
		$member_price_off=$platinumplandetails->plan_extra_off_percentage;
		if($_COOKIE['grocery_tab_index'] == 1) {
	   $member_price_off=$member_price_off+$platinumplandetails->plan_pickup_orders_off;
       }
		$datatotal= number_format($data['price'] -($data['price'] * $member_price_off  / 100),2);
		$datatotal=number_format($datatotal*$data['qty'],2);
		$yousaved=$data['total']-$datatotal;
		array_push($platinumprodsavings,$yousaved);
	}
        $pickup_grocery = true;
            if($data['chefid']){
              $chefData[$data['chefid']]   = $chefData[$data['chefid']] +$data['qty']*$data['price'] ;
            }
    }
    $pickup_food = false;

    $i = 0;
	    $commondeliverydate='';
	    $onetimeaddon=array();
		$onetimeaddonqty=array();
		$otmainp='';
		$weeklyaddon=array();
		$weeklyaddonqty=array();
		$wemainp='';
		$monthlyaddon=array();
		$monthlyaddonqty=array();
		$momainp='';
		$biweeklyaddon=array();
		$biweeklyaddonqty=array();
		$bimainp='';
                $seasoningaddon = array();
                $seasoningSubscriptionTypes = array();     
                $kimbalaboxaddon = array();
                $kimbalaboxSubscriptionTypes = array(); 
 		$holidayboxaddon = array();
                $holidayboxSubscriptionTypes = array();

						// New array format
$mealmestorearray = [];
    foreach ($cart_food as $dataf) {
        //Product Removal Code Start
        // $prodDBCheckarr //pid, name, i, cart_food  

        $specificCouponData = array(
		  "pID" => $dataf['pid'],
		  "storeID" => $dataf['sid'],
          "sPrice" => $dataf['price'],
		  "sQty" => $dataf['qty']
		);
		
		array_push($specificCouponArrf, $specificCouponData);
	   if($dataf['section']=='food'){
       array_push($foodsarrayon, $dataf['sid']);	
      }	   
		
        $prdctItemTobeRemovedCheck = array(
            "pid" => $dataf['pid'],
            "name" => $dataf['name'],
            "section" => 'cart_food',
            "indx" => $i
        );
		array_push($specificCouponArrf, $specificCouponData);
        $i++;
		
		

if($dataf['section']=='mealme'){
	array_push($prodDBCheckarrmealme, $prdctItemTobeRemovedCheck);
    $sid = $dataf["sid"];
    $pid = $dataf["pid"];
    $qty = $dataf["qty"];
    $customizations = [];

    if (!empty($dataf["addOns"])) {
        foreach ($dataf["addOns"] as $addon) {
            $customizations[] = [
                "oid" => $addon["pid"],
                "qty" => $addon["qty"]
            ];
        }
    }

    $storeExists = false;

    // Check if store already exists in the new array
    foreach ($mealmestorearray as &$store) {
        if ($store["sid"] == $sid) {
            $store["lstProd"][] = [
                "pid" => $pid,
                "qty" => $qty,
                "lstCustomization" => $customizations
            ];
            $storeExists = true;
            break;
        }
    }

    if (!$storeExists) {
        $mealmestorearray[] = [
            "sid" => $sid,
            "lstProd" => [
                [
                    "pid" => $pid,
                    "qty" => $qty,
                    "lstCustomization" => $customizations
                ]
            ]
        ];
    }

	
	}
		 
        
		
        
        //Product Removal Code Ends
		
       if($dataf['section']=='seasoning'){
                    
                    $seasoningCommondeliveryDate = $dataf['deliveryDate'];
                    $seasoningStoreId = $dataf['sid'];
                    $seasoningMainpid = $dataf['mainpid'];
                    
                    $seasoningaddonProduct[$dataf['subscriptiontype']][] = $dataf['pid'];
                    $seasoningaddonQty[$dataf['subscriptiontype']][] = $dataf['qty'];
                    $seasoningaddonsizeID[$dataf['subscriptiontype']][] = $dataf['sizeID'];

                    $seasoningaddoncustomize[$dataf['subscriptiontype']][] = $dataf['customize'];
                    $qtys = $dataf['qty'];
                  
                    if ($qtys > 1) {
                        $qtys = "(x".$dataf['qty'].")";
                    }

                    $custmremarks  = $dataf['name']  . " " . $dataf['remarks'] . $qtys  ;
                    $seasoningaddonremarks[$dataf['subscriptiontype']][] = $custmremarks;
                    
                    $seasoningSubscriptionTypes[$dataf['subscriptiontype']] = $dataf['subscriptiontype'];
                    $totalTax =  number_format($dataf['baseTax'],2,'.','') * $dataf['qty'];
                    $lasttax =   number_format($seasoningTaxarr[$dataf['subscriptiontype']],2,'.','');
                    $totalTaxes = number_format($lasttax +  $totalTax ,2,'.','');
                    $seasoningTaxarr[$dataf['subscriptiontype']] = $totalTaxes;
                    $seasoningTotal[$dataf['subscriptiontype']] = number_format(number_format($seasoningTotal[$dataf['subscriptiontype']],2,'.','') + number_format($dataf['total'],2,'.','')    ,2,'.','');
                    
		           }  else if($dataf['section']=='kimbalabox'){
                    
                    $kimbalaboxCommondeliveryDate = $dataf['deliveryDate'];
                    $kimbalaboxStoreId = $dataf['sid'];
                    $kimbalaboxMainpid = $dataf['mainpid'];
                    
                    $kimbalaboxaddonProduct[$dataf['subscriptiontype']][] = $dataf['pid'];
                    $kimbalaboxaddonQty[$dataf['subscriptiontype']][] = $dataf['qty'];
                    $kimbalaboxaddonsizeID[$dataf['subscriptiontype']][] = $dataf['sizeID'];

                    $kimbalaboxaddoncustomize[$dataf['subscriptiontype']][] = $dataf['customize'];
                    $qtys = $dataf['qty'];
                    $qtyss='';
                    if ($qtys > 1) {
                        $qtyss = "(x".$dataf['qty'].")";
                    }

                    $custmremarks  = $dataf['name']  . " " . $dataf['remarks'] . $qtyss  ;
                    $kimbalaboxaddonremarks[$dataf['subscriptiontype']][] = $custmremarks;
                    
                    $kimbalaboxSubscriptionTypes[$dataf['subscriptiontype']] = $dataf['subscriptiontype'];
                    $totalTax =  number_format($dataf['baseTax'],2,'.','') * $dataf['qty'];
                    $lasttax =   number_format($kimbalaboxTaxarr[$dataf['subscriptiontype']],2,'.','');
                    $totalTaxes = number_format($lasttax +  $totalTax ,2,'.','');
                    $kimbalaboxTaxarr[$dataf['subscriptiontype']] = $totalTaxes;
                    $kimbalaboxTotal[$dataf['subscriptiontype']] = number_format(number_format($kimbalaboxTotal[$dataf['subscriptiontype']],2,'.','') + number_format($dataf['total'],2,'.','') ,2,'.','');
                    
		} else if($dataf['section']=='holidaygiftbox'){
                    
                    $holidayboxCommondeliveryDate = $dataf['deliveryDate'];
					//$holidayboxdeliveryType=$dataf['deliveryType'];
                    $holidayboxStoreId = $dataf['sid'];
                    $holidayboxMainpid = $dataf['mainpid'];
                    
                    $holidayboxaddonProduct[$dataf['subscriptiontype']][] = $dataf['pid'];
                    $holidayboxaddonQty[$dataf['subscriptiontype']][] = $dataf['qty'];
                    $holidayboxaddonsizeID[$dataf['subscriptiontype']][] = $dataf['sizeID'];
					$holidayboxdeliveryType[$dataf['subscriptiontype']][] = $dataf['deliveryType'];

                    $holidayboxaddoncustomize[$dataf['subscriptiontype']][] = $dataf['customize'];
                    $qtys = $dataf['qty'];
                    $qtyss='';
                    if ($qtys > 1) {
                        $qtyss = "(x".$dataf['qty'].")";
                    }

                    $custmremarks  = $dataf['name']  . " " . $dataf['remarks'] . $qtyss  ;
                    $holidayboxaddonremarks[$dataf['subscriptiontype']][] = $custmremarks;
                    
                    $holidayboxSubscriptionTypes[$dataf['subscriptiontype']] = $dataf['subscriptiontype'];
                    $totalTax =  number_format($dataf['baseTax'],2,'.','') * $dataf['qty'];
                    $lasttax =   number_format($holidayboxTaxarr[$dataf['subscriptiontype']],2,'.','');
                    $totalTaxes = number_format($lasttax +  $totalTax ,2,'.','');
                    $holidayboxTaxarr[$dataf['subscriptiontype']] = $totalTaxes;
                    $holidayboxTotal[$dataf['subscriptiontype']] = number_format(number_format($holidayboxTotal[$dataf['subscriptiontype']],2,'.','') + number_format($dataf['total'],2,'.','') ,2,'.','');
                    
		} else {
			
		
        array_push($storeidarrf, $dataf['sid']);
        array_push($productidarrf, $dataf['pid']);
        array_push($qtyarrf, $dataf['qty']);
		 array_push($taxarrf, $dataf['tax']);
		if($_SESSION['value_member_price_off'] > 0 && $dataf['section']=='food') {
			 $datatotal= number_format($dataf['price'] -($dataf['price'] * $_SESSION['value_member_price_off'] / 100),2);
			 $datatotal=number_format($datatotal*$dataf['qty'],2);
             $yousaved=$dataf['total']-$datatotal;
		     array_push($memberprodsavings,$yousaved);
			 array_push($subtotalf, $datatotal);
		} else {
			
	   
        array_push($subtotalf, $dataf['total']);
		}
		if(($_SESSION['case']==0 || $_SESSION['case']==1) && $dataf['section']=='food'){
		
		$member_price_off=$platinumplandetails->plan_extra_off_percentage;
		if ($_COOKIE['grocery_tab_index'] == 1) {
	   $member_price_off=$member_price_off+$platinumplandetails->plan_pickup_orders_off;
}
		$datatotal= number_format($dataf['price'] -($dataf['price'] * $member_price_off  / 100),2);
		$datatotal=number_format($datatotal*$dataf['qty'],2);
		$yousaved=$dataf['total']-$datatotal;
		     array_push($platinumprodsavings,$yousaved);
	    }
       
        array_push($deliverydatef, $dataf['deliveryDate']);
        array_push($deliveryfromtimef, $dataf['deliveryFromTime']);
        array_push($deliverytotimef, $dataf['deliveryToTime']);
        array_push($customf, $dataf['customize']);
        array_push($remarksf, $dataf['remarks']);
        array_push($addonIDsf, $dataf['addOnIDs']);
        
        if(isset($dataf['deliveryDateNext']) && isset($dataf['deliveryFromTimeNext']) && isset($dataf['deliveryToTimeNext'])){
           array_push($deliverydatenextf, $dataf['deliveryDateNext']);
           array_push($deliveryfromtimenextf, $dataf['deliveryFromTimeNext']);
           array_push($deliverytotimenextf, $dataf['deliveryToTimeNext']);
        }   
        else{
           array_push($deliverydatenextf, '');
           array_push($deliveryfromtimenextf, '');
           array_push($deliverytotimenextf, '');
				 }
        
        array_push($add_on_sizeids, $dataf['add_on_sizeids']);
        array_push($addonQtysf, $dataf['addOnQtys']);
        array_push($sizeIDf, $dataf['sizeID']);
        array_push($sectionf, $dataf['section']);
        
		if($dataf['section']=='sweetandsancks' || $dataf['section']=='just' || $dataf['section']=='rotikaa-kit' || $dataf['section']=='currybox' || $dataf['section']=='mangos' || $dataf['section']=='mithaas' || $dataf['section']=='tsalon' || $dataf['section']=='moments' || $dataf['section']=='madhu-chocolate' || $dataf['section']=='almond-house' || $dataf['section']=='baklava-premium-sweets' || $dataf['section']=='chai-box' || $dataf['section']=='sweedesi' || $dataf['section']=='shaheen-sweets'){
			//array_push($deliverytypef, $dataf['deliveryType']);
			
			if($dataf['section']=='moments'){
				array_push($recipentDetails, $dataf['recipentDetails']);
				if($dataf['deliveryType']!='')
				{
				array_push($deliverytypef, $dataf['deliveryType']);
				}
				
				if(!in_array($dataf['recipentDetails'], $uniqueRecipent)){
				  array_push($uniqueRecipent, $dataf['recipentDetails']);
				  
				}
				else{
					//array_push($deliverytypef, '');
				}
			}
			else{
				array_push($deliverytypef, $dataf['deliveryType']);
			}
			
		} else{
			//$dataf['deliverytype']='';
		
			array_push($deliverytypef, $dataf['deliverytype']);
		}
		
		array_push($subscriptiontypef, $dataf['subscriptiontype']);
		
		
		}
        $pickup_food = true;
    }
	//print_r($mealmestorearray);
	foreach ($cart_event as $datae) {
        //Product Removal Code Start
        // $prodDBCheckarr //pid, name, i, cart_food  
        $prdctItemTobeRemovedCheck = array(
            "pid" => $datae['pid'],
            "name" => $datae['name'],
            "section" => 'cart_events',
			"add_on_sizeide" => $datae['add_on_sizeids'],
			"addOnQtys" => $datae['addOnQtys'],
			"cartid" => $datae['cartid'],
            "indx" => $i
        );
        $i++;

        array_push($prodDBCheckarr, $prdctItemTobeRemovedCheck);
        //Product Removal Code Ends
		
        array_push($storeidarre, $datae['sid']);
        array_push($productidarre, $datae['pid']);
		array_push($eventtotatcalqty, $datae['totalcalcqty']);
        array_push($qtyarre, $datae['qty']);
		array_push($taxarre, $datae['tax']);
        array_push($subtotale, $datae['total']);
		array_push($cartid, $datae['cartid']);
		array_push($conveniencefeevalue, $datae['conveniencefeevalue']);
		array_push($servicefeeoneventlevel, $datae['servicefeevalue']);
        array_push($deliverydatee, $datae['deliveryDate']);
        array_push($deliveryfromtimee, $datae['deliveryFromTime']);
        array_push($deliverytotimee, $datae['deliveryToTime']);
        array_push($custome, $datae['customize']);
        array_push($remarkse, $datae['remarks']);
        array_push($add_on_sizeide, $datae['add_on_sizeids']);
        array_push($addonQtyse, $datae['addOnQtys']);
        array_push($sizeIDe, $datae['sizeID']);
        array_push($sectione, $datae['section']);
		
        $pickup_events = false;
    } foreach ($cart_puja as $datap) {
        //Product Removal Code Start
        // $prodDBCheckarr //pid, name, i, cart_food  
		
		$specificCouponData = array(
		  "pID" => $datap['pid'],
		  "storeID" => $datap['sid'],
          "sPrice" => $datap['price'],
		  "sQty" => $datap['qty']
		);
		array_push($specificCouponArrfpj, $specificCouponData);
		
		
        $prdctItemTobeRemovedCheck = array(
            "pid" => $datap['pid'],
            "name" => $datap['name'],
            "section" => 'cart_puja',
            "indx" => $i
        );
        $i++;
        array_push($prodDBCheckarr, $prdctItemTobeRemovedCheck);
        //Product Removal Code Ends
        array_push($storeidarrp, $datap['sid']);
        array_push($productidarrp, $datap['pid']);
        array_push($qtyarrp, $datap['qty']);
		array_push($taxarrp, $datap['tax']);
        array_push($subtotalp, $datap['total']);
        array_push($deliverydatep, $datap['deliveryDate']);
		array_push($deliverytodatep, $datap['deliveryToDate']);
		array_push($sevicetype, $datap['seviceType']);
		array_push($pujday, $datap['pujaDay']);
        array_push($deliveryfromtimep, $datap['deliveryFromTime']);
        array_push($deliverytotimep, $datap['deliveryToTime']);
        array_push($customp, $datap['customize']);
        array_push($remarksp, $datap['remarks']);
        array_push($addonQtysp, '');
        array_push($username, $datap['username']);
		array_push($useremail, $datap['useremail']);
		array_push($dob, $datap['dob']);
		array_push($birthplace, $datap['birthplace']);
		array_push($birthcountry, $datap['birthcountry']);
		array_push($questiontodiscussion, $datap['questiontodiscussion']);
		array_push($slotid, $datap['slotid']);
		array_push($sizeIDp, $datap['sizeID']);
        array_push($sectionp, $datap['section']);
        $pickup_puja = false;
    } 
	foreach ($cart_apparel as $dataa) {
        //Product Removal Code Start
        // $prodDBCheckarr //pid, name, i, cart_food  
		
		$specificCouponData = array(
		  "pID" => $dataa['pid'],
		  "storeID" => $dataa['sid'],
          "sPrice" => $dataa['price'],
		  "sQty" => $dataa['qty']
		);
		array_push($specificCouponArrfap, $specificCouponData);
		
		
        $prdctItemTobeRemovedCheck = array(
            "pid" => $dataa['pid'],
            "name" => $dataa['name'],
            "section" => 'cart_apparel',
            "indx" => $i
        );
        $i++;

        array_push($prodDBCheckarr, $prdctItemTobeRemovedCheck);
        //Product Removal Code Ends
		
        array_push($storeidarra, $dataa['sid']);
        array_push($productidarra, $dataa['pid']);
        array_push($qtyarra, $dataa['qty']);
		array_push($taxarra, $dataa['tax']);
        array_push($subtotala, $dataa['total']);
        array_push($deliverydatea, $dataa['deliveryDate']);
        array_push($deliveryfromtimea, $dataa['deliveryFromTime']);
        array_push($deliverytotimea, $dataa['deliveryToTime']);
        array_push($customa, $dataa['customize']);
        array_push($remarksa, $dataa['remarks']);
        array_push($sectiona, $dataa['section_type']);
		array_push($deliverytypea, 'free');
		
		
        $pickup_apparel = false;
    }
	  $pickup_giftcard = false;
    $i = 0;
    foreach ($cart_giftcard as $data) {
        //Product Removal Code Start
        //$prodDBCheckarr //pid, name, i, cart_giftcard
        $prdctItemTobeRemovedCheck = array(
            "randnum" => $data['randnum'],
            "pid" => $data['pid'],
            "name" => $data['name'],
            "section" => 'cart_giftcard',
            "indx" => $i
        );
        $i++;
        array_push($prodDBCheckarr, $prdctItemTobeRemovedCheck);
        //Product Removal Code Ends
        $pprice = ($data['price'] > 0 ? $data['price'] : 0);
        array_push($storeidarrgc, $data['sid']);
				array_push($productidarrgc, $data['pid']);
        array_push($qtyarrgc, $data['qty']);
        array_push($taxarrgc, $data['tax']);
        //array_push($subtotalgc, $data['total']);
        array_push($subtotalgc, $data['qty']*$pprice);
        array_push($unitpricegc, $pprice);
        array_push($cardtypegc, $data['cardtype']);
        array_push($cardcatgc, $data['cardcat']);
        $pickup_giftcard = true;
    }
		
     foreach ($seasoningSubscriptionTypes as $seasoningSubscriptionType) {
       /* $_SESSION['seasoningaddonProduct'] = implode(",", $seasoningaddonProduct[$seasoningSubscriptionType]);
        $_SESSION['seasoningaddonQty'] = implode(",", $seasoningaddonQty[$seasoningSubscriptionType]);
        $_SESSION['seasoningaddonsizeID'] = implode(",", $seasoningaddonsizeID[$seasoningSubscriptionType]);
        $_SESSION['seasoningaddonremarks'] = implode(",", $seasoningaddonremarks[$seasoningSubscriptionType]);
        $_SESSION['seasoningaddoncustomize'] = implode(",", $seasoningaddoncustomize[$seasoningSubscriptionType]);
        */
        $custmremarks =  implode(",",$seasoningaddonremarks[$seasoningSubscriptionType]);
        $dataf['add_on_sizeids'] = implode(",", $seasoningaddonsizeID[$seasoningSubscriptionType]);
         $dataf['deliveryToTime'] = '';
        $dataf['deliveryFromTime'] = '';
        $dataf['sizeID'] =  '';
		//$dataf['deliverytype'] =  '';
        $dataf['section'] = 'seasoning';
        $dataf['addOnIDs'] = implode(",", $seasoningaddonProduct[$seasoningSubscriptionType]);
        $dataf['addOnQtys'] = implode(",", $seasoningaddonQty[$seasoningSubscriptionType]);
        $dataf['subscriptiontype'] = $seasoningSubscriptionType;
        array_push($storeidarrf, $seasoningStoreId);
        array_push($productidarrf, $seasoningMainpid);
        array_push($qtyarrf, 1);   
        array_push($taxarrf, $seasoningTaxarr[$seasoningSubscriptionType]);
        array_push($subtotalf, $seasoningTotal[$seasoningSubscriptionType]);
        array_push($deliverydatef, $seasoningCommondeliveryDate);
        array_push($deliveryfromtimef, $dataf['deliveryFromTime']);
        array_push($deliverytotimef, $dataf['deliveryToTime']);
        array_push($customf, $custmremarks);
        array_push($remarksf, $custmremarks);
        array_push($addonIDsf, $dataf['addOnIDs']);
        array_push($add_on_sizeids, $dataf['add_on_sizeids']);
        array_push($addonQtysf, $dataf['addOnQtys']);
        array_push($sizeIDf, $dataf['sizeID']);
        array_push($sectionf, $dataf['section']);
		array_push($deliverytypef, $dataf['deliverytype']);
        array_push($subscriptiontypef, $dataf['subscriptiontype']);
    }
	 foreach ($kimbalaboxSubscriptionTypes as $kimbalaboxSubscriptionType) {
       
        $custmremarks =  implode(",",$kimbalaboxaddonremarks[$kimbalaboxSubscriptionType]);
        $dataf['add_on_sizeids'] = implode(",", $kimbalaboxaddonsizeID[$kimbalaboxSubscriptionType]);
         $dataf['deliveryToTime'] = '';
        $dataf['deliveryFromTime'] = '';
        $dataf['sizeID'] =  '';
		$dataf['deliverytype'] =  '';
        $dataf['section'] = 'kimbalabox';
        $dataf['addOnIDs'] = implode(",", $kimbalaboxaddonProduct[$kimbalaboxSubscriptionType]);
        $dataf['addOnQtys'] = implode(",", $kimbalaboxaddonQty[$kimbalaboxSubscriptionType]);
        $dataf['subscriptiontype'] = $kimbalaboxSubscriptionType;
        array_push($storeidarrf, $kimbalaboxStoreId);
        array_push($productidarrf, $kimbalaboxMainpid);
        array_push($qtyarrf, 1);   
        array_push($taxarrf, $kimbalaboxTaxarr[$kimbalaboxSubscriptionType]);
        array_push($subtotalf, $kimbalaboxTotal[$kimbalaboxSubscriptionType]);
        array_push($deliverydatef, $kimbalaboxCommondeliveryDate);
        array_push($deliveryfromtimef, $dataf['deliveryFromTime']);
        array_push($deliverytotimef, $dataf['deliveryToTime']);
        array_push($customf, $custmremarks);
        array_push($remarksf, $custmremarks);
        array_push($addonIDsf, $dataf['addOnIDs']);
        array_push($add_on_sizeids, $dataf['add_on_sizeids']);
        array_push($addonQtysf, $dataf['addOnQtys']);
        array_push($sizeIDf, $dataf['sizeID']);
        array_push($sectionf, $dataf['section']);
		array_push($deliverytypef, $dataf['deliverytype']);
        array_push($subscriptiontypef, $dataf['subscriptiontype']);
    }	
     foreach ($holidayboxSubscriptionTypes as $holidayboxSubscriptionType) {
     
        $custmremarks =  implode(",",$holidayboxaddonremarks[$holidayboxSubscriptionType]);
        $dataf['add_on_sizeids'] = implode(",", $holidayboxaddonsizeID[$holidayboxSubscriptionType]);
        $dataf['deliveryToTime'] = '';
        $dataf['deliveryFromTime'] = '';
        $dataf['sizeID'] =  '';
	    $dataf['deliverytype'] =  $holidayboxdeliveryType[$holidayboxSubscriptionType][0];
        $dataf['section'] = 'holidaygiftbox';
        $dataf['addOnIDs'] = implode(",", $holidayboxaddonProduct[$holidayboxSubscriptionType]);
        $dataf['addOnQtys'] = implode(",", $holidayboxaddonQty[$holidayboxSubscriptionType]);
        $dataf['subscriptiontype'] = $holidayboxSubscriptionType;
        array_push($storeidarrf, $holidayboxStoreId);
        array_push($productidarrf, $holidayboxMainpid);
        array_push($qtyarrf, 1);   
        array_push($taxarrf, $holidayboxTaxarr[$holidayboxSubscriptionType]);
        array_push($subtotalf, $holidayboxTotal[$holidayboxSubscriptionType]);
        array_push($deliverydatef, $holidayboxCommondeliveryDate);
        array_push($deliveryfromtimef, $dataf['deliveryFromTime']);
        array_push($deliverytotimef, $dataf['deliveryToTime']);
        array_push($customf, $custmremarks);
        array_push($remarksf, $custmremarks);
        array_push($addonIDsf, $dataf['addOnIDs']);
        array_push($add_on_sizeids, $dataf['add_on_sizeids']);
        array_push($addonQtysf, $dataf['addOnQtys']);
        array_push($sizeIDf, $dataf['sizeID']);
        array_push($sectionf, $dataf['section']);
		array_push($deliverytypef, $dataf['deliverytype']);
        array_push($subscriptiontypef, $dataf['subscriptiontype']);
    }	
     
    $_SESSION['cart_food'] = $cart_food;
	$_SESSION['cart_event'] = $cart_event;
	$_SESSION['cart_puja'] = $cart_puja;
	$_SESSION['cart_apparel'] = $cart_apparel;
    $_SESSION['cart_giftcard'] = $cart_giftcard;

    $storeidarrg = array_unique($storeidarrg);
	$storeidblackfriday=array_unique($storeidblackfriday);
	$foodsarrayon = array_unique($foodsarrayon);
	$chefidarrg = array_unique($chefidarrg);
    $subtotalg = array_sum($subtotalg);
    $taxarrg = number_format(array_sum($taxarrg), 2,'.','');
    $memberprodsavings=number_format(array_sum($memberprodsavings), 2,'.','');
	$platinumprodsavings=number_format(array_sum($platinumprodsavings), 2,'.','');
	$_SESSION['mealmestorearray'] = $mealmestorearray;
    $_SESSION['productidarrg'] = $productidarrg;
	$_SESSION['chefidarrg'] = $chefidarrg;
	$_SESSION['chefData'] = $chefData;
	$_SESSION['uremarksf'] = $uremarksf;
    $_SESSION['subtotalg'] = $subtotalg;
    $_SESSION['qtyarrg'] = $qtyarrg;
    $_SESSION['sourcegrocery'] = $sourcegrocery;
    $_SESSION['taxarrg'] = $taxarrg;
    $_SESSION['storeidarrg'] = $storeidarrg;
	$_SESSION['storeidblackfriday'] = $storeidblackfriday;
	
	$_SESSION['foodsarrayon'] = $foodsarrayon;
	
	$_SESSION['specificCouponArrg']=$specificCouponArrg;
    $_SESSION['specificCouponArrf']=$specificCouponArrf;
	$_SESSION['specificCouponArrfpj']=$specificCouponArrfpj;
	$_SESSION['specificCouponArrfap']=$specificCouponArrfap;
	$_SESSION['prodPriceDBCheckarr']=$prodPriceDBCheckarr;

	$_SESSION['memberprodsavings'] = $memberprodsavings;
    $_SESSION['platinumprodsavings'] = $platinumprodsavings;

		// Code for Gift Card 
    $storeidarrgc = array_unique($storeidarrgc);
    $subtotalgc = array_sum($subtotalgc);
    $taxarrgc = number_format(array_sum($taxarrgc), 2,'.','');

    $_SESSION['productidarrgc'] = $productidarrgc;
    $_SESSION['subtotalgc'] = $subtotalgc;
    $_SESSION['qtyarrgc'] = $qtyarrgc;
    $_SESSION['taxarrgc'] = $taxarrgc;
    $_SESSION['storeidarrgc'] = $storeidarrgc;
    $_SESSION['cardtypegc'] = $cardtypegc;
    $_SESSION['cardcatgc'] = $cardcatgc;
    $_SESSION['unitpricegc'] = $unitpricegc;

    $storeidarrf = array_unique($storeidarrf);
    $subtotalf = array_sum($subtotalf);
    $taxarrf = number_format(array_sum($taxarrf), 2,'.','');

    $_SESSION['productidarrf'] = $productidarrf;
    $_SESSION['subtotalf'] = $subtotalf;
    $_SESSION['qtyarrf'] = $qtyarrf;
    $_SESSION['taxarrf'] = $taxarrf;
    $_SESSION['storeidarrf'] = $storeidarrf;
    $_SESSION['deliverydatef'] = $deliverydatef;
    $_SESSION['deliveryfromtimef'] = $deliveryfromtimef;
    $_SESSION['deliverytotimef'] = $deliverytotimef;
    
    $_SESSION['deliverydatenextf'] = $deliverydatenextf;
    $_SESSION['deliveryfromtimenextf'] = $deliveryfromtimenextf;
    $_SESSION['deliverytotimenextf'] = $deliverytotimenextf;
    
    $_SESSION['customf'] = $customf;
    $_SESSION['remarksf'] = $remarksf;
	$_SESSION['subscriptiontypef'] = $subscriptiontypef;
    $_SESSION['addonIDsf'] = $addonIDsf;
    $_SESSION['add_on_sizeids'] = $add_on_sizeids;
    $_SESSION['addonQtysf'] = $addonQtysf;
    $_SESSION['sizeIDf'] = $sizeIDf;
    $_SESSION['sectionf'] = $sectionf;
    $_SESSION['deliverytypef'] =$deliverytypef;
    $_SESSION['recipentDetails'] =$recipentDetails;
	
	// Code for Event 
    $storeidarre = array_unique($storeidarre);
	//print_r($subtotale);
    $subtotale = array_sum($subtotale);
	$conveniencefeevalue = array_sum($conveniencefeevalue);
    $taxarre = number_format(array_sum($taxarre), 2,'.','');
	$servicefeeoneventlevel = number_format(array_sum($servicefeeoneventlevel), 2,'.','');
	
	$eventtotatcalqty = array_sum($eventtotatcalqty);
	$_SESSION['cartid'] = $cartid;
    $_SESSION['productidarre'] = $productidarre;
    $_SESSION['subtotale'] = $subtotale;
	$_SESSION['conveniencefeevalue'] = $conveniencefeevalue;
    $_SESSION['qtyarre'] = $qtyarre;
	$_SESSION['eventtotatcalqty'] =$eventtotatcalqty;
	
    $_SESSION['taxarre'] = $taxarre;
	$_SESSION['servicefeeoneventlevel'] = $servicefeeoneventlevel;
    $_SESSION['storeidarre'] = $storeidarre;
    $_SESSION['deliverydatee'] = $deliverydatee;
    $_SESSION['deliveryfromtimee'] = $deliveryfromtimee;
    $_SESSION['deliverytotimee'] = $deliverytotimee;
    $_SESSION['custome'] = $custome;
    $_SESSION['remarkse'] = $remarkse;
    $_SESSION['add_on_sizeide'] = $add_on_sizeide;
    $_SESSION['addonQtyse'] = $addonQtyse;
    $_SESSION['sizeIDe'] = $sizeIDe;
    $_SESSION['sectione'] = $sectione;
    $_SESSION['deliverytypee'] =$deliverytypee;

	// Code for Puja 
    $storeidarrp = array_unique($storeidarrp);
	//print_r($subtotale);
    $subtotalp = array_sum($subtotalp);;
    $taxarrp = number_format(array_sum($taxarrp), 2,'.','');
    $_SESSION['productidarrp'] = $productidarrp;
    $_SESSION['subtotalp'] = $subtotalp;
	$_SESSION['conviencefeesubtotalp'] = $conviencefeesubtotalp;
    $_SESSION['qtyarrp'] = $qtyarrp;
    $_SESSION['taxarrp'] = $taxarrp;
    $_SESSION['storeidarrp'] = $storeidarrp;
    $_SESSION['deliverydatep'] = $deliverydatep;
	$_SESSION['deliverytodatep'] = $deliverytodatep;
	$_SESSION['sevicetype'] = $sevicetype;
	$_SESSION['pujday'] = $pujday;
    $_SESSION['deliveryfromtimep'] = $deliveryfromtimep;
    $_SESSION['deliverytotimep'] = $deliverytotimep;
    $_SESSION['customp'] = $customp;
    $_SESSION['remarksp'] = $remarksp;
    $_SESSION['add_on_sizeidp'] = $add_on_sizeidp;
    $_SESSION['addonQtysp'] = $addonQtysp;
    $_SESSION['sizeIDp'] = $sizeIDp;
    $_SESSION['sectionp'] = $sectionp;
    $_SESSION['username'] =$username;
	$_SESSION['useremail'] =$useremail;
	$_SESSION['dob'] =$dob;
	$_SESSION['birthplace'] =$birthplace;
	$_SESSION['birthcountry'] =$birthcountry;
	$_SESSION['questiontodiscussion'] =$questiontodiscussion;
	$_SESSION['slotid'] =$slotid;
		
	$_SESSION['deliverytypep'] =$deliverytypep;
	
	// Code for Apparel 
    $storeidarra = array_unique($storeidarra);
    $subtotala = array_sum($subtotala);;
    $taxarra = number_format(array_sum($taxarra), 2,'.','');
    $_SESSION['productidarra'] = $productidarra;
    $_SESSION['subtotala'] = $subtotala;
    $_SESSION['qtyarra'] = $qtyarra;
    $_SESSION['taxarra'] = $taxarra;
    $_SESSION['storeidarra'] = $storeidarra;
    $_SESSION['deliverydatea'] = $deliverydatea;
    $_SESSION['deliveryfromtimea'] = $deliveryfromtimea;
    $_SESSION['deliverytotimea'] = $deliverytotimea;
    $_SESSION['customa'] = $customa;
    $_SESSION['remarksa'] = $remarksa;
    $_SESSION['sectiona'] = $sectiona;
	$_SESSION['deliverytypea'] =$deliverytypea;
	 
}


$productidarrf = $_SESSION['productidarrf'];
$subtotalf = number_format($_SESSION['subtotalf'], 2, '.', '');
$taxarrf = number_format($_SESSION['taxarrf'], 2,'.','');
$storeidarrf = $_SESSION['storeidarrf'];
$qtyarrf = $_SESSION['qtyarrf'];

$productidarre = $_SESSION['productidarre'];
$subtotale = number_format($_SESSION['subtotale'], 2, '.', '');
$conveniencefeevalue = number_format($_SESSION['conveniencefeevalue'], 2, '.', '');
$cartid = $_SESSION['cartid'];
$taxarre = number_format($_SESSION['taxarre'], 2,'.','');
$servicefeeoneventlevel = number_format($_SESSION['servicefeeoneventlevel'], 2,'.','');
$storeidarre = $_SESSION['storeidarre'];
$qtyarre = $_SESSION['qtyarre'];
$eventtotatcalqty = $_SESSION['eventtotatcalqty'];


// Code for Apparel
$productidarra = $_SESSION['productidarra'];
$subtotala= number_format($_SESSION['subtotala'], 2, '.', '');
$taxarra = number_format($_SESSION['taxarra'], 2,'.','');
$storeidarra = $_SESSION['storeidarra'];
$qtyarra = $_SESSION['qtyarra'];

$productidarrp = $_SESSION['productidarrp'];
$subtotalp = number_format($_SESSION['subtotalp'], 2, '.', '');
$taxarrp = number_format($_SESSION['taxarrp'], 2,'.','');
$storeidarrp = $_SESSION['storeidarrp'];
$qtyarrp = $_SESSION['qtyarrp'];

$productidarrg = $_SESSION['productidarrg'];
$mealmestorearray=$_SESSION['mealmestorearray'];
$chefidarrg = $_SESSION['chefidarrg'];

$specificCouponArrg = $_SESSION['specificCouponArrg'];
$specificCouponArrf = $_SESSION['specificCouponArrf'];
$specificCouponArrfpj = $_SESSION['specificCouponArrfpj'];
$specificCouponArrfap = $_SESSION['specificCouponArrfap'];
$foodsarrayon = $_SESSION['foodsarrayon'];

$prodPriceDBCheckarr = $_SESSION['prodPriceDBCheckarr'];
$subtotalg = number_format($_SESSION['subtotalg'], 2, '.', '');
$taxarrg = number_format($_SESSION['taxarrg'], 2,'.','');
$storeidarrg = $_SESSION['storeidarrg'];
$storeidblackfriday = $_SESSION['storeidblackfriday'];
$qtyarrg = $_SESSION['qtyarrg'];
$sourcegrocery = $_SESSION['sourcegrocery'];
$deliverydatef = $_SESSION['deliverydatef'];
$deliveryfromtimef = $_SESSION['deliveryfromtimef'];
$deliverytotimef = $_SESSION['deliverytotimef'];

$deliverydatee = $_SESSION['deliverydatee'];
$deliveryfromtimee = $_SESSION['deliveryfromtimee'];
$deliverytotimee = $_SESSION['deliverytotimee'];

// Code for Apparel
$deliverydatea = $_SESSION['deliverydatea'];
$deliveryfromtimea = $_SESSION['deliveryfromtimea'];
$deliverytotimea = $_SESSION['deliverytotimea'];

$deliverydatep = $_SESSION['deliverydatep'];
$deliverytodatep = $_SESSION['deliverytodatep'];
$sevicetype = $_SESSION['sevicetype'];
$pujday = $_SESSION['pujday'];
$deliveryfromtimep = $_SESSION['deliveryfromtimep'];
$deliverytotimep = $_SESSION['deliverytotimep'];

$deliverydatenextf = $_SESSION['deliverydatenextf'];
$deliveryfromtimenextf = $_SESSION['deliveryfromtimenextf'];
$deliverytotimenextf = $_SESSION['deliverytotimenextf'];

$customf = $_SESSION['customf'];
$remarksf =  $_SESSION['remarksf'];
$subscriptiontypef = $_SESSION['subscriptiontypef'];
 $deliverytypef=$_SESSION['deliverytypef'];
$uremarksf = $_SESSION['uremarksf'];
$addonIDsf = $_SESSION['addonIDsf'];
$addonQtysf = $_SESSION['addonQtysf'];
$sizeIDf = $_SESSION['sizeIDf'];
$sectionf = $_SESSION['sectionf'];
$add_on_sizeids = $_SESSION['add_on_sizeids'];
$memberprodsavings=$_SESSION['memberprodsavings'];
$platinumprodsavings=$_SESSION['platinumprodsavings'];

$custome = $_SESSION['custome'];
$remarkse =  $_SESSION['remarkse'];
$subscriptiontypee = $_SESSION['subscriptiontypee'];
$deliverytypee=$_SESSION['deliverytypee'];
$uremarkse = $_SESSION['uremarkse'];
$addonIDse = $_SESSION['addonIDse'];
$addonQtyse = $_SESSION['addonQtyse'];
$sizeIDe = $_SESSION['sizeIDe'];
$sectione = $_SESSION['sectione'];
$add_on_sizeidse = $_SESSION['add_on_sizeidse'];

// Code for Apparel
$customa = $_SESSION['customa'];
$remarksa =  $_SESSION['remarksa'];
$subscriptiontypea = $_SESSION['subscriptiontypea'];
$deliverytypea=$_SESSION['deliverytypea'];
$uremarksa = $_SESSION['uremarksa'];
$sectiona = $_SESSION['sectiona'];


$customp = $_SESSION['customp'];
$remarksp =  $_SESSION['remarksp'];
$deliverytypep=$_SESSION['deliverytypep'];
$uremarksp = $_SESSION['uremarksp'];
$addonIDsp = $_SESSION['addonIDsp'];
$addonQtysp = $_SESSION['addonQtysp'];
$sizeIDp = $_SESSION['sizeIDp'];
$sectionp = $_SESSION['sectionp'];
$add_on_sizeidsp = $_SESSION['add_on_sizeidsp'];

// Code for Gift Card
$productidarrgc = $_SESSION['productidarrgc'];
$subtotalgc = number_format($_SESSION['subtotalgc'], 2, '.', '');
$taxarrgc = number_format($_SESSION['taxarrgc'], 2,'.','');
$storeidarrgc = $_SESSION['storeidarrgc'];
$qtyarrgc = $_SESSION['qtyarrgc'];
$foodsarrayoncheck=array_unique(array_merge($storeidarrg,$foodsarrayon));
$productidarr = array_merge($productidarrg, $productidarrf, $productidarrgc, $productidarre, $productidarrp, $productidarra);

$chefidarrg = $chefidarrg;
$specificCouponArrg = $specificCouponArrg;
$specificCouponArrf = $specificCouponArrf;
$specificCouponArrfpj = $specificCouponArrfpj;
$specificCouponArrfap = $specificCouponArrfap;
$storeidarr = array_unique(array_merge($storeidarrg, $storeidarrf, $storeidarrgc, $storeidarre,$storeidarrp,$storeidarra));

$specificCouponArr = array_merge($specificCouponArrg, $specificCouponArrf,$specificCouponArrfpj,$specificCouponArrfap);
$qtyarr = array_merge($qtyarrg, $qtyarrf, $qtyarrgc, $qtyarre,$qtyarrp,$qtyarra);
$taxtotal = $taxarrg + $taxarrf + $taxarrgc + $taxarre + $taxarrp+ $taxarra;
$eservicefee=0;
$econveniencefee=0;
if($subtotale>0){
 $eservicefee=$servicefeeoneventlevel;
 $econveniencefee=$conveniencefeevalue;
 
}
$eservicefeeglobal=0;
if($_SESSION['platform_service_fees']>0){
    $subtotalforplatformfee = $subtotalg + $subtotalf + $subtotalp + $subtotala;
	$eservicefeeglobal=number_format(($subtotalforplatformfee/100)*$_SESSION['platform_service_fees'], 2, '.', '');
}
$eservicefee=$eservicefee+$eservicefeeglobal;
$_SESSION['econveniencefee'] = $econveniencefee;
$_SESSION['eservicefee'] = $eservicefee;
$subtotal = $subtotalg + $subtotalf + $subtotalgc + $subtotale + $subtotalp + $subtotala;
$_SESSION['subtotal'] = $subtotal;
$memberprodsavings=$_SESSION['memberprodsavings'];
$platinumprodsavings=$_SESSION['platinumprodsavings'];
if($_SESSION['value_user_id']!='' && $_SESSION['value_plan_id']>0 && isset($_SESSION['value_user_type']) && $_SESSION['value_user_type'] == '0'){
	
$tokenData = callAPI('POST', WEBAPI_URL_NEW.'login',array("email"=>"[email protected]", "password"=>"cgcptcu97b"));
$apitoken = $tokenData->token; 
$token=$apitoken;
$uid=$_SESSION['value_user_id'];
$resultqcoupons = callAPI('POST', WEBAPI_URL_NEW.'quicklly-pass/get-checkout-coupons', array('zipcode' => $zip, 'uid'=> $uid, 'token'=>$token));$lstqcount=count($resultqcoupons->lstCoupons);
if($lstqcount>0){

$qpr=0;	
foreach($resultqcoupons->lstCoupons as $lstItem) {
	if ($lstItem->minAmt <= $subtotal && $qpr==0) {
		$qpassdefaultcouponcode=$lstItem->code;
		
        }
		array_push($qpasscouponarray,$lstItem);
$qpr++;
}

}
}
if(count($storeidarr)==0){
	unset($_SESSION['discountCoupon']);
        unset($_SESSION['discountcouponvalue']);
}
if ($_SESSION['discountCoupon'] != '') {
/*
    $discArr = $obj->query("select minimum_purchase,coupon_code,discount,discount_type from tbl_coupon where id='" . $_SESSION['discountCoupon'] . "' and status=1 ");
    $rsCoup = $obj->fetchNextObject($discArr);
    if ($rsCoup->minimum_purchase > $subtotal) {

        unset($_SESSION['discountCoupon']);
        unset($_SESSION['discountcouponvalue']);
		unset($_SESSION['couponStoreTotal']);//disc cp
		unset($_SESSION['couponcode']);
    } else {
		$_SESSION['couponcode']=$rsCoup->coupon_code;
		 
	//echo 'couponStoreTotal='.$_SESSION['couponStoreTotal'];
	if(!empty($_SESSION['couponStoreTotal'])){
		$couponStoreTotal =$_SESSION['couponStoreTotal'];
	}else{
		$couponStoreTotal =$subtotal;
	}
    if ($rsCoup->discount_type == 'Percent') {
		
			//die;	
        $ediscount = ($couponStoreTotal * $rsCoup->discount) / 100;
        $_SESSION['discountcouponvalue'] = $ediscount;
        $ediscount = $_SESSION['discountcouponvalue'];
    } if ($rsCoup->discount_type == 'Direct') {
		if(!empty($_SESSION['couponStoreTotal'])){
			if($rsCoup->discount > $_SESSION['couponStoreTotal']) {
			$rsCoup->discount=$_SESSION['couponStoreTotal'];	
			}
		}else {
			if($rsCoup->discount > $subtotal) {
			$rsCoup->discount=$subtotal;	
			}
		}
			
        $ediscount = $rsCoup->discount;
        $_SESSION['discountcouponvalue'] = $ediscount;
        $ediscount = $_SESSION['discountcouponvalue'];
    }
		
		
	} */
}
if ($_SESSION['discountreward'] > $subtotal) {
     unset($_SESSION['discountreward']);
}
if ($_SESSION['discountWallet'] > $subtotal) {
     unset($_SESSION['discountWallet']);
}
//Product Removal Code Start
$productidForupdateprice = array();
if(count($prodPriceDBCheckarr)>0){
	
if(!isset($_COOKIE['postalcode']) || trim($_COOKIE['postalcode']) == '') {
	$zip=60610;
} else {
$zip=$_COOKIE['postalcode'];
}
$tokenData = callAPI('POST', WEBAPI_URL_NEW.'login',array("email"=>"[email protected]", "password"=>"cgcptcu97b"));
$apitoken = $tokenData->token; 
$token=$apitoken;
$todayorrderlistarray['token']=$token;
$todayorrderlistarray['zipcode']=$zip;
$todayorrderlistarray['lstProds']=$prodPriceDBCheckarr;
$data=json_encode($todayorrderlistarray);

$apiurl = WEBAPI_URL_NEW.'common/check-products';

                    // Create a new cURL resource
                           $ch = curl_init($apiurl);

                           // Setup request to send json via POST

                           $payload =$data;

                          // Attach encoded JSON string to the POST fields
                         curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);

                          // Set the content type to application/json
                         curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));

                          // Return response instead of outputting
                         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

                          // Execute the POST request
                       $result = curl_exec($ch);
                      $result=json_decode($result, true);
                        
                       
//$result = callAPI('POST', WEBAPI_URL.'common/check-products', array('zipcode' => $zip,'lstProds' => $prodPriceDBCheckarr,'token'=>$token));

if(count($result['lstPriceChange'])>0){

	$removedProductpriceLst = "<p class='pfirsthead'>The Price of the following items has changed!</p><p class='psecondhead'>Please review the price before checkout.</p>";
$removedProductpriceLst  .="<ul>";
	foreach($result['lstPriceChange'] as $key=>$value){
      $pid=$value['pid'];
	  $name=$value['name'];
	  $cost=$value['cost'];
	  $latest_cost=$value['latest_cost'];
	  $latest_tax=$value['latest_tax'];
	 $removedProductpriceLst  .="<li><p class='pname'>$name</p><p class='pchange'>Price Changed from $website_currency_symbol.$cost to $website_currency_symbol.$latest_cost</p><p class='premovebutton'><button class='premoveitembtn' type='button' onclick=removeproductbyidandsection($pid,'grocery')>Remove Item</button></p><hr></li>";
	 array_push($productidForupdateprice,$value);
}
$removedProductpriceLst .="</ul>";
}
curl_close($ch);
// Close cURL resource
}

$productidarrNotPresent = array();
$removedProductLst = "<p>Some items in your cart are no longer available.<br> These items have been removed from your cart.</p>";
$removedProductLst  .="<ul>";
foreach ($prodDBCheckarr as $key => $prods){   
    $prodid = $prods['pid'];
    $prodname = $prods['name'];
    $prodsect = $prods['section'];
    $prodSecQupte = '"'.$prodsect.'"';
    $prodinx = $prods['indx'];
    $flgNotFound = false;

    //echo "SELECT p.product_name, p.status, pp.in_stock FROM tbl_product p LEFT JOIN tbl_productprice pp ON p.id = pp.product_id AND pp.in_stock = 1 AND pp.status = 1 WHERE p.id = $prodid AND p.status = 1 AND pp.in_stock=1 <br>";
	if($prodsect=='cart_events'){
	$stmt = $obj->query("SELECT p.product_name, p.storeid,p.product_section FROM tbl_product p LEFT JOIN tbl_productprice pp ON p.id = pp.product_id left join tbl_event_meta e on e.prod_id=p.id AND pp.in_stock = 1 AND pp.status = 1 WHERE p.id = $prodid AND p.status = 1 and e.status and e.event_to_date >= CURDATE()");	
	
	 if ($obj->numRows($stmt) == 0){
        $flgNotFound = true;
	 } else {
        $prodSearch = $obj->fetchNextObject($stmt);
        $stmt = $obj->query("select storename from stores left join tbl_store_zip on stores.storeid=tbl_store_zip.storeid where stores.status=1 and tbl_store_zip.status=1 and tbl_store_zip.zone_status=1 and tbl_store_zip.store_status=1 and (stores.by_pass_zipcode = 1 OR tbl_store_zip.zip='".$_COOKIE['postalcode']."') and stores.storeid=" . $prodSearch->storeid);

        if ($obj->numRows($stmt) == 0) {
            $flgNotFound = true;
		} else {
			$eaddonsizeid=explode(',',$prods['add_on_sizeide']);
			$eaddonqty=explode(',',$prods['addOnQtys']);
			$ecartid=$prods['cartid'];
			for ($i=0; $i < count($eaddonsizeid); $i++){ 
                                // Get size data
								$addOnData = $obj->query("SELECT size,max_qty FROM `tbl_productaddon` WHERE tbl_productaddon.id = " . $eaddonsizeid[$i] ." ");
								$addOnDataResult = $obj->fetchNextObject($addOnData);
                                if($obj->numRows($addOnData) == 0){
                                    $flgNotFound = true;
                                    break;
                                }
                                else if($eaddonqty[$i] > $addOnDataResult->max_qty){
                                    $flgNotFound = true;
                                    break;
                                }
                                else{
                                    // Remove expired cart
									$currenttime=date('Y-m-d H:i:s');
									$sqltempeventcart="DELETE FROM tbl_event_tmp_cart WHERE valid_till < '".$currenttime ."'";
									$addOnData = $obj->query("SELECT size,max_qty FROM `tbl_productaddon` WHERE tbl_productaddon.id = " . $eaddonsizeid[$i] ." ");
								$addOnDataResult = $obj->fetchNextObject($addOnData);
                                    // Get locked qty
                                    $queryGetlockedqty = "  SELECT 	SUM(i.qty) locked_qty, i.size_id
                                                FROM 	tbl_event_tmp_cart_items i
                                                        INNER JOIN tbl_event_tmp_cart c ON c.id = i.cart_id
                                                WHERE	i.size_id =" .$eaddonsizeid[$i]."  AND c.valid_till >='".$currenttime."' AND c.id <> '" .$ecartid."'";
                                    $tmpQty = $obj->query($queryGetlockedqty);
                                    $tmpQtyR = $obj->fetchNextObject($tmpQty);
                                    if($tmpQtyR->locked_qty != null)
                                      $addOnDataResult->size = $addOnDataResult->size - $tmpQtyR->locked_qty;
                                    if($eaddonqty[$i] > $addOnDataResult->size){
                                        $flgNotFound = true;
                                        break;
                                    }
                                }
                            }
			
			$eaddonsizeid=explode(',',$prods['add_on_sizeide']);
			$eaddonqty=explode(',',$prods['addOnQtys']);
			for ($i=0; $i < count($eaddonsizeid); $i++){ 
			$sqladdon = $obj->query("SELECT size FROM `tbl_productaddon` WHERE tbl_productaddon.id = " . $eaddonsizeid[$i] ." ");
		    $addonqty=$eaddonqty[$i];
             $sqladdOnResult = $obj->fetchNextObject($sqladdon);
			 $remainingqty=$sqladdOnResult->size-$addonqty;
			 if($remainingqty<0){
				 $flgNotFound = true;
                 break;				 
			 }
			 
			}
		}
    }
	
	} else {
    $stmt = $obj->query("SELECT p.product_name, p.storeid FROM tbl_product p LEFT JOIN tbl_productprice pp ON p.id = pp.product_id AND pp.in_stock = 1 AND pp.status = 1 WHERE p.id = $prodid AND p.status = 1");

    if ($obj->numRows($stmt) == 0)
        $flgNotFound = true;
    else {
        $prodSearch = $obj->fetchNextObject($stmt);
        $stmt = $obj->query("select storename from stores left join tbl_store_zip on stores.storeid=tbl_store_zip.storeid where stores.status=1 and tbl_store_zip.status=1 and tbl_store_zip.zone_status=1 and tbl_store_zip.store_status=1 and (stores.by_pass_zipcode = 1 OR tbl_store_zip.zip='".$_COOKIE['postalcode']."') and stores.storeid=" . $prodSearch->storeid);

        if ($obj->numRows($stmt) == 0)
            $flgNotFound = true;
    }
	}
    if($flgNotFound){
        $removedProductLst  .="<li>$prodname</li>";
        array_push($productidarrNotPresent,$prods);
    }
}
$removedProductLst .="</ul>";


//Product Removal Code Ends

/* if($subtotal < '0.01' || empty($productidarr) || empty($qtyarr) || empty($storeidarr)){
  setcookie('flgRefreshCart', "0", time()-3600, "/"); // 86400 = 1 day
  //die();
  header("location:checkout");
  exit();
  } */

/*
  print_r($storeidarr);
  print_r($_SESSION['subtotal']);
  print_r($productidarr);
 */
 $sAmt = s_group_by_arr_key($specificCouponArr, 'storeID');
if ($_REQUEST['removecoupon_code'] == 'yes') {
   
  unset($_SESSION['discountCoupon']);
unset($_SESSION['discountcouponvalue']);
	  unset($_SESSION['couponStoreTotal']);//disc cp
	  unset($_SESSION['couponcode']);
	 setcookie('qpassremoveflag', "1",  time() + (86400 * 30 * 12), "/"); // 86400 = 1 day
}
if ($_SESSION['value_user_id'] != '') {
   // $userarr = $obj->query("select * from tbl_user where status=1 and id='" . $_SESSION['value_user_id'] . "'");
   // $resultuser = $obj->fetchNextObject($userarr);
   $resultusers=callAPI('POST', WEBAPI_URL_NEW.'miniuser/Login-User-Detail',array("userid"=>$_SESSION['value_user_id']));
		foreach($resultusers->lstuser as $resultuser){
	    
	}
}
//coupon,rewards, wallet starts
if ($_REQUEST['apply_coupon'] == 'Yes') {
    $resultusers=callAPI('POST', WEBAPI_URL_NEW.'/checkout/check-coupon',array("uid"=>$_SESSION['value_user_id'],'coupon'=>$_REQUEST['coupon'],'zipcode'=>$_COOKIE['postalcode'],'subTotal'=>$_REQUEST['hdnCartTotal'],'storeId'=>'111167','sectionId'=>'38','storeAmount'=>$_REQUEST['hdnCartTotal']));

    $_SESSION['discountCoupon']=$resultusers->discount;
    $_SESSION['discountcouponvalue']=$resultusers->discount;
    $_SESSION['couponStoreTotal']=$_REQUEST['hdnCartTotal'];
    $_SESSION['couponcode']=$_REQUEST['coupon'];
    $ediscount=$resultusers->discount;
    $_SESSION['coupon_error']=$resultusers->msg;
   
}//appy_ccoupon=yes	
//coupon,rewards, wallet ends	
//to change zipcode starts
if (isset($_POST['submitzip']) && $_POST['submitzip'] == 'Submit') {
    $zip = mysqli_real_escape_string($GLOBALS['conn'], $_POST['zip']);
  
   $_COOKIE['postalcode'] = $zip;
   
    setcookie('postalcode', $_COOKIE['postalcode'], time() + (86400 * 30 * 12), "/"); // 86400 = 1 day
        
    header("Location: https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
    exit();
}
// to change zipcode end
/*if ($_COOKIE['grocery_tab_index'] == 0) {
//Address Changed
if (isset($_REQUEST['pincode'])) {
    if ($_REQUEST['pincode'] != $_COOKIE['postalcode']) {
        //echo $_REQUEST['pincode'];
        //echo $_COOKIE['postalcode'];
        setcookie('postalcode', $_REQUEST['pincode'], time() + (86400 * 30 * 12), "/"); // 86400 = 1 day
        //header("Location:".SITE_URL."indian-grocery/");
        //exit;
    }
}
}*/
?>

<!DOCTYPE html>
<html lang="en-us">
    <head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script>

$(document).ready(function() { $(".clsPgLoader").show(); });
    
    var lstCart = [];
        var cart = window.localStorage.getItem('cart_food');
        
            lstCart = JSON.parse(cart);
    if(lstCart.length==0){ alert('Your cart is empty, please add some items in the cart.'); window.location='<?=SITE_URL;?>' /*setTimeout(function(){ $(".clsMomentsCustomDialog").show(); $("#dvDialogMoments").show();},1500);*/ }</script>
  
        <?php
		$chkSubtotalforevent = $subtotal - $subtotale;
		$chkSubtotaltohide = $subtotal - $subtotalp - $subtotale;
        if ($_REQUEST['error'] != '') {
    $err = "Merchand ID failed to load this time, please try after some time.";
    ?>
    <script type="text/javascript">
        function triggerPayment() {
            document.getElementById('proceedtopayment').click();
        }
    </script>
<?php } else if ($_REQUEST['changerequest'] != 'yes' && $_SESSION['value_user_id'] == '' && $_REQUEST['guestuser'] != 'yes' && $_SESSION['guestuser'] != 'yes') {
    ?>
    <script type="text/javascript">
	
        function triggerPayment() {
			<?php if($chkSubtotalforevent!=0){?>
            document.getElementById('procedcheckoutBtn').click();
			<?php } ?>
        }
    </script>
<?php } else { ?>
    <script type="text/javascript">
        function triggerPayment() {}
    </script>
<?php } ?>
    <script>
    	$(document).ready(function() { <?php if($_COOKIE['firstTimeSubmitYes']=="No"){ ?>$(".form-dynamic").submit(); $('.qty_cart_food').trigger('change');<?php } ?> });
    	
        var isError = false;
    </script>
    <?php
    	if(count($_SESSION['f_cart'])==0){
    	    "<script>alert('ok')</script>";
    	}
    	?>
        <?php include("metas.php"); ?>
        <?php include("css.php"); ?>
        <?php include("common-head.php"); ?>
<style>
.clsPgLoader{z-index: 9999;} 
 .clsPgLoader span {
    display: inline-block;
    width: 50px;
    height: 50px;
    background-image: url(images/loading.gif);
    background-repeat: no-repeat;
    background-size: cover;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%,-50%);
    animation: spin 2.5s linear infinite;
}
.clsPgLoader {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    background-color: rgba(255,255,255,0.6);
    z-index: 2;
}
.form-group{ width:auto!important; }
.clsDialog.clspricemodal.clsmealmemodal .pricemodalcontent p {
    font-weight: 500;
    color: #000;
    text-align: center;
    line-height: 20px;
    font-size: 15px;
    font-family: 'Poppins';
}

a.mealmeproductRemovalAlertmdlBtn {
    background: #000000;
    color: #fff;
    font-weight: 500;
    line-height: 20px;
    font-size: 15px;
    font-family: 'Poppins';
    padding: 10px 20px;
    margin-bottom: 10px;
    width: 100px;
    display: block;
    text-align: center;
    margin: 0 auto;
    cursor: pointer;
}

.mealmeproductRemovalAlertmdl-okBtn {
    display: block;
    margin: 10px auto 0px auto;
    width: 100%;
}
p#lblCartStoreName p {
    font: normal normal 500 20px/30px Poppins;
    letter-spacing: 0px;
    color: #000000;
}
div#searchhide {
    background: #F7F7F7 0% 0% no-repeat padding-box;
}
span#deliverystate strong.mainheaddel {
    font: normal normal 500 14px/20px Poppins;
    margin: 5px 0px;
}
.cartright-box.cartright-box-two.btnpaymentwrapper {
    padding: 0px !important;
}
.clsFoodStores.clsMealSelect.clsPgWidth {
   
}
.clsCartBox .clsCartOptions {
    padding: 0px 0;
}
.tooltip {
    color: #fff !important; 
}
.deltypemcont label {
    display: block;
}
ul.activeprioritymmmmmmmm li {
    cursor: pointer;
}

span.tooltiptext {
    font: normal normal 500 11px/14px Poppins !important;
    color: #fff !important;
    padding: 10px !important;
}
.addrslblbtn a {
    text-decoration: underline;
    font: normal normal 500 14px/20px Poppins;
    letter-spacing: 0px;
    color: #333333;
}
.lang-select.toprepcaementoption.visibilitymaxbyms {
    visibility: hidden;
}
li.activepriority {
    background: white !important;
    border: 1px solid #28A745 !important;
}
.deltypep {
    font: normal normal 500 14px/20px Poppins;
    letter-spacing: 0px;
    color: #28A745;
}
span#deliverystate br {
    display: none;
}
span#deliverystate ul.nationwidedeldel {
    display: block;
    width: 100%;
    /* clear: both; */
    grid-template-columns: repeat(2, 1fr) !important;
    grid-gap: 15px;
}

ul.nationwidedeldel li {
    width: 100% !important;
    display: inline-block !important;
}
.clsCartBox .clsCartOptions .cartright-box.cartright-box-two.btnpaymentwrapper .procedcheckout-wrappr {
    padding: 0px;
}
.delivery_notesbox-wrapper {
    padding: 0px 0;
}
.quickllypassbox {
    display: flex;
    justify-content: space-between;
}

.quickllypassboxcontent {
    width: 70%;
}
.delivery_notesbox-wrapper label b {
    text-align: left;
    font: normal normal 500 16px/20px Poppins;
    letter-spacing: 0px;
    color: #000000;
    margin-bottom: 10px;
    display: block;
}
textarea#delivery_notesbox {
    background: #FFFFFF 0% 0% no-repeat padding-box;
    border: 1px solid #E4E4E4;
    border-radius: 4px;
}
.clsCartBox .clsCartOptions .cartright-box.cartright-box-two.btnpaymentwrapper a#proceedtopayment {
    margin-bottom:0px;
}
.clsdeliveryboxinner.shipfulldetails {
    display: flex;
    justify-content: space-between;
}
p.addrslbl span {
    text-align: left;
    font: normal normal 500 16px/20px Poppins !important;
    letter-spacing: 0px;
    color: #000000;
}
span#addStreet {
    font: normal normal 400 14px/20px Poppins;
    letter-spacing: 0px;
    color: #333333;
}
p#lblCartStoreName {
    display: none;
}
.clsCartItemstoph {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.clsCartItemstoph h3 {
    text-align: left;
    font: normal normal 500 20px/30px Poppins;
    letter-spacing: 0px;
    color: #000000;
}
.clsCartBox .clsCartSection {
    display: block;
    border-bottom: none;
}
.clsCartBox  .clsCartSection a.active {
    /* font-weight: 600; */
    border-bottom: none;
    margin-bottom: 0;
    /* background: var(--unnamed-color-28a745) 0% 0% no-repeat padding-box; */
    background: #28A745 0% 0% no-repeat padding-box;
    text-align: center;
    font: normal normal 500 14px/20px Poppins;
    letter-spacing: 0px;
    color: #FFFFFF;
}
.clsCartBox .clsCartSection a {
    border-bottom: none;
    margin-bottom: 0;
    background: #FFFFFF 0% 0% no-repeat padding-box;
    border: 1px solid #E4E4E4;
    border-radius: 4px;
    text-align: center;
    font: normal normal 500 14px/20px Poppins;
    letter-spacing: 0px;
    color: #333333;
    padding: 7px 13px;
    margin: 0px 5px !important;
}

input#e-vouchercode {
    width: 80%;
}
.clsCartBox .clsCartOptions .cartright-box .parRadioBtnDesc a.cartclsBtn {
    width: 72px;
}
.rwardradioBtnwidth-wrap span {
    display: block;
    text-align: center;
    font: normal normal 400 12px/18px Poppins;
    letter-spacing: 0px;
    color: #333333;
}
.custom-rwardrradios h3{
text-align: left;
font: normal normal 500 16px/20px Poppins;
letter-spacing: 0px;
color: #000000;
margin-bottom:10px;
}
.clsCartBox .clsCartOptions .cartright-box p.cartboxitem span {
    font-size: 14px;
    text-align: left;
    font: normal normal 500 14px/20px Poppins;
    letter-spacing: 0px;
    color: #000000;
    opacity: 1;
}
.custom-tipradios input[type="radio"]:checked+label {
    background: #9d2f88;
    color: #fff;
}
span.cartboxitemName.cartboxitemNameBold {
    text-align: left;
    font: normal normal 500 14px/20px Poppins;
    letter-spacing: 0px;
    color: #000000;
    opacity: 1;
}
p.cartboxttl {
    text-align: left;
    font: normal normal 600 14px/20px Poppins !important;
    letter-spacing: 0px;
    color: #000000;
    padding-bottom: 5px  !important;
}
.custom-rwardrradios img {
    width: 25px;
    margin-bottom: 5px;
}
.rwardradioBtnwidth {
    text-align: center;
}
.clsCartBox .clsCartOptions .cartright-box {
    border: none;
    border-radius: 4px;
    padding: 10px 10px 0px 10px;
    width: 400px;
    margin-bottom: 10px;
    background: #FFFFFF 0% 0% no-repeat padding-box;
    box-shadow: 0px 0px 4px #00000029;
    border-radius: 8px;
   
}
div#openofferpage .pricemodalcontent p.avoffers {
    text-align: left;
    font-weight: 600;
}

.listcta span {
    cursor: pointer;
}
div#removepdcoupon ul,#openofferpage ul{
    list-style: none;
    margin: 0;
    padding: 0;
}
img.removecouponcross {
    width: 10px;
    margin-right: 4px;
}
div#removepdcoupon ul li,#openofferpage ul li {
      background: #FFFFFF 0% 0% no-repeat padding-box;
    border: 1px solid #E4E4E4;
    border-radius: 4px;
    width:100%;
    text-align: left;
    font: normal normal 500 12px/19px Montserrat;
    letter-spacing: 0px;
    color: #333333;
    padding: 8px;
	margin: 10px 0px;
    
}

.wrapfirstblock{
    display: flex;
}
.wrapfirstblock div {
    width:50%;
}

.listcta{
    text-align: right;
}

.discountper h3 {
   color: #333;
    display: inline;
    padding: 2px;
    font-size: 12px;
    font-weight: 500;
}




.viewalloffercta button {
    border: 0;
    outline: 0;
    background: #fff;
    cursor: pointer;
    text-align: center;
    display: block;
    width: 100%;
    margin-top: 10px;
    font: normal normal 500 14px/18px Montserrat;
    letter-spacing: 0px;
    color: #53A551;
}

.discountper {
    margin-top: 8px;
}


p.avoffers,p.avoffers span {
    font: normal normal 600 13px/19px Montserrat;
    letter-spacing: 0px;
    color: #333333 !important;
    margin: 6px 0px;
}
form#removecoupon .cartright-box.cartright-box-one {
    padding: 10px 15px 10px 15px;
}
div#removepdcoupon input {
    width: 100%;
}

a.cartclsBtnremove {
    position: absolute;
    right: 8px;
    z-index: 1;
    top: 35px;
    font-weight: 500;
    color: #000;
}

div#removepdcoupon {
    position: relative;
}
.cartright-box.cartright-box-two.estimatedordertotal p.cartboxitem span{
    font: normal normal 600 14px/20px Poppins;
letter-spacing: 0px;
color: #000000;
opacity: 1;
}



.clsDialog.clspricemodal .clsContent.clsFoodStoreCard.exclude-calc {
	width:320px;
	
}
.pricemodalcontent ul li hr {
    border-bottom: 2px solid #eaeaea;
    border-top: none;
    border-left: none;
    width: 86%;
    margin: 5px auto;
    display: block;
    padding: 5px 0px 0px;
    border-right: none;
}
.clsDialog.clspricemodal .pricemodalcontent {
    padding:10px;
}
.clsDialog.clspricemodal .pricemodalcontent p {
    font-weight:500;
    color: #000;
    text-align:center;
    line-height:16px;
    font-size:13px;
}

p.pfirsthead {
    font-size: 14px !important;
}

p.psecondhead {
    padding: 10px 20px;
}

p.pname {
    font-weight: 600 !important;
}
p.pchange {
    padding: 5px 0px;
}
button.premoveitembtn {
    display: block;
    background: #eaeaea;
    border: 0;
    outline: 0;
    color: #000;
    font-size: 13px;
    font-weight: 500 !important;
    padding: 8px 15px;
    margin: 5px auto;
    width: 82%;
	cursor:pointer;
	
}
.clsDialog.clspricemodal .clsDialog-Box a.clsClose {
    right: 0;
    top: 0px;
}
.allremarks{
  display: none; 
}

.aallremarks {
    padding-left: 0px;
    position: absolute;
    z-index: 99;
    background: #fff;
	box-shadow: 0 6px 12px rgba(0,0,0,.175);
    border: 1px solid rgba(0,0,0,.15);
    border-radius: 5px;
    min-width:195px;
}

.btn-select img{
  width: 12px !important;
  margin-left: 9px;
}
.aallremarks img{
  width: 12px !important;
  margin-left: 9px;
  
}

.aallremarks li{
  list-style: none;
  padding-top: 5px;
  padding-bottom: 5px;
}

.aallremarks li:hover{
 background-color: var(--primary-color);
}
.aallremarks li:hover span{
color:#fff;
}
.aallremarks li:hover img{
color:#fff;
filter: brightness(0) invert(1); 
}
.aallremarks li img{
  margin: 0px 9px;
}
.clsCartBox .clsCartItems .clsContent {
	clear:both;
}
.aallremarks li span{
  margin-left: 0px;
  font-size: 12px;
  font-weight: 500;
}
.btn-select li span{
  margin-left: 9px;
  font-size: 12px;
  font-weight: 500;
  color:#000;
}

/* item list */

.ballremarks{
  display: none;
  width: 100%;
  padding-right:9px;
  min-width: 195px;
  
}

.open{
  display: show !important;
}

.btn-select{
  margin-top: 0px;
  width: 100%;
  min-width: 195px;
  height: 30px;
  border-radius: 5px;
  background-color: #fff;
  border: 1px solid #ccc;
  padding-right:9px;
  
 
}
.btn-select li{
  list-style: none;
  float: left;
  padding-bottom: 0px;
}

.btn-select:hover li{
  margin-left: 0px;
}

.btn-select:hover{
  background-color: #fff;
  border: 1px solid transparent;
  box-shadow: inset 0 0px 0px 1px #ccc;
  
  
}

.btn-select:focus{
   outline:none;
}
.clsCartBox .clsCartItems {
    flex: 1;
    padding: 10px 20px 0px;
}
.clsdeliverybox {
   padding: 0px 20px 10px;
}

.clsdeliveryboxinner {
    background: #FFFFFF 0% 0% no-repeat padding-box; 
    box-shadow: 0px 0px 4px #0000001A;
    border-radius: 4px;
    padding:10px 20px;
}
clsCartBox .clsCartItems .clsContent {
    padding-top: 0;
}
.lang-select {
    margin-left: 0;
    float: right;
    position: relative;
    top: 0px;
    right: 14px;
}
.lang-select p {
    position: relative;
    right: 0;
    top: 0;
    /* font-weight: 500; */
    font: normal normal 400 14px/25px Poppins;
    letter-spacing: 0px;
    color: #000000;
}
.clsCartProd .lang-select {
    position: absolute;
    right: 75px;
    top: 15px;
}
.user-replacement-option {
    padding-top: 0px;
    background: #fff;
    display: block;
    width: 100%;
    float: left;
	margin-top:0px;
}
.clsCartProd label {
    margin-top: 17px;
}
.user-replacement-option label {
    position: relative;
    top: 3px;
    float: left;
    padding: 0px 18px;
}
.clsCartProd .checkreplace {
    margin-top: 17px;
    margin-left: 15px;
    margin-right: 5px;
}
.hidecheck{
	visibility: hidden;
}
.user-replacement-option ms {
    margin-left: 3px;
    position: relative;
    top: -2px;
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
}
.clsCartProd .btn-select {
	
    background-color: #fff;
}
.clsCartProd .btn-select li span {
	color:#333;
}
.clsCartProd .btn-select img {
	filter:brightness(1) invert(0);
}
.clsCartBox .clsCartStores {
    width: 280px;
}
.clsCartBox .clsCartItems .clsContent .clsDetails > .name {
    font-size: 12px;
}
clsCartBox .clsCartItems .clsContent {
    padding-top: 0;
}
p.name.groceryclass {
    max-width: 50%;
}
@media only screen and (min-width: 320px)  and (max-width: 400px) {
.rwardradioBtnwidth label {
	font-size:11px;
}
}
@media only screen and (min-width: 320px)  and (max-width: 550px) {
	.clsCartBox .clsCartStores {
    width: auto;
}
.clsCartProd .btn-select li span {
	display:none;
}
.clsCartProd button.btn-select.currentoption li span {
	display:inline;
}
.clsCartProd .btn-select {
	min-width:30px;
}
p.name.groceryclass {
    max-width: 61%;
}
.user-replacement-option ms {
	display:none;
}
.user-replacement-option .lang-select.toprepcaementoption {
    float: left;
    margin-left: 15px;
    top: -3px;
}
.user-replacement-option {
    padding-top: 5px;
    background: #f7f7f7;
    padding-bottom: 7px;
}
.clsCartBox .clsCartSection a {
    font: normal normal 500 12px/16px Poppins;
  
}
.clsCartBox  .clsCartSection a.active {
    font: normal normal 500 12px/16px Poppins;
}
.user-replacement-option label {
    position: relative;
    top: 13px;
	padding: 0px 13px;
}
.lang-select p {
    position: relative;
    right: 0;
    top: 0px;
	margin-bottom:6px;
}
}
@media only screen and (min-width: 320px)  and (max-width: 767px) {
.clsFoodStores {
    padding: 0 10px;
}
.lang-select.toprepcaementoption.hhhh {
	display:none;
}
.clsStoreDetails .lang-select.toprepcaementoption.hhhh {
    display:block !important;
	right: 0px !important;
}

footer .clsLinks .col-2 {
    min-width: auto !important;
}
.custom-rwardrradios h3 {
    font: normal normal 500 12px/18px Poppins !important;
}
span#deliverystate strong {
    font: normal normal 500 12px/18px Poppins !important;
}
.deltypemcont p {
    font: normal normal 500 12px/20px Poppins !important;
}
.clsCartBox .clsCartOptions .cartright-box p.cartboxitem span {
    font: normal normal 500 12px/16px Poppins !important;
  
}
.clsStoreAction img {
    width: 20px !important;
}
.clsStoreDetails span.qty {

    font: normal normal 400 12px/18px Poppins !important;
}
.clsStoreDetails span.price {
    font: normal normal 500 12px/18px Poppins !important;
}
.deltypep {
    font: normal normal 500 12px/18px Poppins !important;
}
.tempcartclsCartStores .clsStoreDetails p {
    font: normal normal 500 12px/16px Poppins !important;
}
.addrslblcontent {
    width: 64%;
}
.clsCartBox .clsCartItems .clsContent {
    padding-top: 0;
}
span#addStreet {
    font: normal normal 400 12px/18px Poppins !important;
}
p.addrslbl span {
    font: normal normal 500 12px/18px Poppins !important;
}
p.addrslbl span {
    font: normal normal 500 12px/18px Poppins !important;
}

.addrslblbtn a {
    font: normal normal 500 12px/18px Poppins !important; 
}
.clsCartBox .clsCartItems {
    flex: 1;
    padding: 10px 0px 0px;
}
.clsCartItemstoph {
    display: block;
    text-align: center;
}
.clsCartItemstoph h3 {
    text-align: center;
    font: normal normal 500 14px/20px Poppins;
    margin-bottom: 10px;
}
.clsdeliverybox {
    padding: 0px 0px 10px;
}
.clsdeliveryboxinner {
    background: #FFFFFF 0% 0% no-repeat padding-box;
    box-shadow: 0px 0px 4px #0000001A;
    border-radius: 4px;
    padding: 5px 10px;
}
span#deliverystate ul li {
    display: block;
    width: 100% !important;
    background: #F5F5F5 0% 0% no-repeat padding-box;
    border: 1px solid #E4E4E4;
    padding: 5px 10px;
    justify-content: space-between;
    margin: 10px 5px;
}
span#deliverystate ul {
    display: block !important;
    justify-content: space-between;
}
ul.nationwidedeldel li {
    width: 100% !important;
    display: block !important;
	margin: 10px 5px;
}
.quickllypassbox {
    display: block;
    justify-content: space-between;
}
.clsCartBox .clsCartOptions {
    margin-right: 0;
}
.tempcartclsCartStores .clsStoreimgDetails {
	margin-right:10px;
}
.clsCartBox .clsCartOptions .cartright-box {
    border: none;
    border-radius: 4px;
    padding:5px 8px 5px 8px;
    width: 100%;
    margin-bottom: 10px;
    background: #FFFFFF 0% 0% no-repeat padding-box;
    box-shadow: 0px 0px 4px #00000029;
    border-radius: 8px;
	margin:10px 0px;
}
.rwardradioBtnwidth {
    padding-right: 6px;
    width: 33%;
}
input#e-vouchercode {
    width: 65%;
}
.lang-select.toprepcaementoption.visibilitymaxbyms {
    display: none;
}
}
@media only screen and (min-width: 551px)  and (max-width: 800px) {
	.clsCartBox .clsCartStores {
    width: auto;
}
.clsCartProd .btn-select li span {
	display:none;
}
.clsCartProd button.btn-select.currentoption li span {
	display:inline;
}
.clsCartProd .btn-select {
	min-width:30px;
}
p.name.groceryclass {
    max-width: 61%;
}
.user-replacement-option ms {
	display:inline;
}

}
</style>
    </head>
    <div class="clsDialog" id="dvDialogMoments">
            <div class="clsDialog-Box clsMomentsCustomDialog" style="overflow: auto;
    min-height:240px !important;
    display: block;
   ">
                <div class="momentsuccess" style="padding: 20px 36px 20px 36px;">
         <p><center><img src="images/product-added-to-cart.svg" style="width:30%;"></center></p>
                     <h3 style="font: normal normal 500 16px / 22px Poppins !important;margin-top: 10px;">Your cart is empty, please add some items in the cart.</h3>
                     
                </div>
                <center><div class="cart-action" style="
   
    margin-top:0px;
">
                        
                         <a href="<?=SITE_URL?>" style="background-color: #9D2F88; color:#fff;padding:10px 10px 10px 10px; font: normal normal 400 13px / 14px Poppins !important; border-radius: 3px;">Keep Shopping</a>
                     <br><br><br>
                     </div></center>
             </div>
        </div>
<?php
   if(isset($_SESSION['moengage_mk_payment']))
		{
			$moengageProducts = $_SESSION['moengage_mk_payment'];
				
			$moengage_CouponCodeAppliedName = $moengageProducts['CouponCodeAppliedName'];      
			$moengage_CouponCodeAppliedAmount = $moengageProducts['CouponCodeAppliedAmount'];      
			$moengage_CouponCodeApplied = $moengageProducts['CouponCodeApplied'];      
			$moengage_CartAmount = $moengageProducts['CartAmount'];      
			$moengage_PurchaseAmount = $moengageProducts['PurchaseAmount'];
			$moengage_purchasedate = date('Y-m-d H:i:s');

			$moengage_ProductCategory = $moengageProducts['ProductCategory'];
			$moengage_ProductName = $moengageProducts['ProductName'];
			$moengage_ProductID = $moengageProducts['ProductID'];
			$moengage_ProductStoreName = $moengageProducts['ProductStoreName'];
			$moengage_ProductStoreID = $moengageProducts['ProductStoreID'];
			$moengage_Quantity = $moengageProducts['Quantity'];
			
			$moengageResult = $_SESSION['moengage_mk_result'];
			
			$moengage_payment_event = $moengageResult['payment_event'];
			$moengage_TransactionID = $moengageResult['TransactionID'];
			$isoDateM = date('Y-m-d\TH:i:s') . 'Z'; //'YYYY-MM-DDTHH:MM:SSZ
    
    ?>
   
   
		<?php
		unset($_SESSION['moengage_mk_payment']);
	  unset($_SESSION['moengage_mk_result']);
	 }
	 if(count( $_SESSION['f_cart'])==0)
	 
		?>
    
    <body onLoad="triggerPayment()">
        <form action="" class="form-dynamic" id="firstLoadSubmit"  method="post" enctype="multipart/form-data" style="display:none;">
            <input type="hidden" name="hdnCartGrocery" id="hdnCartGrocery" value="">
            <input type="hidden" name="hdnCartFood" id="hdnCartFood" value="">
            <input type="hidden" name="hdnCartGiftCard" id="hdnCartGiftCard" value="">
			<input type="hidden" name="hdnCartEvents" id="hdnCartEvents" value="">
			<input type="hidden" name="hdnCartPuja" id="hdnCartPuja" value="">
			<input type="hidden" name="hdnCartApparel" id="hdnCartApparel" value="">
            <input type="submit" name="cartsubmit" id="cartsubmit" value="CARTSUBMIT">
        </form>

<?php
include("header.php");
include("cart.php");
$campaaignend='2022-12-31';
if($campaaignend>=date('Y-m-d')){
include("supersaver-december.php");
}


?>
<div id="searchhide" >
 <div class="clsFoodStores clsMealSelect clsPgWidth" style="clear:both;">
            <div class="clsCartBox">
                <div class="clsCartStoresItems">
                    
                    <div class="clsCartItems">
					<div class="clsCartItemstoph">
					 <h3>Your Shopping Carts</h3>
                        <div class="clsCartSection" style="display:none;">
                            <a href="javascript:void(0);" onClick="setCartDeliveryType(this, '0');">Delivery</a>
                            <a href="javascript:void(0);" onClick="setCartDeliveryType(this, '1');">Curbside Pickup</a>
                        </div>
						</div>
                        <!-- <p>Items in your Cart</p> -->
                        <p id='lblCartStoreName'></p>
						<div class="user-replacement-option">
						
						<select class="allremarks">
            <option value="Replace with Best Match" style="background-image:url(<?php echo SITE_URL;?>images/cart/replace-black.svg);"  data-thumbnail="<?php echo SITE_URL;?>images/cart/replace-black.svg">Replace with Best Match</option>
            <option value="Call Us Before Replacing" data-thumbnail="<?php echo SITE_URL;?>images/cart/call-black.svg">Call Us Before Replacing</option>
            <option value="Do Not Replace" data-thumbnail="<?php echo SITE_URL;?>images/cart/do-not-replace-black.svg">Do Not Replace</option>
            
              </select>

                     
						
						</div>

                        <div class="clsContent" id="product"></div>
                    </div>
					                                       <!-- address starts-->
<?php
if ($_REQUEST['changerequest'] == 'yes' || $_REQUEST['guestuser'] == 'yes') {

    $_SESSION['fname'] = strip_tags($_REQUEST['fname']);
    $_SESSION['lname'] = strip_tags($_REQUEST['lname']);
    $_SESSION['email'] = strip_tags($_REQUEST['email']);
    $_SESSION['house_no'] = strip_tags($_REQUEST['house_no']);
    $_SESSION['street'] = strip_tags($_REQUEST['street_address']);
    $_SESSION['apartment'] = strip_tags($_REQUEST['apt']);
    $_SESSION['state'] = strip_tags($_REQUEST['state']);
    $_SESSION['pincode'] = strip_tags($_REQUEST['pincode']);
    $_SESSION['city'] = strip_tags($_REQUEST['city']);
    $_SESSION['mobile'] = strip_tags($_REQUEST['mobile']);
    $_SESSION['full_address'] = strip_tags($_REQUEST['full_address']);
    $_SESSION['latitude'] = strip_tags($_REQUEST['latitude']);
    $_SESSION['longitude'] = strip_tags($_REQUEST['longitude']);
   
    
	
	$custFname = parseField($_REQUEST['fname']);
	$custLname = parseField($_REQUEST['lname']);
	$custApt = parseField($_REQUEST['apt']);
	$custfull_address = parseField($_REQUEST['full_address']);
	
    $_COOKIE['fname'] = strip_tags($_REQUEST['fname']);
	$_COOKIE['lname'] = strip_tags($_REQUEST['lname']);
	$_COOKIE['email'] = strip_tags($_REQUEST['email']);
    $_COOKIE['house_no'] = strip_tags($_REQUEST['house_no']);
    $_COOKIE['street'] = strip_tags($_REQUEST['street_address']);
    $_COOKIE['apartment'] = strip_tags($_REQUEST['apt']);
    $_COOKIE['state'] = strip_tags($_REQUEST['state']);
    $_COOKIE['pincode'] = strip_tags($_REQUEST['pincode']);
    $_COOKIE['city'] = strip_tags($_REQUEST['city']);
    $_COOKIE['mobile'] = strip_tags($_REQUEST['mobile']);
    $_COOKIE['full_address'] = strip_tags($_REQUEST['full_address']);
    $_COOKIE['latitude'] = strip_tags($_REQUEST['latitude']);
    $_COOKIE['longitude'] = strip_tags($_REQUEST['longitude']);
    
    setcookie('email',  strip_tags($_REQUEST['email']), time() + (86400 * 30 * 12), "/"); // 86400 = 1 day
    setcookie('house_no',  strip_tags($_REQUEST['house_no']), time() + (86400 * 30 * 12), "/"); // 86400 = 1 day
    setcookie('street',  strip_tags($_REQUEST['street_address']), time() + (86400 * 30 * 12), "/"); // 86400 = 1 day
    setcookie('apartment',  strip_tags($_REQUEST['apt']), time() + (86400 * 30 * 12), "/"); // 86400 = 1 day
    setcookie('state',  strip_tags($_REQUEST['state']), time() + (86400 * 30 * 12), "/"); // 86400 = 1 day
    setcookie('pincode',  strip_tags($_REQUEST['pincode']), time() + (86400 * 30 * 12), "/"); // 86400 = 1 day
    setcookie('city',  strip_tags($_REQUEST['city']), time() + (86400 * 30 * 12), "/"); // 86400 = 1 day
    setcookie('mobile',  strip_tags($_REQUEST['mobile']), time() + (86400 * 30 * 12), "/"); // 86400 = 1 day
    setcookie('full_address',  strip_tags($_REQUEST['full_address']), time() + (86400 * 30 * 12), "/"); // 86400 = 1 day
    setcookie('latitude',  strip_tags($_REQUEST['latitude']), time() + (86400 * 30 * 12), "/"); // 86400 = 1 day
    setcookie('longitude',  strip_tags($_REQUEST['longitude']), time() + (86400 * 30 * 12), "/"); // 86400 = 1 day
    if(isset($_REQUEST['saveaddress']) && $_REQUEST['saveaddress']=='1'){ 
	if($_REQUEST['mobile']!='' && $custfull_address!=''){
      //  $obj->query("update  $tbl_user set fname='".$custFname."',lname='".$custLname."',house_no='".strip_tags($_REQUEST['house_no'])."',street='".strip_tags($_REQUEST['street_address'])."',complex='".$custApt."',state='".strip_tags($_REQUEST['state'])."',city_id='".strip_tags($_REQUEST['city'])."',pincode='".strip_tags($_REQUEST['pincode'])."',mobile='".strip_tags($_REQUEST['mobile'])."',full_address='".$custfull_address."',latitude='".strip_tags($_REQUEST['latitude'])."',longitude='".strip_tags($_REQUEST['longitude'])."' where id='" . $_SESSION['value_user_id'] . "'");
	$tokenData = callAPI('POST', WEBAPI_URL_NEW.'miniuser/change-address',array("custFname"=>$custFname, "custLname"=>$custLname,"house_no"=>strip_tags($_REQUEST['house_no']),"street_address"=>strip_tags($_REQUEST['street_address']),"custApt"=>$custApt,"state"=>strip_tags($_REQUEST['state']),"city"=>strip_tags($_REQUEST['city']),"pincode"=>strip_tags($_REQUEST['pincode']),"mobile"=>strip_tags($_REQUEST['mobile']),"custfull_address"=>$custfull_address,"latitude"=>strip_tags($_REQUEST['latitude']),"longitude"=>strip_tags($_REQUEST['longitude']),"uid"=>$_SESSION['value_user_id']));
	
		setcookie('saveaddress',strip_tags($_REQUEST['saveaddress']), time() + (86400 * 30 * 12), "/"); // 86400 = 1 day
	} 
	
    } elseif(!isset($_REQUEST['saveaddress']) && $_REQUEST['saveaddress']!='1') {
		setcookie('saveaddress',0, time() + (86400 * 30 * 12), "/"); // 86400 = 1 day
	}
} elseif ($_SESSION['value_user_id'] != '' &&   ($_COOKIE['email']  == '' ||  $_COOKIE['state']  == '' ||   $_COOKIE['pincode']  == '' ||   $_COOKIE['city']  == '' ||   $_COOKIE['mobile']  == '' ||   $_COOKIE['full_address']  == '')) {
    
    //$_COOKIE['house_no']  == ''
    $_SESSION['fname'] = $resultuser->fname;
    $_SESSION['lname'] = $resultuser->lname;
    $_SESSION['email'] = $resultuser->email;
    $_SESSION['house_no'] = $resultuser->house_no;
    $_SESSION['street'] = $resultuser->street;
    $_SESSION['apartment'] = $resultuser->complex;
    $_SESSION['state'] = $resultuser->state;
    $_SESSION['pincode'] = $resultuser->pincode;
    $_SESSION['city'] = $resultuser->city_id;
    $_SESSION['mobile'] = $resultuser->mobile;
    $_SESSION['full_address'] = $resultuser->full_address;
    $_SESSION['latitude'] = $resultuser->latitude;
    $_SESSION['longitude'] = $resultuser->longitude;
    
    
     
    $_COOKIE['email'] = $resultuser->fname;
	$_COOKIE['fname'] = $resultuser->fname;
	$_COOKIE['lname'] = $resultuser->lname;
    $_COOKIE['house_no'] = $resultuser->house_no;
    $_COOKIE['street'] = $resultuser->street;
    $_COOKIE['apartment'] = $resultuser->complex;
    $_COOKIE['state'] = $resultuser->state;
    $_COOKIE['pincode'] = $resultuser->pincode;
    $_COOKIE['city'] = $resultuser->city_id;
    $_COOKIE['mobile'] = $resultuser->mobile;
    $_COOKIE['full_address'] = $resultuser->full_address;
    $_COOKIE['latitude'] = $resultuser->latitude;
    $_COOKIE['longitude'] = $resultuser->longitude;
    
    setcookie('email',   $resultuser->email, time() + (86400 * 30 * 12), "/"); // 86400 = 1 day
    setcookie('house_no',  $resultuser->house_no, time() + (86400 * 30 * 12), "/"); // 86400 = 1 day
    setcookie('street',  $resultuser->street, time() + (86400 * 30 * 12), "/"); // 86400 = 1 day
    setcookie('apartment',  $resultuser->complex, time() + (86400 * 30 * 12), "/"); // 86400 = 1 day
    setcookie('state',  $resultuser->state, time() + (86400 * 30 * 12), "/"); // 86400 = 1 day
    setcookie('pincode',  $resultuser->pincode, time() + (86400 * 30 * 12), "/"); // 86400 = 1 day
    setcookie('city',  $resultuser->city_id, time() + (86400 * 30 * 12), "/"); // 86400 = 1 day
    setcookie('mobile',  $resultuser->mobile, time() + (86400 * 30 * 12), "/"); // 86400 = 1 day

    setcookie('full_address',  $resultuser->full_address, time() + (86400 * 30 * 12), "/"); // 86400 = 1 day
    setcookie('latitude',  $resultuser->latitude, time() + (86400 * 30 * 12), "/"); // 86400 = 1 day
    setcookie('longitude',  $resultuser->longitude, time() + (86400 * 30 * 12), "/"); // 86400 = 1 day
    
}
?>
					<div class="clsdeliverybox">
					<div class="clsdeliveryboxinner shipfulldetails">
					 <?php $address_heading='';

                                        if ($_COOKIE['grocery_tab_index'] == 0) { 
												$moment_address='';
                                                if($_SESSION['recipentDetails'][0]!='')
                                                {
													$moment_address='<p class="addrslbl"><span><strong>Moment Recipient Address:</strong></span></p>';
                                                    $dd=$obj->query("SELECT * FROM `tbl_moments` WHERE id='". $_SESSION['recipentDetails'][0]."'");
                                                       $ddr=$obj->fetchNextObject($dd);
                                                       $moment_address.="<span>";
                                                       $moment_address.=$ddr->fname." ".$ddr->lname."<br>";
                                                       $moment_address.=$ddr->full_address."<br>";
  if($ddr->complex!=''){                                                     $moment_address.=$ddr->complex."<br>";
                                      }                 $moment_address.=$ddr->zipcode."<br>";
                                                       $moment_address.='Email-: ' .$ddr->email.'<br>';
                                                       $moment_address.='Phone-: ' .$ddr->phone;
                                                       $moment_address.="</span>";                                                       
                                                       $_SESSION['moment_address'] = $moment_address;
                                                   $address_heading='Billing Address';                                                      
                                            }else{
                                            $address_heading="Shipping Address";    
                                                }
        
        if($subtotalg>0.1 && $_SESSION['recipentDetails'][0]!=''){
                                            $address_heading="Shipping/Billing Address";
                                                }
		if($chkSubtotalforevent==0){
			$address_heading="Account Details:";
		}										
												
                                                ?>
												<div class="addrslblcontent">
                                                <p class="addrslbl"><span><?php echo $address_heading; ?></span></p>
                                                
    <?php  

if ($_SESSION['value_user_id'] != '') {	

//$uArrs = $obj->query("select fname,lname,email,house_no,street,complex,state,pincode,city_id,mobile,full_address,latitude,longitude from tbl_user where status=1 and id='" . $_SESSION['value_user_id'] . "'");
//$usrUpadteInfo = $obj->fetchNextObject($uArrs);

$usrUpadteInfos=callAPI('POST', WEBAPI_URL_NEW.'miniuser/Login-User-Detail',array("userid"=>$_SESSION['value_user_id']));
	foreach($usrUpadteInfos->lstuser as $usrUpadteInfo){
	    
	}
}

if($usrUpadteInfo->full_address != ''){
	

	$_COOKIE['email'] = $usrUpadteInfo->email;
    $_COOKIE['house_no'] = $usrUpadteInfo->house_no;
    $_COOKIE['street'] = $usrUpadteInfo->street;
    $_COOKIE['apartment'] = stripslashes($usrUpadteInfo->complex);
    $_COOKIE['state'] = $usrUpadteInfo->state;
    
    $_COOKIE['city'] = $usrUpadteInfo->city_id;
    $_COOKIE['mobile'] = $usrUpadteInfo->mobile;
	if($_COOKIE['saveaddress']==0 && $_COOKIE['full_address']!='' && $_COOKIE['pincode']!=''){
		 $_COOKIE['full_address'] = $_COOKIE['full_address'];
		 $_COOKIE['pincode'] =  $_COOKIE['pincode'];
	} else {
		$_COOKIE['full_address'] = stripslashes($usrUpadteInfo->full_address);
		$_COOKIE['pincode'] = $usrUpadteInfo->pincode;
	}
   
    $_COOKIE['latitude'] = $usrUpadteInfo->latitude;
    $_COOKIE['longitude'] = $usrUpadteInfo->longitude;
	
	$_SESSION['email'] = $usrUpadteInfo->email;
	$_SESSION['fname'] = stripslashes($usrUpadteInfo->fname);
	$_SESSION['lname'] = stripslashes($usrUpadteInfo->lname);
	$checkstreet=stripos($_COOKIE['full_address'],$_COOKIE['street']);
	$checkhouse=stripos($_COOKIE['full_address'],$_COOKIE['house_no']);
	$showstreet=$_COOKIE['street'];
	 if($checkstreet!==false){
		 $showstreet=''; 
	  }
	  $showhouse=$_COOKIE['house_no'];
	  if($checkhouse!==false){
		 $showhouse=''; 
	  }


            ?>  
                                                   <p class="addrsrc" id="addrsrc"> <span id="addStreet"><span id="addStreet"><?php echo ucwords($_SESSION['fname'] . ' ' . $_SESSION['lname']); ?><br></span>
                                                       <?php echo ucwords(trim(urldecode($_COOKIE['full_address']))). '<br />' . $showhouse . ' ' .  $showstreet . ' ' . $_COOKIE['apartment']; ?> <?php echo $_COOKIE['city'] . ', ' . $_COOKIE['state'] . ' - ' . $_COOKIE['pincode']; ?></span></p>
												
													</div>
                                                   <div class="addrslblbtn">
                                                       <?php
                                                       if($_SESSION['value_user_id']!='')
                                                       {
                                                       ?>
                                                   <a href="javascript:void(0)" id="changeAddrssBtn" class="changeAddrssBtn">Change Address</a>
                                                   <?php
                                                       }
                                                   ?>
												   </div>
           <?php 
            echo "<script>   isAddressSelected = true;</script>";
        } else {
            if ($_SESSION['fname'] != '' && $_COOKIE['pincode'] != '' && $_COOKIE['email'] != '') { 
			
			$checkstreet=stripos($_COOKIE['full_address'],$_COOKIE['street']);
			$checkhouse=stripos($_COOKIE['full_address'],$_COOKIE['house_no']);
	$showstreet=$_COOKIE['street'];
	 if($checkstreet!==false){
		 $showstreet=''; 
	  }
	  $showhouse=$_COOKIE['house_no'];
	  if($checkhouse!==false){
		 $showhouse=''; 
	  }
			?>
			                                    
                                                      <p class="addrsrc" id="addrsrc">  <span id="addStreet">1<?php echo ucwords($_SESSION['fname'] . ' ' . $_SESSION['lname']); ?><br></span>
                                                        <span id="addCity"><?php echo ucwords(trim(urldecode($_COOKIE['full_address']))). '<br />';?><?php echo $showhouse . ' ' . $showstreet . ' ' . $_COOKIE['apartment']; ?><br></span>
                                                        <span id="addState"><?php echo $_COOKIE['city'] . ', ' . $_COOKIE['state'] . ' - ' . $_COOKIE['pincode']; ?><br>
                                                           
                                                    </p>
													</div>
													<div class="addrslblbtn">
													    <?php
                                                       if($_SESSION['value_user_id']!='')
                                                       {
                                                       ?>
                                                    <a href="javascript:void(0)" id="changeAddrssBtn" class="changeAddrssBtn">Change Address</a>
                                                    <?php
                                                       }
                                                    ?>
													</div>
    <?php            
            }else { ?>
			</div>
			<div class="addrslblbtn">
                                                    <a href="javascript:void(0)" id="changeAddrssBtn" class="changeAddrssBtn">Enter Delivery Details</a>
													</div>
           <?php }  
       }  
       if($_SESSION['recipentDetails'][0]!=''){ echo "<br>".$_SESSION['moment_address'] = $moment_address; echo "<br>"; } ?>
	    </div>
		</div>
		
		
		      <div class="clsdeliverybox">
		<div class="clsdeliveryboxinner">
<?php
//$userss=$obj->query("select state from tbl_user where id='".$_SESSION['value_user_id']."'");
//$userstate = $obj->fetchNextObject($userss);
//$statedel=$obj->query("select price from tbl_justdeliveryprice where state='".$userstate->state."'");
//$statewidedel = $obj->fetchNextObject($statedel);
$delivery_charges=4.99;
$_SESSION['deliverChargeStateWise']=$delivery_charges;
?>
                                                <span id="deliverystate"><strong><?php if($chkSubtotaltohide!=0){?> Delivery Estimates<?php } else { if($subtotale>0){?>Event Date:<?php } } ?> <br></strong>
   
   <ul class="nationwidedeldel"><li style="display:flex!important;"><div class="deltypem"><div class="deltypemimg">
       <img src="https://www.dev.goquicklly.com/images/cart/standard.svg"></div>
       <div class="deltypemcont"><p>Standard</p><label>
           <?php
           $deliverysend='';
           	foreach($_SESSION['f_cart'] as $row)
	{
	    $deliverysend=$row['deliveryDate'];
	    $deliverysend = date("d-M-Y (D)", strtotime($deliverysend));
	}
           ?>
           <p style="margin-top:3px;font-weight:500;color:#000;"></p><p style="margin-top:3px"><?=$deliverysend?></p></label></div></div><div class="deltypep"><span style="font: normal normal 500 13px / 20px Poppins;letter-spacing: 0px; color: #000000; text-shadow: 0 0 black;">$<?=number_format($delivery_charges,2);?></span></div></li></ul>
    <?php
//grocery delivery
//print_r($deliverytypef);

$tokenData = callAPI('POST', WEBAPI_URL_NEW.'login',array("email"=>"[email protected]", "password"=>"cgcptcu97b"));
$apitoken = $tokenData->token; 
$token=$apitoken;
$storeId=implode(',',$foodsarrayoncheck);
$resultpriority = callAPI('POST', WEBAPI_URL_NEW.'common/check-priority-delivery', array('callFrom' => callFrom, 'custZip' => $zip, 'storeId'=> $storeId, 'token'=>$token));
$grocerypriorityflag=false;
$foodpriorityflag=false;
$flagfoodapply=false;
$flaggroceryapply=false;
if($_COOKIE['grocerypriority']==1){
	$flaggroceryapply=true;
}
if($_COOKIE['foodpriority']==1){
	$flagfoodapply=true;
}

$storeIdrrrr=$resultpriority->storeId;
//print_r($storeIdrrrr);
$groceryprioritystore=array();
$foodprioritystore=array();
if ($subtotalg > 0 || $subtotalf > 0) {
 foreach ($storeIdrrrr as $resultst) {
	 if ($subtotalg > 0){
		 if(in_array($resultst->sId,$storeidarrg)) {
		 if($resultst->priorityDelivery==1)	{
			$grocerypriorityflag=true;
           array_push($groceryprioritystore,$resultst->sId);			
		 } 
		 }
        }
		if ($subtotalf > 0){
		 if(in_array($resultst->sId,$foodsarrayon)) {
		 if($resultst->priorityDelivery==1)	{
			$foodpriorityflag=true;
            array_push($foodprioritystore,$resultst->sId);			
		 } 
		 }
        }
		}
}
$_SESSION['foodprioritystore']=$foodprioritystore;
//echo $resultpriority->foodPriorityDeliveryFee;
//echo $resultpriority->groceryPriorityDeliveryFee;
//print_r($resultpriority->storeId);

  $sess_delivery_time = '';
    if ($subtotalg > 0) {
		$grocerystorecheck=$storeidarrg;
		$del_val=111146;
		if (($key = array_search($del_val, $grocerystorecheck)) !== false) {
        unset($grocerystorecheck[$key]);
		}

        if ($subtotalf > 0) {
			if(count($grocerystorecheck)>0) {
            echo $groceryname = "<strong class='mainheaddel'><br>Groceries: <br></strong>";
			}
        }
		if(count($storeidblackfriday)==1) {
			 $blackfridayname = "<strong class='mainheaddel'><br>Black Friday: <br></strong>";
		}

        /* if(in_array('113', $storeidarrg)){ //echo " 1 - 2 days";
          echo $_SESSION['grocery_deliverytime']=$groceryname." 1 - 2 days";
          $_SESSION['grocery_deliverytime']=$_SESSION['delivery_time'];
          }else{ */
		 
		 ?>
		 
		 <ul class="activeprioritymmmmmmmm">
		 <?php if($grocerypriorityflag==true){?>
		 <li <?php if($flaggroceryapply==true){?> class="activepriority" <?php }?> onClick="setpDeliveryType(this, '1','grocery','<?php echo $resultpriority->groceryPriorityDeliveryFee;?>');"><div class="deltypem"><div class="deltypemimg"><img src="<?php echo SITE_URL;?>images/cart/priority.svg"></div><div class="deltypemcont"><p>Priority</p><label><?php echo $resultpriority->groceryPriorityDeliveryTime;?></label></div></div><div class="deltypep">+$<?php echo $resultpriority->groceryPriorityDeliveryFee;?></div></li>
		 <?php } ?>
		
		 <?php if(count($grocerystorecheck)>0) { ?>
		  <li <?php if($flaggroceryapply==false){?> class="activepriority" <?php }?> onClick="setpDeliveryType(this, '0','grocery','0');"><div class="deltypem"><div class="deltypemimg"><img src="<?php echo SITE_URL;?>images/cart/standard.svg"></div><div class="deltypemcont"><p>Standard</p><label><?php echo getEstimateDelivery_CheckOutPage($obj);?></label></div></div><div class="deltypep"></div></li>
		 <?php } ?>
		  <?php if(count($storeidblackfriday)==1) { ?>
		 <li ><div class="deltypem"><div class="deltypemimg"><img src="<?php echo SITE_URL;?>images/cart/standard.svg"></div><div class="deltypemcont"><p>Standard(Black Friday Store)</p><label>Deliver in 3-5 business days</label></div></div><div class="deltypep"></div></li>
		 <?php } ?>
		 <?php
       // echo getEstimateDelivery_CheckOutPage($obj,$grocerypriorityflag,$flagapply);
	   if(count($grocerystorecheck)>0) {
	   if($flaggroceryapply==true){
	   $_SESSION['delivery_time']='Priority Delivery'.$resultpriority->groceryPriorityDeliveryTime;
	   }
        $_SESSION['grocery_deliverytime'] = $groceryname . $_SESSION['delivery_time'];
	   }
	   if(count($storeidblackfriday)==1) {
		$_SESSION['blackfriday_deliverytime'] = $blackfridayname . 'Deliver in 3-5 business days';
	   }
        $sess_delivery_time = $_SESSION['delivery_time']; 
?>
</ul>		
<?php
    }
    ?>
    <script>
    var cart_grocery_session = "<?php echo $sess_delivery_time;?>";
    var cart_grocery_lstorage = window.localStorage.getItem('cart_grocery');
    </script>
        <?php

    //food delivery
    /* if($subtotalf > 0){ 
      if($subtotalg > 0){ echo "<br><br><strong>Food:<br></strong> ";  }
      $fooddeliveryarr=array();
      $storeidarrf=array_values($storeidarrf);

      for($d=0; $d < count($storeidarrf); $d++){
      $delpart=$obj->query("select storename,z.storeid,food_delivery_partner from tbl_store_zip z inner join stores s on z.storeid=s.storeid where z.storeid='$storeidarrf[$d]' and z.zip='".$_COOKIE['postalcode']."'");
      $resultdel=$obj->fetchNextObject($delpart);
      if($resultdel->food_delivery_partner=='snap'){
      array_push($fooddeliveryarr,ucwords(strtolower($resultdel->storename)).": 60 - 90 Minutes.<br>");
      }else{
      array_push($fooddeliveryarr,ucwords(strtolower($resultdel->storename)).": Today between 5:00 PM - 9:00 PM CT<br>");
      }
      }
      //print_r($fooddeliveryarr);
      foreach($fooddeliveryarr as $fooddelivery) {
      echo $fooddelivery;
      }
      $_SESSION['food_deliverytime']= $fooddeliveryarr;
      } */
    $fooddeliveryarr = array();
	$fooddeliveryarrn = array();
    $cart_food = $_SESSION['cart_food'];
    ?>
    <script>
    var cart_food_session = "<?php echo $cart_food;?>";
    var cart_food_lstorage = window.localStorage.getItem('cart_food');
    </script>
    <?php  
    
    $food_delivery = '';
    usort($cart_food, 'date_sort');
    if (count($cart_food) > 0) {
        if ($subtotalg > 0) {
            $food_delivery = "<br><strong class='mainheaddel'>Food:</strong>";
			
			
            echo $food_delivery;
        }
		 if($flagfoodapply==true){
		// $food_delivery.= "<br><strong>Priority Delivery".$resultpriority->foodPriorityDeliveryTime."</strong>";
		 }
		?>
		<?php if(count($foodsarrayon)>0){?>
		<ul class="activeprioritymmmmmmmm">
		 <?php if($foodpriorityflag==true){?>
		 
		 <li <?php if($flagfoodapply==true){?> class="activepriority" <?php }?> data-type='1' onClick="setpDeliveryTypef(this);"><div class="deltypem"><div class="deltypemimg"><img src="<?php echo SITE_URL;?>images/cart/priority.svg"></div><div class="deltypemcont"><p>Priority</p><label><?php echo $resultpriority->foodPriorityDeliveryTime;?></label><?php if(count($foodsarrayon)!=count($foodprioritystore)){?> <label>*Some of the stores is not applicable for Priority Delivery</label><?php }?></div></div><div class="deltypep">+$<?php echo $resultpriority->foodPriorityDeliveryFee;?></div></li>
		 <?php } ?>
	
		  <?php
		if($flagfoodapply==false){
		  	$htmlfood="<li class='activepriority' data-type='0'  onClick='setpDeliveryTypef(this)'><div class='deltypem'><div class='deltypemimg'><img src=".SITE_URL."images/cart/standard.svg></div><div class='deltypemcont'><p>Standard</p>";
		} else {
			$htmlfood="<li data-type='0'  onClick='setpDeliveryTypef(this)'><div class='deltypem'><div class='deltypemimg'><img src=".SITE_URL."images/cart/standard.svg></div><div class='deltypemcont'><p>Standard</p>";
		}
        //Restuarants delivery
		
        foreach ($cart_food as $dataf) {
            if ($dataf['section'] == 'food') {
                $delpart = $obj->query("select UPPER(z.food_delivery_partner) food_delivery_partner , z.state from tbl_store_zip z inner join stores s on z.storeid = s.storeid where z.storeid='" . $dataf['sid'] . "' and (s.by_pass_zipcode = 1 OR z.zip='" . $_COOKIE['postalcode'] . "')");
                $resultdel = $obj->fetchNextObject($delpart);
                $zipstate = strtoupper($resultdel->state);

                $delvTime = '';
                    $tmpDate = strtotime($dataf['deliveryDate']);
                    $delvDate = date('d-M-Y', $tmpDate);

                if ($resultdel->food_delivery_partner == 'MYVALUE365') {
                    if ($dataf['deliveryFromTime'] == '')
                        $delvTime = 'between 5:00 PM - 9:00 PM';
                    else {
                        $timeFrom = strtotime($dataf['deliveryFromTime']);
                        $timeTo = strtotime($dataf['deliveryToTime']);
                        $delvTime = 'between ' . strtoupper(date('g:i a', $timeFrom)) . ' - ' . strtoupper(date('g:i a', $timeTo)) .' ' .getTimeoneForDelivery($zipstate);
                    }
                } else {
                    if ($dataf['deliveryFromTime'] == '')
                        $delvTime = '60 - 90 Minutes.';
                    else {
                        $timeFrom = strtotime($dataf['deliveryFromTime']);
                        $delvTime = strtoupper(date('g:i a', $timeFrom)) .' ' .getTimeoneForDelivery($zipstate);
                    }
                }
                
                 if($flagfoodapply==true){
		        $foodtime=$resultpriority->foodPriorityDeliveryTime;
		         if(in_array($dataf['sid'],$foodprioritystore)) {
				
				  $timeline2 = "<p style='margin-top:3px;font-weight:500;color:#000;'>" . $dataf['sname'] . "</p><p style='margin-bottom:10px; color:#666'>Priority Delivery" . $foodtime . "</p>";
				 } else {
					$timeline2 = "<p style='margin-top:3px;font-weight:500;color:#000;'>" . $dataf['sname'] . "</p><p style='margin-bottom:10px; color:#666'>" . $delvDate . ", " . $delvTime . "</p>"; 
				 }
				} else {
				$timeline2 = "<p style='margin-top:3px;font-weight:500;color:#000;'>" . $dataf['sname'] . "</p><p style='margin-bottom:10px; color:#666'>" . $delvDate . ", " . $delvTime . "</p>"; 	
				}
				$timeline = "<p style='margin-top:3px;font-weight:500;color:#000;'>" . $dataf['sname'] . "</p><p style='margin-bottom:10px; color:#666'>" . $delvDate . ", " . $delvTime . "</p>";
				$fooddeliveryarrn[$dataf['sid'].$delvDate] = $timeline2;
                $fooddeliveryarr[$dataf['sid'].$delvDate] = $timeline;
				
            } 
        }


        foreach($fooddeliveryarr as $fooddelivery){
			$htmlfood.='<label>'.$fooddelivery.'</label>';
           // echo $fooddelivery;
         //   $food_delivery .= $fooddelivery;
        }
		 foreach($fooddeliveryarrn as $fooddelivery){
			//$htmlfood.='<label>'.$fooddelivery.'</label>';
           // echo $fooddelivery;
            $food_delivery .= $fooddelivery;
        }
		
		$htmlfood.='</div></div><div class="deltypep"></div></li></ul>';
		  echo $htmlfood;
	 } 
        //Meal delivery
        $flgMealTitle = false;
        $fooddeliveryarr = array();
		$fooddeliveryarrn = array();
  echo '<ul class="nationwidedeldel">';
        foreach ($cart_food as $dataf) {
			if ($dataf['section'] == 'tiffin' || $dataf['section']=='alcohol') {
                /* if(!$flgMealTitle) {
                  echo '<p style="margin-top:3px;font-weight:500;color:#000;">Chicago Tiffinwala:</p>';
                  $food_delivery = $food_delivery . '<p style="margin-top:3px;font-weight:500;color:#000;">Chicago Tiffinwala:</p>';
                  $flgMealTitle = true;
                  } */
              
                $delpart = $obj->query("select UPPER(z.food_delivery_partner) food_delivery_partner, UPPER(z.alocohol_delivery_partner) alocohol_delivery_partner, z.state from tbl_store_zip z inner join stores s on z.storeid = s.storeid where z.storeid='" . $dataf['sid'] . "' and (s.by_pass_zipcode = 1 OR z.zip='" . $_COOKIE['postalcode'] . "')");
                $resultdel = $obj->fetchNextObject($delpart);
                $zipstate = strtoupper($resultdel->state);

                $delvTime = '';
                $delvDateNext = '';
                $delvTimeNext = '';
                if ($dataf['freq'] != 'Weekly') {
                    $tmpDate = strtotime($dataf['deliveryDate']);
                    $delvDate = date('d-M-Y', $tmpDate);
                    
                    if(!empty($dataf['deliveryDateNext'])){
											$tmpDateNext = strtotime($dataf['deliveryDateNext']);
                      $delvDateNext = date('d-M-Y', $tmpDateNext);
										}
                    
                } else { 
                        $tmpDate = strtotime($dataf['deliveryDate']);
                        $delvDate = date('d-M-Y (l)', $tmpDate);
                    }  

                if ($resultdel->food_delivery_partner == 'MYVALUE365' || $resultdel->alocohol_delivery_partner == 'MYVALUE365') {
                    if ($dataf['deliveryFromTime'] == '')
                        $delvTime = 'between 5:00 PM - 9:00 PM';
                    else {
                        $timeFrom = strtotime($dataf['deliveryFromTime']);
                        $timeTo = strtotime($dataf['deliveryToTime']);
                        $delvTime = 'between ' . strtoupper(date('g:i a', $timeFrom)) . ' - ' . strtoupper(date('g:i a', $timeTo)) .' ' .getTimeoneForDelivery($zipstate);
                        
                        if(!empty($dataf['deliveryFromTimeNext'])){
													$timeFromNext = strtotime($dataf['deliveryFromTimeNext']);
                          $timeToNext = strtotime($dataf['deliveryToTimeNext']);
                          $delvTimeNext = 'between ' . strtoupper(date('g:i a', $timeFromNext)) . ' - ' . strtoupper(date('g:i a', $timeToNext)) .' ' .getTimeoneForDelivery($zipstate);
												}                        
                    }
                } else {
                    if ($dataf['deliveryFromTime'] == '')
                        $delvTime = '60 - 90 Minutes';
                    else {
                        $timeFrom = strtotime($dataf['deliveryFromTime']);
                        $delvTime = strtoupper(date('g:i a', $timeFrom)) . ' ' .getTimeoneForDelivery($zipstate);
                    }
                }
                if($dataf['section']=='alcohol'){
					 $timeline = '<p style="margin-top:3px;font-weight:500;color:#000;">Alcohol: ' . $dataf['sname'] . '</p><p style="margin-bottom:10px; color:#666">' . $delvDate . ', ' . $delvTime . '</p>';
				} else {
                  if($delvDateNext != '' && $delvTimeNext != '')
                  {
										
										$timeline = "<p style='margin-top:3px;font-weight:500;color:#000;'>Tiffin: " . $dataf['sname'] . "</p><p style='margin-bottom:10px; color:#666'>" . $delvDate . ", " . $delvTime . "</p><p style='margin-bottom:10px; color:#666'> & " . $delvDateNext . ", " . $delvTimeNext . "</p>";
										
										$timeline2 = '<li><div class="deltypem"><div class="deltypemimg"><img src='.SITE_URL.'images/cart/standard.svg></div><div class="deltypemcont"><p>Standard</p><label><p style="margin-top:3px;font-weight:500;color:#000;">Tiffin:' . $dataf['sname'] . '</p><p style="margin-bottom:10px; color:#666">' . $delvDate . ', ' . $delvTime . '</p><p style="margin-bottom:10px; color:#666"> & ' . $delvDateNext . ', ' . $delvTimeNext . '</p></label></div></div><div class="deltypep"></div></li>';
									
									}
									else{
				
				$timeline = "<p style='margin-top:3px;font-weight:500;color:#000;'>Tiffin: " . $dataf['sname'] . "</p><p style='margin-bottom:10px; color:#666'>" . $delvDate . ", " . $delvTime . "</p>";
				$timeline2 = '<li><div class="deltypem"><div class="deltypemimg"><img src='.SITE_URL.'images/cart/standard.svg></div><div class="deltypemcont"><p>Standard</p><label><p style="margin-top:3px;font-weight:500;color:#000;">Tiffin:' . $dataf['sname'] . '</p><p style="margin-bottom:10px; color:#666">' . $delvDate . ', ' . $delvTime . '</p></label></div></div><div class="deltypep"></div></li>';
                
									
                  
				}
				}
                
                   
                    if ($dataf['freq'] == 'Weekly') {
                        $fooddeliveryarr[$dataf['sid'].$delvDate."-Weekly"] = $timeline;
						$fooddeliveryarrn[$dataf['sid'].$delvDate] = $timeline2;
                    } else {
                 if($dataf['sid'] == '297'){
                 $fooddeliveryarr[$dataf['sid'].$delvDate.$dataf['pid']] = $timeline;
			     $fooddeliveryarrn[$dataf['sid'].$delvDate] = $timeline2;
                 } else {
                 $fooddeliveryarr[$dataf['sid'].$delvDate] = $timeline;
			     $fooddeliveryarrn[$dataf['sid'].$delvDate] = $timeline2;
                }
				}
                
               } 
			   if ($dataf['section'] == 'catering') {
                $delpart = $obj->query("select UPPER(z.food_delivery_partner) food_delivery_partner, z.state  from tbl_store_zip z inner join stores s on z.storeid = s.storeid where z.storeid='" . $dataf['sid'] . "' and (s.by_pass_zipcode = 1 OR z.zip='" . $_COOKIE['postalcode'] . "')");
                $resultdel = $obj->fetchNextObject($delpart);
                $zipstate = strtoupper($resultdel->state);

                $delvTime = '';
                $delvDate = strtotime($dataf['deliveryDate']);

                    $tmpDate = strtotime($dataf['deliveryDate']);
                    $delvDate = date('d-M-Y', $tmpDate);

                if ($dataf['deliveryFromTime'] == '')
                    $delvTime = '60 - 90 Minutes.';
                else {
                    $timeFrom = strtotime($dataf['deliveryFromTime']);
                    $delvTime = strtoupper(date('g:i a', $timeFrom)) .' ' .getTimeoneForDelivery($zipstate);
                }

                $timeline = "<p style='margin-top:3px;font-weight:500;color:#000;'>" . $dataf['sname'] . "</p><p style='margin-bottom:10px; color:#666'>" . $delvDate . ", " . $delvTime . "</p>";
				
                $timeline2 = '<li><div class="deltypem"><div class="deltypemimg"><img src='.SITE_URL.'images/cart/standard.svg></div><div class="deltypemcont"><p>Standard</p><label><p style="margin-top:3px;font-weight:500;color:#000;">' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . ', '. $delvTime . '</p></label></div></div><div class="deltypep"></div></li>';
                $fooddeliveryarrn[$dataf['sid'].$delvDate] = $timeline2;
				 
				 
                if (!in_array($timeline, $fooddeliveryarr)) {
                     $timeline;
                    $food_delivery = $food_delivery . $timeline;
                    array_push($fooddeliveryarr, $timeline);
                }
            }
			
            if ($dataf['section'] == 'meal') {
                /* if(!$flgMealTitle) {
                  echo '<p style="margin-top:3px;font-weight:500;color:#000;">Chicago Tiffinwala:</p>';
                  $food_delivery = $food_delivery . '<p style="margin-top:3px;font-weight:500;color:#000;">Chicago Tiffinwala:</p>';
                  $flgMealTitle = true;
                  } */

                $delpart = $obj->query("select UPPER(z.food_delivery_partner) food_delivery_partner from tbl_store_zip z inner join stores s on z.storeid = s.storeid where z.storeid='" . $dataf['sid'] . "' and (s.by_pass_zipcode = 1 OR z.zip='" . $_COOKIE['postalcode'] . "')");
                $resultdel = $obj->fetchNextObject($delpart);

                    $tmpDate = strtotime($dataf['deliveryDate']);
                    $delvDate = date('d-M-Y', $tmpDate);

                $delvTime = '';

                if ($resultdel->food_delivery_partner == 'MYVALUE365') {
                    if ($dataf['deliveryFromTime'] == '')
                        $delvTime = 'between 5:30 PM - 8:30 PM';
                    else
                        $delvTime = 'between ' . $dataf['deliveryFromTime'] . ' - ' . $dataf['deliveryToTime'];
                }
                else {
                    if ($dataf['deliveryFromTime'] == '')
                        $delvTime = '60 - 90 Minutes.';
                    else
                        $delvTime = $dataf['deliveryFromTime'];
                }
                  $timeline = '<p style="margin-top:3px;font-weight:500;color:#000;">Meal: ' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . '</p>';
                $fooddeliveryarr[$dataf['sid'].$delvDate] = $timeline;
                $timeline = '<li><div class="deltypem"><div class="deltypemimg"><img src='.SITE_URL.'images/cart/standard.svg></div><div class="deltypemcont"><p>Standard</p><label><p style="margin-top:3px;font-weight:500;color:#000;">Meal: ' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . '</p></label></div></div><div class="deltypep"></div></li>';
                $fooddeliveryarrn[$dataf['sid'].$delvDate] = $timeline;
                } if($dataf['section'] == 'mealme') {
               

                   
                    $delvDate = date('d-M-Y');
if($_SESSION['mmOID']>0){
                     $delvTime = '';
                           $mmStoreOrder=$obj->query("SELECT storeid, store_name,expected_time_of_arrival
							FROM 	tbl_mealme_order_stores 
							WHERE 	mm_order_tbl_id = '".$_SESSION['mmOID']."'");
                          
              while($mmStore = $obj->fetchNextObject($mmStoreOrder)){
                  $timeline = "<p style='margin-top:3px;font-weight:500;color:#000;'>Food: " . $mmStore->store_name . "</p><p style='margin-top:3px'>" . $delvDate . ", " . $mmStore->expected_time_of_arrival . "</p>";
				  
                $fooddeliveryarr[$mmStore->storeid.$delvDate] = $timeline;
                $timeline = '<li><div class="deltypem"><div class="deltypemimg"><img src='.SITE_URL.'images/cart/standard.svg></div><div class="deltypemcont"><p>Standard</p><label><p style="margin-top:3px;font-weight:500;color:#000;">Food: ' . $mmStore->store_name . '</p><p style="margin-top:3px"> ' . $delvDate . ", " . $mmStore->expected_time_of_arrival .  '</p></label></div></div><div class="deltypep"></div></li>';
                $fooddeliveryarrn[$mmStore->storeid.$delvDate] = $timeline;
                 }
                }
            }
            }
        foreach($fooddeliveryarr as $fooddelivery){
          // echo $fooddelivery;
            $food_delivery .= $fooddelivery;
        }
		foreach($fooddeliveryarrn as $fooddelivery){
          echo $fooddelivery;
            
        }


     


        //Instant Pot delivery
        $fooddeliveryarr = array();
        $fooddeliveryarrn = array();
        foreach ($cart_food as $dataf) {
            if ($dataf['section'] == 'instant_pot' || $dataf['section'] == 'grills') {
                $delpart = $obj->query("select UPPER(z.food_delivery_partner) food_delivery_partner from tbl_store_zip z inner join stores s on z.storeid = s.storeid where z.storeid='" . $dataf['sid'] . "' and (s.by_pass_zipcode = 1 OR z.zip='" . $_COOKIE['postalcode'] . "')");
                $resultdel = $obj->fetchNextObject($delpart);

                    $tmpDate = strtotime($dataf['deliveryDate']);
                    $delvDate = date('d-M-Y', $tmpDate);

                $delvTime = '';

                if($dataf['section'] == 'grills'){
					 $timeline = '<p style="margin-top:3px;font-weight:500;color:#000;">Grills: ' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . '</p>';
                    $fooddeliveryarr[$dataf['sid'].$delvDate] = $timeline;
					$timeline = '<li><div class="deltypem"><div class="deltypemimg"><img src='.SITE_URL.'images/cart/standard.svg></div><div class="deltypemcont"><p>Standard</p><label><p style="margin-top:3px;font-weight:500;color:#000;">Grills: ' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . '</p></label></div></div><div class="deltypep"></div></li>';
                    $fooddeliveryarrn[$dataf['sid'].$delvDate] = $timeline;
			   } else {
				   $timeline = '<p style="margin-top:3px;font-weight:500;color:#000;">Instant Pot: ' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . '</p>';
                    $fooddeliveryarr[$dataf['sid'].$delvDate] = $timeline;
				   $timeline = '<li><div class="deltypem"><div class="deltypemimg"><img src='.SITE_URL.'images/cart/standard.svg></div><div class="deltypemcont"><p>Standard</p><label><p style="margin-top:3px;font-weight:500;color:#000;">Instant Pot: ' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . '</p></label></div></div><div class="deltypep"></div></li>';
                    $fooddeliveryarrn[$dataf['sid'].$delvDate] = $timeline;
					
                }
			}
        }
        foreach ($cart_food as $dataf) {
            if ($dataf['section'] == 'organic-box') {
        
                
                    $tmpDate = strtotime($dataf['deliveryDate']);
                    $delvDate = date('d-M-Y', $tmpDate);
 
                    $delvTime = '';
                        
                    if($dataf['deliveryType']=='expedite'){
						  $timeline = '<li><div class="deltypem"><div class="deltypemimg"><img src='.SITE_URL.'images/cart/priority.svg></div><div class="deltypemcont"><p>Expedite</p><label><p style="margin-top:3px;font-weight:500;color:#000;">' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . '</p></label></div></div><div class="deltypep"></div></li>';
						  $timeline2 = '<p style="margin-top:3px;font-weight:500;color:#000;">' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . '(Expedite Delivery)</p>';
                    
					 } else {
						 $timeline = '<li><div class="deltypem"><div class="deltypemimg"><img src='.SITE_URL.'images/cart/standard.svg></div><div class="deltypemcont"><p>Standard</p><p style="margin-top:3px;font-weight:500;color:#000;">' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . '</p></label></div></div><div class="deltypep"></div></li>';
                        $timeline2 = '<p style="margin-top:3px;font-weight:500;color:#000;">' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . '(Standard Delivery)</p>';						 
					 }
					 $fooddeliveryarrn[$dataf['sid'].$delvDate] = $timeline;
                    $fooddeliveryarr[$dataf['sid'].$delvDate] = $timeline2;
 			}
        }
		foreach ($cart_food as $dataf) {
            if ($dataf['section'] == 'rotikaa-kit') {
        
                    $tmpDate = strtotime($dataf['deliveryDate']);
                    $delvDate = date('d-M-Y', $tmpDate);
                    
 
                    $delvTime = '';

                    if($dataf['deliveryType']=='expedite'){
						  $timeline = '<li><div class="deltypem"><div class="deltypemimg"><img src='.SITE_URL.'images/cart/priority.svg></div><div class="deltypemcont"><p>Expedite</p><label><p style="margin-top:3px;font-weight:500;color:#000;">' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . '</p></label></div></div><div class="deltypep"></div></li>';
						  $timeline2 = '<p style="margin-top:3px;font-weight:500;color:#000;">' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . '(Expedite Delivery)</p>';
                    
					 } else {
						 $timeline = '<li><div class="deltypem"><div class="deltypemimg"><img src='.SITE_URL.'images/cart/standard.svg></div><div class="deltypemcont"><p>Standard</p><p style="margin-top:3px;font-weight:500;color:#000;">' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . '</p></label></div></div><div class="deltypep"></div></li>';
                        $timeline2 = '<p style="margin-top:3px;font-weight:500;color:#000;">' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . '(Standard Delivery)</p>';						 
					 }
					 $fooddeliveryarrn[$dataf['sid'].$delvDate] = $timeline;
                    $fooddeliveryarr[$dataf['sid'].$delvDate] = $timeline2;
 			}
        }
		foreach ($cart_food as $dataf) {
            if ($dataf['section'] == 'icecreambox' || $dataf['section'] == 'currybox') {
        
                    $tmpDate = strtotime($dataf['deliveryDate']);
                    $delvDate = date('d-M-Y', $tmpDate);
 
                    $delvTime = '';
                   if($dataf['deliveryType']=='expedite'){
						  $timeline = '<li><div class="deltypem"><div class="deltypemimg"><img src='.SITE_URL.'images/cart/priority.svg></div><div class="deltypemcont"><p>Expedite</p><label><p style="margin-top:3px;font-weight:500;color:#000;">' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . '</p></label></div></div><div class="deltypep"></div></li>';
						  $timeline2 = '<p style="margin-top:3px;font-weight:500;color:#000;">' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . '(Expedite Delivery)</p>';
                    
					 } else {
						 $timeline = '<li><div class="deltypem"><div class="deltypemimg"><img src='.SITE_URL.'images/cart/standard.svg></div><div class="deltypemcont"><p>Standard</p><p style="margin-top:3px;font-weight:500;color:#000;">' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . '</p></label></div></div><div class="deltypep"></div></li>';
                        $timeline2 = '<p style="margin-top:3px;font-weight:500;color:#000;">' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . '(Standard Delivery)</p>';						 
					 }
					 $fooddeliveryarrn[$dataf['sid'].$delvDate] = $timeline;
                    $fooddeliveryarr[$dataf['sid'].$delvDate] = $timeline2;
                      
 			}
        }
		foreach ($cart_food as $dataf) {
            if ($dataf['section'] == 'sweetandsancks' || $dataf['section'] == 'mithaas' || $dataf['section'] == 'tsalon'  || $dataf['section'] == 'just' || $dataf['section'] == 'moments' || $dataf['section']=='madhu-chocolate' || $dataf['section']=='almond-house' || $dataf['section']=='baklava-premium-sweets' || $dataf['section']=='chai-box' || $dataf['section']=='sweedesi' || $dataf['section']=='shaheen-sweets' || $dataf['section']=='catering_nationwide') {
        
                  
                    $tmpDate = strtotime($dataf['deliveryDate']);
                    $delvDate = date('d-M-Y', $tmpDate);
                    $deliveryType='';
                    
 
                    $delvTime = '';
					 if($dataf['deliveryType']=='expedite'){
						  $timeline = '<li><div class="deltypem"><div class="deltypemimg"><img src='.SITE_URL.'images/cart/priority.svg></div><div class="deltypemcont"><p>Expedite</p><label><p style="margin-top:3px;font-weight:500;color:#000;">' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . '</p></label></div></div><div class="deltypep"></div></li>';
						  $timeline2 = '<p style="margin-top:3px;font-weight:500;color:#000;">' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . '(Expedite Delivery)</p>';
                    
					 } else {
						 $timeline = '<li><div class="deltypem"><div class="deltypemimg"><img src='.SITE_URL.'images/cart/standard.svg></div><div class="deltypemcont"><p>Standard</p><label><p style="margin-top:3px;font-weight:500;color:#000;">' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . '</p></label></div></div><div class="deltypep"></div></li>';
                        $timeline2 = '<p style="margin-top:3px;font-weight:500;color:#000;">' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . '(Standard Delivery)</p>';						 
					 }
					 $fooddeliveryarrn[$dataf['sid'].$delvDate] = $timeline;
                    $fooddeliveryarr[$dataf['sid'].$delvDate] = $timeline2;
 			}
        }
		foreach ($cart_food as $dataf) {
            if ($dataf['section'] == 'seasoning') {
        
                
                    $tmpDate = strtotime($dataf['deliveryDate']);
                    $delvDate = date('d-M-Y', $tmpDate);
 
                    $delvTime = '';
                     if($dataf['deliveryType']=='expedite'){
						  $timeline = '<li><div class="deltypem"><div class="deltypemimg"><img src='.SITE_URL.'images/cart/priority.svg></div><div class="deltypemcont"><p>Expedite</p><label><p style="margin-top:3px;font-weight:500;color:#000;">' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . '</p></label></div></div><div class="deltypep"></div></li>';
						  $timeline2 = '<p style="margin-top:3px;font-weight:500;color:#000;">' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . '(Expedite Delivery)</p>';
                    
					 } else {
						 $timeline = '<li><div class="deltypem"><div class="deltypemimg"><img src='.SITE_URL.'images/cart/standard.svg></div><div class="deltypemcont"><p>Standard</p><p style="margin-top:3px;font-weight:500;color:#000;">' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . '</p></label></div></div><div class="deltypep"></div></li>';
                        $timeline2 = '<p style="margin-top:3px;font-weight:500;color:#000;">' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . '(Standard Delivery)</p>';						 
					 }
					 $fooddeliveryarrn[$dataf['sid'].$delvDate] = $timeline;
                    $fooddeliveryarr[$dataf['sid'].$delvDate] = $timeline2;
                     
                    $fooddeliveryarr[$dataf['sid'].$delvDate] = $timeline;
 			}
        }
		foreach ($cart_food as $dataf) {
            if ($dataf['section'] == 'kimbalabox' || $dataf['section'] == 'holidaygiftbox') {

                    $tmpDate = strtotime($dataf['deliveryDate']);
                    $delvDate = date('d-M-Y', $tmpDate);
 
                    $delvTime = '';

                      if($dataf['deliveryType']=='expedite'){
						  $timeline = '<li><div class="deltypem"><div class="deltypemimg"><img src='.SITE_URL.'images/cart/priority.svg></div><div class="deltypemcont"><p>Expedite</p><label><p style="margin-top:3px;font-weight:500;color:#000;">' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . '</p></label></div></div><div class="deltypep"></div></li>';
						  $timeline2 = '<p style="margin-top:3px;font-weight:500;color:#000;">' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . '(Expedite Delivery)</p>';
                    
					 } else {
						 $timeline = '<li><div class="deltypem"><div class="deltypemimg"><img src='.SITE_URL.'images/cart/standard.svg></div><div class="deltypemcont"><p>Standard</p><p style="margin-top:3px;font-weight:500;color:#000;">' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . '</p></label></div></div><div class="deltypep"></div></li>';
                        $timeline2 = '<p style="margin-top:3px;font-weight:500;color:#000;">' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . '(Standard Delivery)</p>';						 
					 }
					 $fooddeliveryarrn[$dataf['sid'].$delvDate] = $timeline;
                    $fooddeliveryarr[$dataf['sid'].$delvDate] = $timeline2;
 			}
        }
        
       foreach ($cart_food as $dataf) {
            if ($dataf['section'] == 'mangos' ) {
                    $tmpDate = strtotime($dataf['deliveryDate']);
                    $delvDate = date('d-M-Y', $tmpDate);
                    $delvTime = '';
                    if($dataf['deliveryType']=='expedite'){
						  $timeline = '<li><div class="deltypem"><div class="deltypemimg"><img src='.SITE_URL.'images/cart/priority.svg></div><div class="deltypemcont"><p>Expedite</p><label><p style="margin-top:3px;font-weight:500;color:#000;">' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . '</p></label></div></div><div class="deltypep"></div></li>';
						  $timeline2 = '<p style="margin-top:3px;font-weight:500;color:#000;">' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . '(Expedite Delivery)</p>';
                    
					 } else {
						 $timeline = '<li><div class="deltypem"><div class="deltypemimg"><img src='.SITE_URL.'images/cart/standard.svg></div><div class="deltypemcont"><p>Standard</p><p style="margin-top:3px;font-weight:500;color:#000;">' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . '</p></label></div></div><div class="deltypep"></div></li>';
                        $timeline2 = '<p style="margin-top:3px;font-weight:500;color:#000;">' . $dataf['sname'] . '</p><p style="margin-top:3px"> ' . $delvDate . '(Standard Delivery)</p>';						 
					 }
					 $fooddeliveryarrn[$dataf['sid'].$delvDate] = $timeline;
                    $fooddeliveryarr[$dataf['sid'].$delvDate] = $timeline2;
 			      }
        }
        
        foreach($fooddeliveryarr as $fooddelivery){
           // echo $fooddelivery;
            $food_delivery .= $fooddelivery;
        }
		foreach($fooddeliveryarrn as $fooddelivery){
            echo $fooddelivery;
            //$food_delivery .= $fooddelivery;
        }
   echo '</ul>';
        $_SESSION['food_deliverytime'] = $food_delivery;
    }
    
    $giftcarddeliveryarr = array();
	$giftcarddeliveryarrn=array();
    $cart_giftcard = $_SESSION['cart_giftcard'];
    ?>
    <script>
    var cart_giftcard_session = "<?php echo $cart_giftcard;?>";
    var cart_giftcard_lstorage = window.localStorage.getItem('cart_giftcard');
    </script>
    <?php  
    $giftcard_delivery = '';
    usort($cart_giftcard, 'date_sort');
    if (count($cart_giftcard) > 0) {
		  echo '<ul class="nationwidedeldel">';
        if ($subtotalgc > 0) {
            $giftcard_delivery = "<br><strong class='mainheaddel'>Gift Card:</strong> ";
            echo $giftcard_delivery;
        }
        //Gift Card delivery
        foreach ($cart_giftcard as $dataf) {

                $productName = $dataf['name'];
								$tmpDate = strtotime($dataf['deliveryDate']);
								$delvDate = date('d-M-Y', $tmpDate);
                $timeline2 = '<p style="margin-bottom:10px; color:#666">' . $productName . '</p><p style="margin-bottom:10px; color:#666">' . $delvDate . '</p>';
								$giftcarddeliveryarr[$productName.$tmpDate] = $timeline;
                //$timeline = '<p style="margin-top:3px;font-weight:500;color:#000;">' . $dataf['sname'] . '</p>
				 $timeline = '<li><div class="deltypem"><div class="deltypemimg"></div><div class="deltypemcont"><label><p style="margin-bottom:10px; color:#666">' . $productName . '</p><p style="margin-bottom:10px; color:#666">' . $delvDate . '</p></label></div></div><div class="deltypep"></div></li>';
                $giftcarddeliveryarrn[$productName.$tmpDate] = $timeline;
				$giftcarddeliveryarr[$productName.$tmpDate] = $timeline2;
        }
        
        foreach($giftcarddeliveryarr as $giftdelivery){
           // echo $giftdelivery;
            $giftcard_delivery .= $giftdelivery;
        }
		 foreach($giftcarddeliveryarrn as $giftdelivery){
            echo $giftdelivery;
            //$giftcard_delivery .= $giftdelivery;
        }
        $_SESSION['giftcard_deliverytime'] = $giftcard_delivery;
		  echo '</ul>';
		}
    

	$eventdeliveryarr = array();
	$eventdeliveryarrn = array();
    $cart_event = $_SESSION['cart_event'];
    ?>
    <script>
    var cart_event_session = "<?php echo $cart_event;?>";
    var cart_event_lstorage = window.localStorage.getItem('cart_events');
    </script>
    <?php  
    $event_delivery = '';
    usort($cart_event, 'date_sort');
    if (count($cart_event) > 0) {
		 
        if ($subtotale > 0) {
            $event_delivery = "<br><strong class='mainheaddel'>Event:</strong> ";
            echo $event_delivery;
        }
		 echo '<ul class="nationwidedeldel">';
        //Event delivery
        foreach ($cart_event as $dataf) {

                $productName = $dataf['name'];
								$tmpDate = strtotime($dataf['deliveryDate']);
								$delvDate = date('d-M-Y', $tmpDate);
								
					 $delvTime = '';
                

                if ($dataf['deliveryFromTime'] == '') {
                     $delvTime = '';
				} else {
                    $delvTime  = $dataf['deliveryFromTime'];
                    
                }			

                //$timeline = '<p style="margin-top:3px;font-weight:500;color:#000;">' . $dataf['sname'] . '</p>
                //$timeline = '';
				$timeline2 = '<p style="margin-bottom:10px; color:#666">' . $productName . '</p><p style="margin-bottom:10px; color:#666">' . $dataf['deliveryDisplayDate'] .'</p>';
								$eventdeliveryarr[$productName.$tmpDate] = $timeline2;
				 $timeline = '<li><div class="deltypem"><div class="deltypemimg"></div><div class="deltypemcont"><label><p style="margin-bottom:10px; color:#666">' . $productName . '</p><p style="margin-bottom:10px; color:#666">' . $dataf['deliveryDisplayDate'] .'</p></label></div></div><div class="deltypep"></div></li>';
								$eventdeliveryarrn[$productName.$tmpDate] = $timeline;
        }
       
        foreach($eventdeliveryarr as $eventdelivery){
          //  echo $eventdelivery;
            $event_delivery .= $eventdelivery;
        }
		 foreach($eventdeliveryarrn as $eventdelivery){
          echo $eventdelivery;
            //$event_delivery .= $eventdelivery;
        }
        $_SESSION['event_deliverytime'] = $event_delivery;
		  echo '</ul>';
		}
		
		$appareldeliveryarr = array();
	$appareldeliveryarrn = array();
    $cart_apparel = $_SESSION['cart_apparel'];
    ?>
    <script>
    var cart_apparel_session = "<?php echo $cart_apparel;?>";
    var cart_apparel_lstorage = window.localStorage.getItem('cart_apparel');
    </script>
    <?php  
    $apparel_delivery = '';
    usort($cart_apparel, 'date_sort');
    if (count($cart_apparel) > 0) {
		  
        if ($subtotala > 0) {
            $apparel_delivery = "<br><strong class='mainheaddel'>Apparel:</strong><br> ";
            echo $apparel_delivery;
        }
		echo '<ul class="nationwidedeldel">';
        //Apparel delivery
		$aa=0;
        foreach ($cart_apparel as $dataf) {

                $productName = $dataf['sname'];
								$tmpDate = strtotime($dataf['deliveryDate']);
								$delvDate = date('d-M-Y', $tmpDate);
								
					 $delvTime = '';
                

                if ($dataf['deliveryFromTime'] == '') {
                     $delvTime = '';
				} else {
                    $delvTime  = $dataf['deliveryFromTime'];
                    
                }			

                //$timeline = '<p style="margin-top:3px;font-weight:500;color:#000;">' . $dataf['sname'] . '</p>
                //$timeline = '';
				if($a==0){
				$timeline2 = '<p style="margin-bottom:10px; color:#666">' . $productName . '</p><p style="margin-bottom:10px; color:#666">' . $delvDate .'</p>';
								$appareldeliveryarr[$productName.$tmpDate] = $timeline2;
				 $timeline = '<li><div class="deltypem"><div class="deltypemimg"></div><div class="deltypemcont"><label><p style="margin-bottom:10px; color:#666">' . $productName . '</p><p style="margin-bottom:10px; color:#666">' . $delvDate.'</p></label></div></div><div class="deltypep"></div></li>';
								$appareldeliveryarrn[$productName.$tmpDate] = $timeline;
				}
		$a++;						
        }
        foreach($appareldeliveryarr as $appareldelivery){
          //  echo $eventdelivery;
            $apparel_delivery .= $appareldelivery;
        }
		 foreach($appareldeliveryarrn as $appareldelivery){
          echo $appareldelivery;
          
        }
        $_SESSION['apparel_deliverytime'] = $apparel_delivery;
		  echo '</ul>';
		}
    
    
	$pujadeliveryarr = array();
	$pujadeliveryarrn = array();
    $cart_puja = $_SESSION['cart_puja'];
    ?>
    <script>
    var cart_puja_session = "<?php echo $cart_puja;?>";
    var cart_puja_lstorage = window.localStorage.getItem('cart_puja');
    </script>
    <?php  
    $puja_delivery = '';
    usort($cart_puja, 'date_sort');
    if (count($cart_puja) > 0) {
		  //Event delivery
		 
            $puja_delivery = "<br><strong class='mainheaddel'>Shubh Puja:</strong> ";
            echo $puja_delivery;
        
		    echo '<ul class="nationwidedeldel">';
        foreach ($cart_puja as $datap) {
                 if($datap['deliveryDate']!=''){
                                
								$tmpDate = strtotime($datap['deliveryDate']);
								$delvDate = date('d-M-Y', $tmpDate);
								$delvtoDate='';
				 }
				 $productName = $datap['name'];
				 $customize = '';
				 
						if($datap['deliveryToDate']!='' && $datap['deliveryToDate']!=$datap['deliveryDate']){
							$tmpDate = strtotime($datap['deliveryToDate']);
							$delvtoDate = date('d-M-Y', $tmpDate);
							$delvtoDate='-'.$delvtoDate;
						}							
					 $delvTime = '';
                if ($datap['deliveryFromTime'] == '')
                        $delvTime = '';
                    else {
                       $timeFrom = strtotime($datap['deliveryFromTime']);
                      $timeTo = strtotime($datap['deliveryToTime']);
                      $delvTime = ',between ' . strtoupper(date('g:i a', $timeFrom)) . ' - ' . strtoupper(date('g:i a', $timeTo));
                    }

               	if($delvDate!=''){
					// $customize='('.$datap['customize'].')';
				}

                //$timeline = '<p style="margin-top:3px;font-weight:500;color:#000;">' . $dataf['sname'] . '</p>
                $timeline = '<p style="margin-bottom:10px; color:#666">' . $productName.$customize.'</p>';
				if($delvDate!='' || $delvTime!='' || $delvtoDate!=''){
				$timeline.='<p style="margin-bottom:10px; color:#666">' . $delvDate . $delvtoDate. $delvTime . '</p>';
				}  
				 $timeline2 = '<li><div class="deltypem"><div class="deltypemimg"></div><div class="deltypemcont"><label>'.$timeline.'</label></div></div><div class="deltypep"></div></li>';
				
								$pujadeliveryarrn[$productName.$tmpDate] = $timeline2;
								$pujadeliveryarr[$productName.$tmpDate] = $timeline;
		                        
        }
       
      
       
        foreach($pujadeliveryarr as $pujadelivery){
           // echo $pujadelivery;
			
            $puja_delivery .= $pujadelivery;
        }
		 foreach($pujadeliveryarrn as $pujadelivery){
            echo $pujadelivery;
			
            //$puja_delivery .= $pujadelivery;
        }
		if (count($pujadeliveryarr)>0) {
			        $_SESSION['puja_deliverytime'] = $puja_delivery;
		} else {
			$_SESSION['puja_deliverytime'] = '';
		}
  echo '</ul>';
		}
    
    ?>
	
	
	</span>
                                                <!--<textarea style="display:none" id="grocerytime"><?php
                                                        if ($_SESSION['grocery_deliverytime'] != '') {
                                                            if ($_SESSION['food_deliverytime'] != '') {
                                                                echo "Grocery: " . $_SESSION['grocery_deliverytime'];
                                                            } else {
                                                                echo $_SESSION['grocery_deliverytime'];
                                                            }
                                                        }
                                                        ?></textarea>
                                                 
                                                  <textarea style="display:none" id="foodtime" > -->
    <?php
//  if($_SESSION['food_deliverytime']!=''){
//  if($_SESSION['grocery_deliverytime']!=''){ echo "<br>Food: ";
//  $fooddeliveryarr=$_SESSION['food_deliverytime'];
//  foreach($fooddeliveryarr as $fooddelivery) {
// 	echo $fooddelivery;
// 	} 
// 	}else{ 
//  $fooddeliveryarr=$_SESSION['food_deliverytime'];
//  foreach($fooddeliveryarr as $fooddelivery) {
// 	echo $fooddelivery;
// 	} 
// 	} } 
    ?>
                                                <!-- </textarea> -->

                                                <script>
                                                    //document.cookie = "deliverytime" + "=" + document.getElementById("deliverystate").innerHTML + ";";
                                                    //setCookie("deliverytime", document.getElementById("deliverystate").innerHTML);                                                    
                                                    //  document.cookie = "delvTest" + "=" +  encodeURI(document.getElementById("deliverystate").innerHTML) + ";" + "path=/";
                                                    // window.localStorage.setItem("deliverytime", document.getElementById("deliverystate").innerHTML);

                                                    // var groceryvalue=document.getElementById("grocerytime").value;
                                                    // var foodvalue=document.getElementById("foodtime").value;
                                                    //   document.cookie = "grocerydeliverytime" + "=" + groceryvalue + ";" + ";path=/";
                                                    //   document.cookie = "fooddeliverytime" + "=" + foodvalue + ";" + ";path=/";
                                                </script>


    <?php
    $_SESSION['delivery_type'] == 'Home Delivery';
} //grocery_tab_index
else {
    ?>
	<div class="picupwrapper">
                                                <p class="addrslbl"><span>Pickup:</span></p>
                                               <?php
                                            $_SESSION['delivery_type'] == 'Pick';
                                            $pickmsg = '';
                                            for ($s = 0; $s < count($storeidarr); $s++) {
                                                $pickmsg = $pickmsg . " <p class='addrsrc' id='addrsrc'><br><span id='addStreet'><strong>" . getFieldWhere('storename', 'stores', 'storeid', $storeidarr[$s]) . "</strong>: " . getFieldWhere('storeaddress', 'stores', 'storeid', $storeidarr[$s]) . "</span> </p>";
        ?>
                                                   
                                                        <?php
                                                    } // for loop $s end 
                                                    echo $_SESSION['pickup_delivery_time'] = $pickmsg;
                                                    ?>
                                                <br>
                                                <span id="deliverystate"><strong>Estimated Pickup:<br></strong>
    <?php
    //grocery delivery   
    if ($pickup_grocery) {
        echo $estimated_pickup = "<strong><br>Groceries: </strong>30-45 minutes";

        $_SESSION['pickup_delivery_time'] .= "<br/>" . $estimated_pickup;
    }


    $fooddeliveryarr = array();
    $cart_food = $_SESSION['cart_food'];
    $food_delivery = '';

    if ($pickup_food) {
        echo $estimated_pickup = "<br><strong class='mainheaddel'>Food:</strong> " . "15-20 minutes";
        $_SESSION['pickup_delivery_time'] .= $estimated_pickup;

        //Restuarants delivery
    }
    ?></span>
	</div>
                                                    <?php
                                                    }
                                                    ?>
		</div>
	</div>
	<?php if($chkSubtotaltohide!=0){?>
		<div class="clsdeliverybox">
		<div class="clsdeliveryboxinner">
		<div class="delivery_notesbox-wrapper">
                                                
                                                
                                                <label><b>Delivery Notes</b></label>
                                                <textarea style="width:100%; height:50px;" id="delivery_notesbox" name="delivery_notesbox"><?php if(isset($_COOKIE['delivery_notes']) && $_COOKIE['delivery_notes']!='') { echo parseField($_COOKIE['delivery_notes']); } ?></textarea> 
												
                                            </div>
											</div>
		</div>
		<?php }  else {
			$_COOKIE['delivery_notes']='';
		}?>
		<?php
		             if ($_COOKIE['grocery_tab_index'] == 0) {
                            //store loworder charge starts
                            //$productids=implode(',',$productidarr);
                            $storemintotal = 0;
                            //$productsum = 0;
                            $productsaving = 0;
                            for ($x = 0; $x < count($storeidarr); $x++) {
                                $sqlstore = $obj->query("select hike,z.minimum,minimum_fee,pickup,delivery from tbl_store_zip z inner join stores s on z.storeid=s.storeid where s.storeid='$storeidarr[$x]' and (s.by_pass_zipcode = 1 OR z.zip='" . $_COOKIE['postalcode'] . "')");
                                $results = $obj->fetchNextObject($sqlstore);

                                $productsum = 0;

                                for ($p = 0; $p < count($productidarr); $p++) {
                                    $flgSkipProd = false;

                                    if (in_array($productidarr[$p], $productidarrf)) { //if Food products
                                        $indxFood = $p - count($productidarrg);
                                        $section = $sectionf[$indxFood];
                                         
                                        if ($section == 'food' || $section == 'tiffin' ){
                                            $sqlprod = $obj->query("select tbl_productprice.sell_price,tbl_productprice.mrp_price from tbl_product inner join tbl_productprice on tbl_product.id=tbl_productprice.product_id where tbl_product.storeid='$storeidarr[$x]' and tbl_product.id='$productidarr[$p]'");
                                            $result = $obj->fetchNextObject($sqlprod);
    
                                            if ($foodPopUpDiscountPerc != '0')
                                                $result->sell_price =  number_format($result->mrp_price - ($result->mrp_price*$foodPopUpDiscountPerc/100),2,'.','');

                                            $productsum = number_format($productsum + (hikerounder($result->sell_price, $results->hike) * $qtyarr[$p]), 2);
                                            $mrpprice = hikerounder($result->mrp_price, $results->hike) * $qtyarr[$p];
                                            $sellprice = hikerounder($result->sell_price, $results->hike) * $qtyarr[$p];
                                            $productsaving = number_format($productsaving + ($mrpprice - $sellprice), 2);

                                            $flgSkipProd = true;
                                        }
                                        else if ($section == 'catering' || $section == 'instant_pot' || $section == 'grills' || $section == 'alcohol') { //if Food - Catering products
                                            $sqlprod = $obj->query("SELECT p.storeid, p.product_name,a.sellprice sell_price,a.mrpprice mrp_price,a.discount,a.tax_method,a.tax_value FROM tbl_productaddon a INNER JOIN tbl_product p on p.id = a.productid where a.id ='" . $sizeIDf[$indxFood] . "' AND p.storeid = '$storeidarr[$x]'");
                                            $result = $obj->fetchNextObject($sqlprod);

                                            if ($section == 'catering' && $foodPopUpDiscountPerc != '0')
                                                $result->sell_price =  number_format($result->mrpprice - ($result->mrpprice*$foodPopUpDiscountPerc/100),2,'.','');

                                            $productsum = number_format($productsum + (hikerounder($result->sell_price, $results->hike) * $qtyarr[$p]), 2,'.','');
                                            $mrpprice = hikerounder($result->mrp_price, $results->hike) * $qtyarr[$p];
                                            $sellprice = hikerounder($result->sell_price, $results->hike) * $qtyarr[$p];
                                            $productsaving = number_format($productsaving + ($mrpprice - $sellprice), 2,'.','');

                                            $flgSkipProd = true;
                                        }else if( $section == 'organic-box' || $section == 'tsalon' || $section == 'madhu-chocolate' || $section =='almond-house' || $section=='baklava-premium-sweets' || $section =='chai-box' || $section =='sweedesi' || $section =='shaheen-sweets' || $section =='just' || $section =='catering_nationwide'){
                                            $add_on_sizeid = $add_on_sizeids[$indxFood];
											$wherem='';
                                            if($section == 'organic-box'){
											$sectionid=10;	 
											} else if($section == 'tsalon' ){
												$sectionid=27;
											} else if($section == 'madhu-chocolate' ){
												$sectionid=28;
											}  else if($section == 'almond-house' ){
												$sectionid=29;
											}
                                            else if($section == 'baklava-premium-sweets' ){
												$sectionid=30;
											}
										    else if($section == 'chai-box' ){
												$sectionid=31;
											}
											 else if($section == 'sweedesi' ){
												$sectionid=33;
											}
                                            else if($section == 'shaheen-sweets' ){
												$sectionid=34;
											}
											 else if($section == 'just' ){
												$sectionid=36;
											$wherem.=" and p.id='$productidarr[$p]' ";
											}
											 else if($section == 'catering_nationwide' ){
												$sectionid=37;
											$wherem.=" and p.id='$productidarr[$p]' ";
											}
                                            if ($add_on_sizeid != '') {
                                                
                                                    $substype = $subscriptiontypef[$indxFood];
													$qtyf = $qtyarrf[$indxFood];
													
                                                    $addonid = explode(',', $add_on_sizeid);
													
                                                     $add_on_qtys = $addonQtysf[$indxFood];
                                                    $addonqty = explode(',', $add_on_qtys);

                                                $query = "SELECT 
                                                            p.storeid,
                                                            tbl_productprice.monthly_discount,
                                                            tbl_productprice.biweekly_discount,
                                                            tbl_productprice.weekly_discount,
                                                            tbl_productprice.discount
                                                          FROM
                                                            tbl_product p
                                                            INNER JOIN stores s ON (s.storeid = p.storeid)
                                                            INNER JOIN tbl_productprice ON (p.id = tbl_productprice.product_id)
                                                          WHERE
                                                            p.`status` = 1 AND 
                                                            p.only_for_addon = 0 AND 
                                                            p.`status` = 1 AND 
                                                            s.sectionid = $sectionid  $wherem 
                                                                    ";
                                                    $prodStoreObj = $obj->query($query);
                                                    $resultStore = $obj->fetchNextObject($prodStoreObj);
                                                    if ($substype == 'One Time') {
                                                        $discount = $resultStore->discount;
                                                    } else if ($substype == 'Monthly') {
                                                        $discount = $resultStore->monthly_discount;
                                                    } else if ($substype == 'Bi Weekly') {
                                                        $discount = $resultStore->biweekly_discount;
                                                    } else if ($substype == 'Weekly') {
                                                        $discount = $resultStore->weekly_discount;
                                                    }

                                                    // $tax_value = getTaxhike($rsltprodSizeObj->sell_price, $rsltprodSizeObj->hike, $rsltprodSizeObj->tax_method, $rsltprodSizeObj->tax_value);
$stid =rtrim($storeidarr[$x]);
$stid = trim(preg_replace('/\s+/', ' ', $stid));
                                                    for ($i = 0; $i < count($addonid); $i++) {
														
														if($stid>0 && !empty($stid) && $stid !='')  {
															
															
														

                                                        $sqladdon = $obj->query("SELECT 
                                                                                tbl_productaddon.sellprice,
                                                                                tbl_productaddon.mrpprice,
                                                                                tbl_productaddon.size,
                                                                                tbl_productaddon.tax_value,
                                                                                tbl_productaddon.tax_method
                                                                              FROM
                                                                                tbl_product
                                                                                INNER JOIN tbl_productaddon ON (tbl_product.id = tbl_productaddon.productid)
                                                                              WHERE
                                                                                tbl_productaddon.id =" . $addonid[$i] ."  and tbl_product.storeid   = " . trim($storeidarr[$x]));
                                                        $sqladdOnResult = $obj->fetchNextObject($sqladdon);
                                                        $sellprice = number_format($sqladdOnResult->sellprice - number_format($sqladdOnResult->sellprice * ($discount / 100), 2,'.',''), 2,'.','');
                                                        $mrpprice = hikerounder($sqladdOnResult->mrpprice, $storedata->hike) * ($addonqty[$p]*$qtyf);
                                                        // $sellprice = number_format(hikerounder($sellprice, $storedata->hike) * $addonqty[$p], 2);
                                                        $productsum += number_format(hikerounder($sellprice, $storedata->hike) * ($addonqty[$i]*$qtyf), 2,'.','');
														}
                                                        
                                                    }
                                                }
                                                $flgSkipProd = true;
                                           } else if($section == 'seasoning'){
                                  $substype = $subscriptiontypef[$indxFood];
                                      
                                    $query = "SELECT 
                                                p.storeid,
                                                tbl_productprice.monthly_discount,
                                                tbl_productprice.biweekly_discount,
                                                tbl_productprice.weekly_discount,
                                                tbl_productprice.discount
                                              FROM
                                                tbl_product p
                                                INNER JOIN stores s ON (s.storeid = p.storeid)
                                                INNER JOIN tbl_productprice ON (p.id = tbl_productprice.product_id)
                                              WHERE
                                                p.`status` = 1 AND 
                                                p.only_for_addon = 0 AND 
                                                p.`status` = 1 AND 
                                                s.sectionid = 11 
                                                        ";
                                        $prodStoreObj = $obj->query($query);
                                        $resultStore = $obj->fetchNextObject($prodStoreObj);
                                       if ($substype == 'One Time') {
                                            $discount = $resultStore->discount;
                                        } else if ($substype == 'Monthly') {
                                            $discount = $resultStore->monthly_discount;
                                        } else if ($substype == 'Bi Weekly') {
                                            $discount = $resultStore->biweekly_discount;
                                        } else if ($substype == 'Weekly') {
                                            $discount = $resultStore->weekly_discount;
                                        }
                                        $discount = number_format($discount,2);
                                        $add_on_qtys = $addonQtysf[$indxFood];
                                        $addonsizeids = explode(',', $add_on_sizeids[$indxFood]);
                                        $addonqty = explode(',', $add_on_qtys);

                                          for ($sizeCounter = 0; $sizeCounter < count($addonsizeids); $sizeCounter++) {
                                            $sqlprod = $obj->query("select tbl_productprice.sell_price,tbl_productprice.mrp_price from tbl_product inner join tbl_productprice on tbl_product.id=tbl_productprice.product_id where tbl_product.storeid='$storeidarr[$x]' and tbl_productprice.id='$addonsizeids[$sizeCounter]'");
                                            $result = $obj->fetchNextObject($sqlprod);

                                            $sellprice = hikerounder($result->sell_price, $results->hike)  ;
                                            $sellprice= number_format( $sellprice - number_format(($sellprice * $discount / 100)),2);
                                            $productsum = number_format($productsum + (hikerounder($sellprice, $results->hike) * $addonqty[$sizeCounter]), 2);
                                            $mrpprice = hikerounder($result->sell_price, $results->hike) * $addonqty[$sizeCounter];

                                            $productsaving = number_format($productsaving + ($mrpprice - $sellprice), 2);
                                         }
                              $flgSkipProd = true;
							}
                                        
                            }  else if(in_array($productidarr[$p], $productidarra)) {//if Apparel products
							  
                  $indxa = $p - count($productidarrg) - count($productidarrf) - count($productidarre) - count($productidarrp);
                                        $section = $sectiona[$indxa];
										if($section=='very-much-indian'){
										
										$sqlprod = $obj->query("select tbl_productprice.sell_price,tbl_productprice.mrp_price from tbl_product inner join tbl_productprice on tbl_product.id=tbl_productprice.product_id where tbl_product.storeid='$storeidarr[$x]' and tbl_product.id='$productidarr[$p]'");
                                        $result = $obj->fetchNextObject($sqlprod);

                                        $productsum = number_format($productsum + (hikerounder($result->sell_price, $results->hike) * $qtyarr[$p]), 2,'.','');
                                        $mrpprice = hikerounder($result->mrp_price, $results->hike) * $qtyarr[$p];
                                        $sellprice = hikerounder($result->sell_price, $results->hike) * $qtyarr[$p];
                                        $productsaving = number_format($productsaving + ($mrpprice - $sellprice), 2,'.','');
									}
									    $flgSkipProd = true;
									}
                                     if (!$flgSkipProd) { //Non food + catering products
                                      
                                        $sqlprod = $obj->query("select tbl_productprice.sell_price,tbl_productprice.mrp_price from tbl_product inner join tbl_productprice on tbl_product.id=tbl_productprice.product_id where tbl_product.storeid='$storeidarr[$x]' and tbl_product.id='$productidarr[$p]'");
                                        $result = $obj->fetchNextObject($sqlprod);

                                        $productsum = number_format($productsum + (hikerounder($result->sell_price, $results->hike) * $qtyarr[$p]), 2,'.','');
                                        $mrpprice = hikerounder($result->mrp_price, $results->hike) * $qtyarr[$p];
                                        $sellprice = hikerounder($result->sell_price, $results->hike) * $qtyarr[$p];
                                        $productsaving = number_format($productsaving + ($mrpprice - $sellprice), 2,'.','');
                                    }

                                    //$sqlprod=$obj->query("select sell_price,mrp_price from tbl_product inner join tbl_productprice on tbl_product.id=tbl_productprice.product_id where tbl_product.storeid='$storeidarr[$x]' and tbl_product.id='$productidarr[$p]'");
                                    //$result=$obj->fetchNextObject($sqlprod);
                                } //for loop ends $p	
                                //echo $productsum;
								//echo $results->minimum;
                                if ($productsum < $results->minimum) {
                                   
                                    $storemintotal = $storemintotal + $results->minimum_fee;
                                }
                            }//for looop ends $x
								if(($_SESSION['case']==0 || $_SESSION['case']==1) && $platinumplandetails->plan_minimum_order_cretaria==1){

		                            $_SESSION['platinumsavings']=$_SESSION['platinumsavings']+$storemintotal;
	                            }
                            if($_SESSION['value_minimum_order_cretaria']==1 && isset($_SESSION['value_user_type']) && $_SESSION['value_user_type'] == '0'){
							 $_SESSION['membersavings']=$_SESSION['membersavings']+$storemintotal;
								$storemintotal=0;
								$_SESSION['storemintotal'] = number_format($storemintotal, 2,'.','');
							} else {
								 $_SESSION['storemintotal'] = number_format($storemintotal, 2,'.','');
							}
                            //store loworder charge ends

                            $pkgcharge = getFieldWhere('pkgcharge', 'tbl_setting', 'id', '1');
							 if(($_SESSION['case']==0 || $_SESSION['case']==1) && $platinumplandetails->plan_packaging_fee==1){
		                            $_SESSION['platinumsavings']=$_SESSION['platinumsavings']+$pkgcharge;
	                            }
							if($_SESSION['value_packaging_fee']==1 && isset($_SESSION['value_user_type']) && $_SESSION['value_user_type'] == '0'){
							$_SESSION['membersavings']=$_SESSION['membersavings']+$pkgcharge;	
								$pkgcharge=0;
                            $_SESSION['pkgcharge'] = number_format($pkgcharge, 2,'.','');
							} else {
								$_SESSION['pkgcharge'] = $pkgcharge;
							}

                            

                            
                            $upsShippingValue=9.99;
							
		if($_COOKIE['pincode']!=''){
			$upincode = $_COOKIE['pincode'];
		} else {
			$upincode = $_COOKIE['postalcode'];
		}
							$isUPS=strtoupper(strtolower(getFieldWhere('zip_area','tbl_store_zip','zip',$upincode)));
                                if($isUPS=='UPS' && $subtotalg>0){
									$myvaluemini = getFieldWhere('upsminorderamount', 'tbl_setting', 'id', '1');
								} else {
									$myvaluemini = getFieldWhere('minorderamount', 'tbl_setting', 'id', '1');
							}

                            if ($myvaluemini < $subtotal) {
                                $delivery_charges = 0.00;
                                $delshow = "Free";
                                $_SESSION['ship_type'] = "Home Delivery";
                            } else {
                               
                                if($isUPS=='UPS' && $subtotalg>0){
                                $delivery_charges=getFieldWhere('shippingamount', 'tbl_setting', 'id', '1');
                                $delshow=$website_currency_symbol . number_format($delivery_charges, 2,'.','');
                                }else{
                                $delivery_charges = getFieldWhere('shippingamount', 'tbl_setting', 'id', '1');
                                $delshow = $website_currency_symbol . number_format($delivery_charges, 2,'.','');
                                }

                                $_SESSION['ship_type'] = "Home Delivery";
                            }
                        } else {
                            $_SESSION['storemintotal'] = 0.00;
                            $delivery_charges = 0.00;
                            $delshow = "Free";
                            $_SESSION['ship_type'] = "Pick";
                            $pkgcharge = 0.00;
                            $_SESSION['pkgcharge'] = $pkgcharge;
                            $_SESSION['ship_type'] = "Pick";
                        }
                        if ($subtotal < 0.1) {
                            $delivery_charges = 0.00;
                            $delshow = $website_currency_symbol . number_format($delivery_charges, 2,'.','');
                            $pkgcharge = 0.00;
                            $_SESSION['pkgcharge'] = $pkgcharge;
                        }
                        if((!empty($productidarrgc) || !empty($productidarre) || !empty($productidarra))  && empty($productidarrf) && empty($productidarrg)){
                                                    $delivery_charges = 0.00;
                                                     $delshow = $website_currency_symbol . number_format($delivery_charges, 2,'.','');
                                                    $pkgcharge = 0.00;
                                                    $_SESSION['pkgcharge'] = $pkgcharge;
													
                              }
					
                        
						$freearray=array('free','');
						$checkarray=$deliverytypef;
						$nationwidecharges=0;
					$dataexpedite=array();
					$momentsexpedite=array();
						$finaldelarray=array_values(array_diff($checkarray,$freearray));
						if(count($finaldelarray > 0)){
							
							/*foreach($finaldelarray as $delivery) {
							$nationwidecharges+=9.99;
							}*/
							//print_r($deliverytypef);
							//print_r($_SESSION['f_cart']);
							//print_r(array_unique($_SESSION['f_cart']));
							foreach($_SESSION['f_cart'] as $dd)
							{
							    $dd['deliveryType'];
							    if($dd['deliveryType']!='free' AND $dd['deliveryType']!='' AND $dd['section']!='moments')
							    {
							        
							    $data=array(
							        'sid'=>$dd['sid'],
							        'deltype'=>$dd['deliveryType'],
							        );
							    array_push($dataexpedite,$data);
							        
							    }
								if($dd['deliveryType']!='free' AND $dd['deliveryType']!='' AND $dd['section']=='moments')
							    {
							        
							    $data=array(
							        'sid'=>$dd['sid'],
							        'deltype'=>$dd['deliveryType'],
							        );
							    array_push($momentsexpedite,$data);
							        
							    }
							}
							
							$input = array_map("unserialize", array_map("serialize", $dataexpedite));
							$input2 = array_map("unserialize", array_unique(array_map("serialize", $momentsexpedite)));
							
							//$arr=array();
						//	echo "<pre>";
				//	print_r($input);
							 $ss1=count(array_filter($input));
							 $ss2=count(array_filter($input2));
							$sss=$ss1+$ss2;
						
							$cc=count($storeidarr);
							
							 //$nationwidecharges=0;
							
for ($x = 1; $x <= $sss; $x++) {
  //echo "The number is: $x <br>";
  $nationwidecharges=$nationwidecharges+9.99;
}
//echo $myvaluemini;
//echo "<br>";
//echo $subtotalg;
//$userss=$obj->query("select state from tbl_user where id='".$_SESSION['value_user_id']."'");
//$userstate = $obj->fetchNextObject($userss);
//$statedel=$obj->query("select price from tbl_justdeliveryprice where state='".$userstate->state."'");
//$statewidedel = $obj->fetchNextObject($statedel);
$delivery_charges=4.99;//$statewidedel->price;
$_SESSION['deliverChargeStateWise']=$delivery_charges;
if($subtotal!=0.00)
{
	$chkSubtotal = $subtotal - $subtotalgc-$subtotale-$subtotalp-$subtotala; // Minus gift card value from subtotal
	$chkSubtotalpuja = $subtotal - $subtotalp;
	$chkSubtotalapparel = $subtotal - $subtotala;
if ($chkSubtotal > 0 && $myvaluemini > $chkSubtotal) {

  $delivery_charges=4.99;
} else if ($chkSubtotalpuja==0 || $chkSubtotalapparel==0){
	$delivery_charges=0;
}
}
//print_r($arr);
						$delshow = $website_currency_symbol . number_format($delivery_charges+$nationwidecharges, 2,'.','');
						}
						if(($_SESSION['case']==0 || $_SESSION['case']==1) && $platinumplandetails->plan_free_delivery==1){
		                            $_SESSION['platinumsavings']=$_SESSION['platinumsavings']+$delivery_charges;
	                            }
						if($_SESSION['value_free_delivery']==1 && isset($_SESSION['value_user_type']) && $_SESSION['value_user_type'] == '0'){
					        $_SESSION['membersavings']=$_SESSION['membersavings']+$delivery_charges;
							$delivery_charges=$nationwidecharges;
							$delshow = $website_currency_symbol . number_format($delivery_charges, 2,'.','');
						    $_SESSION['delivery_charges'] = number_format($delivery_charges, 2,'.','');
							 
						} else {
							$delivery_charges=$delivery_charges+$nationwidecharges;
							$_SESSION['delivery_charges'] = $delivery_charges;
						}
						if(($_SESSION['case']==0 || $_SESSION['case']==1) && $ediscount >0  && $_SESSION['membercoupon']==1){
		                             $_SESSION['platinumsavings']=$_SESSION['platinumsavings']+$ediscount;
	                        }
						if($ediscount >0 && $_SESSION['membercoupon']==1){
							$_SESSION['membersavings']=$_SESSION['membersavings']+$ediscount;
						}
                        $_SESSION['membersavings']=$_SESSION['membersavings']+$memberprodsavings;
                        //Indiaco Store exception starts
                        /* if(in_array('147',$storeidarr)){
                          if($_SESSION['ship_type']=='Pick'){
                          $pkgcharge=0.00;
                          $pkgcharge=$website_currency_symbol.number_format($pkgcharge,2);
                          $_SESSION['pkgcharge']=$pkgcharge;
                          }else{
                          $pkgcharge=1.99;
                          $pkgcharge=$website_currency_symbol.number_format($pkgcharge,2);
                          $_SESSION['pkgcharge']=$pkgcharge;
                          } }
                          //Indiaco Store exception ends
                         */
						
						 if($flaggroceryapply==true && $subtotalg>0){
							 
							 $delivery_charges=$delivery_charges+2.99;
						 } else {
							  setcookie("grocerypriority", "", time() - 3600);
						 }
						 if($flagfoodapply==true && $subtotalf>0){
							 $delivery_charges=$delivery_charges+2.99;
						 } else {
							  setcookie("foodpriority", "", time() - 3600);
						 }
						 $delshow = $website_currency_symbol . number_format($delivery_charges, 2,'.','');
						 $_SESSION['delivery_charges'] = number_format($delivery_charges, 2,'.','');
						 $eservicemainsave=0;
                         $eservicemain=0;
						  if($_SESSION['case']==1 || $_SESSION['case']==2 && isset($_SESSION['value_user_type']) && $_SESSION['value_user_type'] == '0'){
							 
                         
                          if ($_COOKIE['grocery_tab_index'] == 1) {	

		                     $subtotalforplatformfee = $subtotalg + $subtotalf + $subtotalp + $subtotala;
	                         
							 $eservicemain=number_format(($subtotalforplatformfee/100)*$platformservicefeeRes->platform_service_fees_pickup, 2, '.', '');
							 $eservicemainsave=$eservicemain-$eservicefee;
							 
                           } else {
	                         $subtotalforplatformfee = $subtotalg + $subtotalf + $subtotalp + $subtotala;
	                       
							$eservicemain=number_format(($subtotalforplatformfee/100)*$platformservicefeeRes->platform_service_fees_delivery, 2, '.', '');
							$eservicemainsave=$eservicemain-$eservicefee;
                            }
	                         $_SESSION['membersavings']=$_SESSION['membersavings']+$eservicemainsave;
							 
						  }
						 
						 if($_SESSION['case']==0 || $_SESSION['case']==1){
							 $eservicesave=0;
                             if($platinumplandetails->platform_service_fees_delivery>0){
                             $subtotalforplatformfee = $subtotalg + $subtotalf + $subtotalp + $subtotala;
	                         $eservicesave=number_format(($subtotalforplatformfee/100)*$platinumplandetails->platform_service_fees_delivery, 2, '.', '');
							 $eservicesave=$eservicefee-$eservicesave;
                              }
							  $pickupsave=0;
							 $subtotalfg = $subtotalg + $subtotalf;
							 if ($_COOKIE['grocery_tab_index'] == 1) {
                             if($platinumplandetails->plan_pickup_orders_off>0){
                             
	                         $pickupsave=number_format(($subtotalfg/100)*$platinumplandetails->plan_pickup_orders_off, 2, '.', '');
                             }
							 }
							 $couponsave=0;
                             if($subtotal>0){
	                          $couponsave=number_format(($subtotal/100)*5, 2, '.', '');
                             }
							 if($_SESSION['storemintotal']>2.99){
							 $saveminimum=2.99;
							 } else {
							 $saveminimum=2.99;
							 }
							 $customvaluesave=$couponsave+$saveminimum+$eservicesave+$pickupsave;
							
						 }
						 $eservicefee=$eservicemain;
						 $eservicefee=number_format(($subtotalforplatformfee/100)*7.5, 2, '.', '');
                        ?>
	
                </div>

                <div class="clsCartOptions">
                    <!--coupons starts-->
					  <div class="cartright-box cartright-box-one" style="margin-top: 85px;">
<?php if ($_SESSION['discountCoupon'] == '' && $_SESSION['discountreward'] == '' && $_SESSION['discountWallet'] == '') { ?>

                        <form name="couponfrm" id="couponfrm" action="" method="post" enctype="multipart/form-data">
                            <input type="hidden" name="hdnCartTotal" id="hdnCartTotal" value="0">
                            <input type="hidden" name="apply_coupon" value="Yes">
                            <div class="custom-rwardrradios">
							<h3>E-Voucher</h3>
                                <!--<div class="rwardradioBtnwidth-wrap">
                                    <div class="rwardradioBtnwidth" style="display:none;">
									<label for="vocherRewardWallet-1"><img src="<?php echo SITE_URL;?>images/cart/discount-voucher.svg" alt="eVoucher"><span>eVoucher</span>
                                        <input type="radio" class="parRadioBtn" name="evcode" id="vocherRewardWallet-1" value="e-coupon" checked data-paymtmethod="parRadioOne">
									</label>
                                        
                                    </div>
                                    <div class="rwardradioBtnwidth">
									<label for="vocherRewardWallet-2"><img src="<?php echo SITE_URL;?>images/cart/rewardpoint.svg" alt="Reward Point"><span>Reward Point (<?php echo getRewardPoints($_SESSION['value_user_id']); ?>)</span>
                                        <input type="radio" class="parRadioBtn" name="evcode" id="vocherRewardWallet-2" value="e-reward" data-paymtmethod="parRadioTwo">
                                        </label>
                                    </div>
                                    <div class="rwardradioBtnwidth">
									<label for="rwardrsPect-3"><img src="<?php echo SITE_URL;?>images/cart/mywallet.svg" alt="My Wallet"><span>My Wallet (<?php echo getwallet($_SESSION['value_user_id']); ?>)</span>
                                        <input type="radio" class="parRadioBtn" name="evcode" id="vocherRewardWallet-3" value="e-wallet" data-paymtmethod="parRadioThree">
                                      </label>
                                    </div>
                                </div>-->
                            </div>
                            <div class="">
                                <div id="parRadioOne" class="parRadioBtnDesc">
                                   
                                    <div style="color:#C00;"><?php
    echo $_SESSION['coupon_error'];
    //$_SESSION['coupon_error'] = '';
    ?></div>
                                    <input type="text" name="coupon" id="e-vouchercode" class="clsCouponCode" value="" placeholder="Enter e-voucher code">
                                        <?php if (isset($_COOKIE['email']) && $_COOKIE['email'] != '0') { ?>
                                        <a href="javascript:void(0)" onClick="$('#couponfrm').submit();" style="background-color: #9d2f88;" class="cartclsBtn" title="Apply Coupon">Apply</a>
                                    <?php } else { ?>
                                        <div style="color:#C00; display:none; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px" id="couponloginerror">You need to Sign up/Log In to redeem the coupon.<br><br></div>
                                        <a href="javascript:void(0)" onClick="$('#couponloginerror').show();" class="cartclsBtn" title="Apply Coupon">Apply</a>
    <?php } ?>
                                    <span class="cartright-box-msg" style="display:none;"> * A maximum of one voucher is applicable for an order</span>
                                </div>
                               <!-- <div id="parRadioTwo" class="parRadioBtnDesc">
                                    <div style="color:#C00;"><?php
    echo $_SESSION['coupon_error'];
    //$_SESSION['coupon_error'] = '';
    ?></div>
                                    <input type="text" name="rewardpoint" class="clsCouponCode" id="e-vouchercode" placeholder="Enter reward point">
                                        <?php if (isset($_SESSION['value_user_type']) && $_SESSION['value_user_type'] == '0') { ?>
                                        <a href="javascript:void(0)" onClick="$('#couponfrm').submit();" class="cartclsBtn" title="Apply Reward Points">Apply</a>
                                    <?php } else { ?>
                                        <a href="javascript:void(0)" id="procedcheckoutBtn" class="cartclsBtn" title="Apply Reward Points">Apply</a>
                                    <?php } ?>
                                    <span class="cartright-box-msg"> * Reward Point applicable</span>
                                </div>
                                <div id="parRadioThree" class="parRadioBtnDesc">
                                 
																	<?php $wallet_balance = getwallet($_SESSION['value_user_id']); ?>
																	<?php if($wallet_balance == 0) {?>
                                    <span class="cartright-box-msg walltbox-msg">Your Wallet is empty</span>
                                    <?php }else{ ?>
																			<div style="color:#C00;"><?php
			echo $_SESSION['coupon_error'];
			$_SESSION['coupon_error'] = '';
			?></div>
                                    <input type="text" name="walletbalance" class="clsCouponCode" id="e-vouchercode" placeholder="Enter wallet balance">
                                        <?php if (isset($_SESSION['value_user_type']) && $_SESSION['value_user_type'] == '0') { ?>
                                        <a href="javascript:void(0)" onClick="$('#couponfrm').submit();" class="cartclsBtn" title="Apply Wallet Amount">Apply</a>
                                    <?php } else { ?>
                                        <a href="javascript:void(0)" id="procedcheckoutBtn" class="cartclsBtn" title="Apply Wallet Amount">Apply</a>
                                    <?php } ?>
																	<?php } ?>	
                                </div>-->

                            </div>
                        </form>
<?php } ?>
  <?php if($_SESSION['discountCoupon']!='') {?>
  <form name="removecoupon" id="removecoupon" action="" method="post" enctype="multipart/form-data">
 
  
  
  <div class="">
                                <div id="removepdcoupon" class="removepdcoupon" style="">
								
                                    <?php if ($_SESSION['discountCoupon'] != ''){?>
									<p class="avoffers"><span>Your e-voucher Code option</span></p>
									<input type="hidden" name="removecoupon_code" value="yes">
									<div class="row">
									    <div class="col-md-10">
                                    <input type="text" name="couponcoderemove" id="e-vouchercoderemove" class="clsCouponCoderemove" value="<?php echo $_SESSION['couponcode'];?>">
                                        </div>                               
                                        <div class="col-md-2">
                                         <center><button style="background-color: #fff; border: 0px; margin-left: -18px; margin-top: 10px;" type="submit" href="javascript:void(0)" onclick="$('#removecoupon').submit();" class="cartclsBtnremove" title="Remove Coupon">Remove</button>
                                        </center>
                                    </div>
                                    </div>                                            
									<?php } ?>											
                                   <!-- <p class="avoffers">Available Offers</p> -->
									<br>
 <?php //print_r($qpasscouponarray);
 $offerhtml=" <p class='avoffers'>Available Offers</p> <ul>";
 $qoffcount=0;
  foreach($qpasscouponarray as $lstItem) {
	  $ctahed='';
	if($qoffcount==0){
		if ($_SESSION['discountCoupon'] != '' && $_SESSION['couponcode'] !='' && $_SESSION['couponcode']==$lstItem->code){
			$ctahed='<span>Applied</span>';
		} else {
			$ctahed="<span onclick=applycouponcode('".$lstItem->code."');>Apply</span>";
		}
		echo '<ul><li><div class="wrapfirstblock"><div class="listcode">'.$lstItem->code.'</div><div class="listcta">'.$ctahed.'</div></div><div class="discountper" ><h3> Get '.$lstItem->discount.'% OFF On Min. Order '.$website_currency_symbol.$lstItem->minAmt.' '.$lstItem->title.'</h3></div></li></ul><div class="viewalloffercta"><button type="button" onclick="openofferpage();">View more offers ></button></div>';
	}
	 $offerhtml.='<li><div class="wrapfirstblock"><div class="listcode">'.$lstItem->code.'</div><div class="listcta">'.$ctahed.'</div></div><div class="discountper" ><h3> Get '.$lstItem->discount.'% OFF On Min. Order '.$website_currency_symbol.$lstItem->minAmt.' '.$lstItem->title.'</h3></div></li>';
$qoffcount++;	 
  } 
  $offerhtml.="</ul>";
  ?>									
                                    									
                                </div>
                               
                              

                            </div>
  </form>


 <?php  } ?>
   </div>
                    <!-- coupons ends-->
                    <!-- total and tip starts-->
<style>
.tooltipcheckout {
    position: relative;
    display: inline-block;
}
.tooltipcheckout i {
    background: #666;
    color: #fff;
    font-size: 9px;
    font-weight: 300;
    border-radius: 50%;
    margin-left: 5px;
    padding: 5px 9px 5px 9px;
    line-height: 10px;
    top: -1px;
}

.tooltipcheckout .tooltipcheckoutbody {
    visibility: hidden;
    width: 300px;
    background-color: #FFFFFF;
    box-shadow: 0px 0px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid rgb(226, 226, 226);
    color: #fff;;
    padding: 16px;
    position: absolute;
    z-index: 1;
    top: 150%;
    left: 0;
    margin-left: -135px;
}


.tooltipcheckout:hover .tooltipcheckoutbody {
  visibility: visible;
}
.clsCartBox .clsCartOptions .cartright-box div.cartboxitem {
    display: flex;
    justify-content: space-between;
    font-weight: 500;
    color: #000;
    padding: 0 0 10px;
}
.clsCartBox .clsCartOptions .cartright-box div.cartboxitem span {
    font-size: 14px;
    text-align: left;
    font: normal normal 500 14px/16px Poppins;
    letter-spacing: 0px;
    color: #000000;
    opacity: 1;
}
.tooltipwrap {
    display: -webkit-box;
    display: -moz-box;
    display: -ms-flexbox;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    align-items: center;
}

.tooltipwrapflex {
    -  display: -webkit-box;
    display: -moz-box;
    display: -ms-flexbox;
    display: -webkit-flex;
    display: flex;
        -webkit-box-pack: justify;
    justify-content: space-between;
}
.tooltipcheckoutmainhead {
    text-align: left;
    font: normal normal 600 18px/20px Poppins !important;
    letter-spacing: 0px;
    color: #000000;
    padding-bottom: 5px  !important;
}

.tooltipwraph {
     text-align: left;
    font: normal normal 600 14px/20px Poppins !important;
    letter-spacing: 0px;
    color: #000000;
    padding-bottom: 5px  !important;
}
.tooltipwrapv {
     text-align: left;
    font: normal normal 600 14px/20px Poppins !important;
    letter-spacing: 0px;
    color: #000000;
    padding-bottom: 5px  !important;
}

.tooltipwrapnonflex {
     text-align: left;
    font: normal normal 400 13px/20px Poppins !important;
    letter-spacing: 0px;
    color: #000000;
    padding-bottom: 5px  !important;
}

a.clsClosebtn img {
    width: 20px;
}
a.clsClosebtn {
    position: absolute;
    right: 5px;
    top: 5px;
	display:none !important;
	cursor:pointer;
	z-index:99999;
}
button.clsClosebtnbtn {
    background: #333333;
    width: 100%;
    color: #fff;
    padding: 5px;
    font: normal normal 500 14px/20px Poppins !important;
    margin-top: 10px;
	margin-bottom:0px;
	display:none !important;
	cursor:pointer;
}
@media only screen and (min-width: 320px)  and (max-width: 767px) {
span.tooltipcheckoutbody.active a.clsClosebtn , span.tooltipcheckoutbody.active button.clsClosebtnbtn{
	display:block !important;
}
span.tooltipcheckoutbody {
    visibility: hidden !important;
}
span.tooltipcheckoutbody.active {
    visibility: visible !important;
}
.tooltipcheckout:hover span.tooltipcheckoutbody.active {
  visibility: visible !important;
}
.tooltipcheckout:hover .tooltipcheckoutbody  {
  visibility: hidden !important;
}
.tooltipcheckoutmainhead {
    padding-bottom: 14px  !important;
    margin-top: 10px;
}
.tooltipcheckout .tooltipcheckoutbody {
    width: 100%;
    background-color: #FFFFFF;
    box-shadow: 0px 0px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid rgb(226, 226, 226);
    color: #fff;
    padding: 20px 16px;
    position: fixed;
    z-index: 999999;
    top: auto;
    left: 0;
    margin-left: 0;
    bottom: 0;
    right: 0;
    border-top-left-radius: 30px;
    border-top-right-radius: 30px;
}
a.clsClosebtn {
    position: absolute;
    right: 18px;
    top: 11px;
    cursor: pointer;
    z-index: 99999;
}
}
					</style>
                    <div class="cartright-box cartright-box-two" >
                        <p class="cartboxttl">Order Summary:</p>
                                        <!--Subtotal<span id="lblSubItems">(0 item):</span><span id="lblGrandTotal">$00.00</span>-->
                        <p class="cartboxitem grocerysection"><span class="cartboxitemName cartboxitemNameBold">Groceries Subtotal <span id="lblSubItemsGrocery">(0 item):</span></span><span id="lblGrandTotalGrocery" class="cartboxitemPrice"><?php echo $website_currency_symbol . number_format($subtotalg, 2,'.',''); ?></span></p>
                        <p class="cartboxitem foodsection"><span class="cartboxitemName cartboxitemNameBold">Food Subtotal <span id="lblSubItemsFood">(0 item):</span></span><span id="lblGrandTotalFood" class="cartboxitemPrice"><?php echo $website_currency_symbol . number_format($subtotalf, 2,'.',''); ?></span></p>
						
						<p class="cartboxitem gifcardsection"><span class="cartboxitemName cartboxitemNameBold">Gift Card Subtotal <span id="lblSubItemsGiftCard">(0 item):</span></span><span id="lblGrandTotalGiftCard" class="cartboxitemPrice"><?php echo $website_currency_symbol . number_format($subtotalgc, 2,'.',''); ?></span></p>
					
						
						<p class="cartboxitem eventsection"><span class="cartboxitemName cartboxitemNameBold">Event Subtotal <span id="lblSubItemsEvent">(0 item):</span></span><span id="lblGrandTotalEvent" class="cartboxitemPrice"><?php echo $website_currency_symbol . number_format($subtotale, 2,'.',''); ?></span></p>
						
						<p class="cartboxitem pujasection"><span class="cartboxitemName cartboxitemNameBold">Puja Subtotal <span id="lblSubItemsPuja">(0 item):</span></span><span id="lblGrandTotalPuja" class="cartboxitemPrice"><?php echo $website_currency_symbol . number_format($subtotalp, 2,'.',''); ?></span></p>
						
						<p class="cartboxitem apparelsection"><span class="cartboxitemName cartboxitemNameBold">Apparel Subtotal <span id="lblSubItemsApparel">(0 item):</span></span><span id="lblGrandTotalApparel" class="cartboxitemPrice"><?php echo $website_currency_symbol . number_format($subtotala, 2,'.',''); ?></span></p>
						
                        <div class="cartboxitem"><span class="cartboxitemName" id="tax">Taxes & Other Fees<div class="tooltipcheckout" ><i class="fa fa-info" onclick="opentooltip();"></i>
  <span class="tooltipcheckoutbody">
  <div class="tooltipcheckoutbodyinner">
  <a href="javascript:void(0);" class="clsClosebtn" onclick="closetooltip();" title="Close"><img src="images/close.png" alt="Close"></a>
  <div class="tooltipcheckoutmainhead">What's included?</div>
  <div class="tooltipwrap">
  <div>
  <div class="tooltipwrapflex">
										<div class="tooltipwraph">Service Fees </div><div class="spacer _8"></div><div class="tooltipwrapv"><?php if($eservicemain+$econveniencefee > $eservicefee+$econveniencefee && $_SESSION['case']>0){?><span style='text-decoration:line-through;text-decoration-color: #bb121a;text-decoration-thickness: 2px;'>$<?php echo number_format($eservicemain+$econveniencefee, 2,'.',''); ?></span> - $<?php echo number_format($eservicefee+$econveniencefee, 2,'.',''); ?>  <?php } else {?> $<?php echo number_format(($subtotalforplatformfee/100)*7.5, 2, '.', ''); } ?></div></div>
  <div class="tooltipwrapnonflex">This fee supports the Quicklly platform and covers various operating costs including packaging, insurance, background checks, and customer support. Quiklly Pass members enjoy a reduced fee.</div>
  <div class="tooltipwrapflex">
  <div class="tooltipwraph">Taxes</div><div class="spacer _8"></div><div class="tooltipwrapv">$<?php echo number_format($taxtotal, 2,'.',''); ?></div></div>
  <div class="tooltipwrapnonflex"><button class="clsClosebtnbtn" type="button" onclick="closetooltip();">Got it</button></div>
  
  </div>
  </div>
  </div>
  </span>
  <?php $showtax=$taxtotal+$eservicefee+$econveniencefee;?>
</div></span><span class="cartboxitemPrice">$<?php echo number_format($showtax, 2,'.',''); ?></span></div>
						<?php if($eservicefee>0){?>
						<!--<p class="cartboxitem"><span class="cartboxitemName" id="tax2">Service Fee</span><span class="cartboxitemPrice">$<?php echo number_format($eservicefee, 2,'.',''); ?></span></p>-->
						<?php } ?>
						<?php if($econveniencefee>0){?>
						<!--<p class="cartboxitem"><span class="cartboxitemName" id="tax3">Convenience Fee</span><span class="cartboxitemPrice">$<?php echo number_format($econveniencefee, 2,'.',''); ?></span></p>-->
						<?php } ?>
						 
<?php
// Food popup discount
$foodPopUpDiscountPerc = '0';

if($_COOKIE['fspd'] == '1'){
    // Get food popup discount data
    $foodPopUpDiscountPerc = getFieldWhere('food_popup_discount', 'tbl_setting', 'id', '1');
}

 $ediscount=$_SESSION['discountCoupon'];
if ($_SESSION['discountCoupon'] != '' && $ediscount>0) {
    ?>
                            <p class="cartboxitem" id="coupondiscount"><span class="cartboxitemName">Coupon Discount</span><span class="cartboxitemPrice">$<?php echo number_format($ediscount, 2); ?></span></p>
                            <?php
                        } if ($_SESSION['discountreward'] != '') {
                            $ediscount = $_SESSION['discountreward'];
                            $_SESSION['discountReward'] = $ediscount;
                            ?>
                            <p class="cartboxitem" id="rewarddiscount"><span class="cartboxitemName">Reward Points Discount</span><span class="cartboxitemPrice">$<?php echo number_format($ediscount, 2); ?></span></p>
                            <?php
                        }
                        if ($_SESSION['discountWallet'] != '') {
                            $ediscount = $_SESSION['discountWallet'];
                            $_SESSION['discountWallet'] = $ediscount;
                            ?>
                            <p class="cartboxitem" id="rewarddiscount"><span class="cartboxitemName">Used Wallet Amount</span><span class="cartboxitemPrice">$<?php echo number_format($ediscount, 2); ?></span></p>
                            <?php
                        }

						if($chkSubtotalforevent!=0){
						?>
                        <p class="cartboxitem" id="shippingfee"><span class="cartboxitemName" >Delivery Charges</span><span class="cartboxitemPrice"><?php echo $delshow; ?></span></p>
						<?php if($_SESSION['storemintotal']>0){?>
                        <p class="cartboxitem "><span class="cartboxitemName" id="storemincharge">Estimated Minimum Charges</span><span class="cartboxitemPrice"><?php echo $website_currency_symbol . number_format($_SESSION['storemintotal'], 2,'.',''); ?></span></p>
						<?php } ?>
						<?php } ?>
<?php if ($pkgcharge > 0) { ?> <p class="cartboxitem"><span class="cartboxitemName" id="pkgcharge">Packaging Handling</span><span class="cartboxitemPrice"><?php echo $website_currency_symbol . number_format($pkgcharge, 2); ?></span></p> <?php } ?>

<?php if(($_SESSION['case']==1 || $_SESSION['case']==2) && $_SESSION['membersavings']>0) { ?> <!--<p class="cartboxitem"><span class="cartboxitemName" id="pkgcharge">Member Savings</span><span class="cartboxitemPrice"><?php echo $website_currency_symbol . number_format($_SESSION['membersavings'], 2); ?></span></p>--> <?php } ?>
<?php if($chkSubtotalforevent!=0){?>
                        <p class="cartboxitemtip"><span class="cartboxitemName">Tip</span><span class="cartboxitemPrice" id="tip">
                        <?php
                        $tip = number_format(($subtotal * $_COOKIE['tip'] / 100), 2,'.','');
                        echo $website_currency_symbol . $tip;
                        ?></span></p>
                        
                        <div class="custom-tipradios">
                            <div class="tipadioBtnwidth-wrap">
                                <div class="tipadioBtnwidth">
                                    <input type="radio" name="tipsPect1" id="tipsPect-1" value="0" <?php if ($_COOKIE['tip'] == '0') { ?>checked="" <?php } ?> onClick="checkValue(this,'<?php echo round(($subtotal + $taxtotal - $ediscount + $delivery_charges + $pkgcharge + $storemintotal+ $eservicefee + $econveniencefee), 2); ?>',0)">
                                    <label for="tipsPect-1" id="tipzero">No Tip</label>
                                </div>
                                <div class="tipadioBtnwidth">
                                    <input type="radio" name="tipsPect6" id="tipsPect-6" value="5" <?php if ($_COOKIE['tip'] == '5') { ?>checked="" <?php } ?>onClick="checkValue(this , '<?php echo number_format(($subtotal + $taxtotal - $ediscount + $delivery_charges + $pkgcharge + $storemintotal + $eservicefee + $econveniencefee + number_format(($subtotal * 5 / 100), 2,'.','')), 2,'.',''); ?>', '<?php echo number_format(($subtotal * 5 / 100), 2,'.',''); ?>')">
                                    <label for="tipsPect-6" id="tipthree">5%</label>
                                </div>
                                <div class="tipadioBtnwidth">
                                    <input type="radio" name="tipsPect2" id="tipsPect-2" value="10" <?php if ($_COOKIE['tip'] == '' || $_COOKIE['tip'] == '10') { ?>checked="" <?php } ?> onClick="checkValue(this,'<?php echo number_format(($subtotal + $taxtotal - $ediscount + $delivery_charges + $pkgcharge + $eservicefee + $econveniencefee + $storemintotal + number_format(($subtotal * 10 / 100), 2,'.','')), 2,'.',''); ?>','<?php echo number_format(($subtotal * 10 / 100), 2,'.',''); ?>')">
                                    <label for="tipsPect-2" id="tipfive">10%</label>
                                </div>
                                <div class="tipadioBtnwidth">
                                    <input type="radio" name="tipsPect3" id="tipsPect-3" value="15" <?php if ($_COOKIE['tip'] == '15') { ?>checked="" <?php } ?> onClick="checkValue(this,'<?php echo number_format(($subtotal + $taxtotal - $ediscount + $delivery_charges + $pkgcharge + $storemintotal + $eservicefee + $econveniencefee + number_format(($subtotal * 15 / 100), 2,'.','')), 2,'.',''); ?>' ,'<?php echo number_format(($subtotal * 15 / 100), 2,'.',''); ?>')">
                                    <label for="tipsPect-3" id="tipseven">15%</label>
                                </div>
                                <div class="tipadioBtnwidth">
                                    <input type="radio" name="tipsPect4" id="tipsPect-4" value="20" <?php if ($_COOKIE['tip'] == '20') { ?>checked="" <?php } ?> onClick="checkValue(this, '<?php echo number_format(($subtotal + $taxtotal - $ediscount + $delivery_charges + $pkgcharge + $storemintotal + $eservicefee + $econveniencefee + number_format(($subtotal * 20 / 100), 2,'.','')), 2,'.',''); ?>','<?php echo number_format(($subtotal * 20 / 100), 2,'.',''); ?>')">
                                    <label for="tipsPect-4" id="tipten">20%</label>
                                </div>
                                <!--<div class="tipadioBtnwidth">
                                    <input type="text" name="tipsPect5" id="tipsPect-5" value="" onClick="checkValue(this)">
                                </div>-->
                            </div>
                        </div>
<?php } else {
	if($subtotal>0){
	$_COOKIE['tip']=0;
$tip = number_format(($subtotal * $_COOKIE['tip'] / 100), 2,'.','');
setcookie('tip', 0, time() + (86400 * 30 * 12), "/"); // 86400 = 1 day
	}
 } ?>
                       
	
	<input type="hidden" id="tipinput" name="tipinput" value="<?php echo number_format(($subtotal * 5 / 100), 2); ?>">
	</div>
	<style>
span#deliverystate ul {
    display: grid;
    /* justify-content: space-between; */
    grid-template-columns: repeat(2, 1fr) !important;
    grid-gap: 15px;
}
.clsStoreDetails .lang-select.toprepcaementoption.hhhh {
    display:none;
}

span#deliverystate ul li {
   display:flex;
   width:100%;  
  background: #F5F5F5 0% 0% no-repeat padding-box;
  border: 1px solid #E4E4E4;
  padding:5px 10px;
  justify-content:space-between;
  margin: 5px;
   
}
.deltypem {
    display: flex;
    align-items: center;
}

.deltypemimg {
    margin-right: 10px;
}

.deltypemcont p {
    font: normal normal 500 14px/20px Poppins;
    letter-spacing: 0px;
    color: #000000;
}

.deltypemcont label p,.deltypemcont label {
  font: normal normal 500 11px/16px Poppins !important;
letter-spacing: 0px;
color: #000000 !important;
margin-bottom:0px !important;
}

	.clsCartStoresItems {
    display: block;
}
	.tempcartclsCartStores {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.tempcartclsCartStores .clsStoreimgDetails  {
    width:90px;
    border: 1px solid #F5F5F5;
border-radius: 5px;
}
.tempcartclsCartStores .clsStoreimgDetails img  {
    width:100%;
}
.tempcartclsCartStores .clsStoreDetails {
    margin: 0;
    padding-bottom: 0;
    border: 0;
    width: 230px;
}
.tempcartclsCartStores .clsStoreDetails p {
text-align: left;
font: normal normal 500 14px/20px Poppins;
letter-spacing: 0px;
color: #000000;
}

.clsStoreDetails span.qty{
text-align: left;
font: normal normal 400 14px/20px Poppins;
letter-spacing: 0px;
color: #333333;
display:block; 
}
.clsStoreDetails span.price {
text-align: left;
font: normal normal 500 14px/20px Poppins;
letter-spacing: 0px;
color: #28A745;
display:block;   
}
.tempcartcartStoreProd {
    background: #FFFFFF 0% 0% no-repeat padding-box;
    box-shadow: 0px 0px 4px #0000001A;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 10px;
}
.tempcartclsCartProds {
    display: none;
}
.clsStoreAction img {
    width: 30px;
}

.clsStoreAction button {
    background: white;
    border: none;
    cursor: pointer;
    outline:none;
}
.clsStoreAction img.cartopen {
    display: block;
}
.clsStoreAction img.cartclose {
    display: none;
}
.tempcartcartStoreProd.active .tempcartclsCartProds {
    display: block;
}
.tempcartcartStoreProd.active .clsStoreAction img.cartclose {
    display: block;
}
.tempcartcartStoreProd.active .clsStoreAction img.cartopen {
    display: none;
}
.clsdeliverybox.quickllypassboxnnnn .clsdeliveryboxinner {
    padding:0px
}
	.quickllypassbox {
     background: #911D59 0% 0% no-repeat padding-box;
     border-radius: 4px;
    color: #fff;
	padding: 10px;
}
.quickllypassbox p {
    color: #fff;
}
p.topheading img {
    width: 28px;
    display: inline-block;
}
p.topheading span {text-align: left;font: normal normal bold 16px/26px Montserrat;color: #FFFFFF;display:inline-block;vertical-align: top;margin-left: 10px;}
p.passdesc {
    margin-top:10px;
    margin-bottom:10px;
    text-align: left;
    /* font: normal normal 500 14px/19px Montserrat; */
    letter-spacing: 0px;
    color: #FFFFFF;
    text-align: left;
    font: normal normal normal 12px/20px Poppins;
    letter-spacing: 0px;
    color: #FFFFFF;
}
p.cartboxitemtip span {
    font-size: 14px;
    text-align: left;
    font: normal normal 500 14px/20px Poppins;
    letter-spacing: 0px;
    color: #000000;
    opacity: 1;
}
span#deliverystate strong {
    text-align: left;
    font: normal normal 500 16px/20px Poppins;
    letter-spacing: 0px;
    color: #000000;
    margin-bottom: 5px;
    display: block;
}
.quickllypassbox a {
    border-radius: 4px;
    letter-spacing: 0px;
    display: block;
    padding: 5px 10px;
    background: #FFFFFF 0% 0% no-repeat padding-box;
    border-radius: 4px;
    text-align: center;
    font: normal normal 500 14px/20px Poppins;
    letter-spacing: 0px;
    color: #911D59;
}
span.cartboxitemPrice.yousavedtotal {
    letter-spacing: 0px;
    color: #9d2f88 !important;
    font: normal normal 599 12px/18px Poppins !important;
}
span.cartboxitemPrice.yousavedtotal span {
    letter-spacing: 0px;
    color: #9d2f88 !important;
    font: normal normal 599 12px/18px Poppins !important;
}
	</style>
                    <script language="javascript">
                            function checkValue(var1 , val , subtotal) {
                                var buttonValue = var1.value
                                //		setCookie("tip", buttonValue);
                                document.cookie = "tip" + "=" + buttonValue + ";" + "path=/";
                                if (buttonValue == 0) {
                                        $("#tipzero").css("background", "#9d2f88");
										 $("#tipzero").css("color", "#FFF");
                                        $("#tipfive, #tipseven, #tipten, #tipthree").css({"background": "none", "color": "#9d2f88"});
                                        tip.innerHTML = '$0.00';
                                        document.getElementById('tipinput').value = 0.00;
                                        $("#tipadd").text(val);
										$(".showtotalonnp").text(val);
										
                                        // tipaddd.innerHTML = val;
                                        document.getElementById('selectedtip').value = 0;
                                        return false;
                                }

                                if (buttonValue == 5) {
                                        $("#tipthree").css("background", "#9d2f88");
										$("#tipthree").css("color", "#FFF");
                                        $("#tipzero, #tipseven, #tipten, #tipfive").css({"background": "none", "color": "#9d2f88"});
                                        tip.innerHTML = '$'+subtotal;
                                        document.getElementById('tipinput').value = subtotal;
                                         $("#tipadd").text(val);
										 $(".showtotalonnp").text(val);

                                        // tipaddd.innerHTML = val;
                                        return false;
                                }

                                if (buttonValue == 10) {
                                        $("#tipfive").css("background", "#9d2f88");
										$("#tipfive").css("color", "#FFF");
                                        $("#tipzero, #tipseven, #tipten, #tipthree").css({"background": "none", "color": "#9d2f88"});
                                        tip.innerHTML = '$'+subtotal;
                                        document.getElementById('tipinput').value =subtotal;
                                         $("#tipadd").text(val);
										 $(".showtotalonnp").text(val);
                                        // tipaddd.innerHTML = val;
                                        return false;
                                }

                                if (buttonValue == 15) {
                                        $("#tipseven").css("background", "#9d2f88");
										$("#tipseven").css("color", "#FFF");
                                        $("#tipfive, #tipzero, #tipten, #tipthree").css({"background": "none", "color": "#9d2f88"});
                                        tip.innerHTML = '$'+subtotal;
                                        document.getElementById('tipinput').value = subtotal;
                                        $("#tipadd").text(val);
										$(".showtotalonnp").text(val);
                                        // tipaddd.innerHTML = val;
                                        return false;
                                }

                                if (buttonValue == 20) {
                                        $("#tipten").css("background", "#9d2f88");
										$("#tipten").css("color", "#FFF");
                                        $("#tipfive, #tipseven, #tipzero, #tipthree").css({"background": "none", "color": "#9d2f88"});
                                        tip.innerHTML = '$'+subtotal;
                                        document.getElementById('tipinput').value = subtotal;
                                        $("#tipadd").text(val);
										$(".showtotalonnp").text(val);
                                        // tipaddd.innerHTML = val;
                                        return false;
                                }
                        }


                        </script>
                                        <!-- total and tip ends-->
 
<div class="cartright-box cartright-box-two estimatedordertotal">
 <p class="cartboxitem"><span class="cartboxitemName cartboxitemNameBold">Estimated Order Total</span><span class="cartboxitemPrice"><?php echo $website_currency_symbol; ?><span id="tipadd"><?php echo number_format(($subtotal + $taxtotal - $ediscount + $delivery_charges + $pkgcharge + $storemintotal + $tip + $eservicefee + $econveniencefee), 2, '.', ''); ?></span>
<?php
$totalsavings = number_format(($productsaving + $ediscount), 2, '.', '');
$_SESSION['totalsavings'] = $totalsavings;
if ($totalsavings > 0) {
    ?><p class="cartboxitem"><span class="cartboxitemName cartboxitemNameBold"> 
                                        </span><span class="cartboxitemPrice yousavedtotal" style="color: #9d2f88 !important;">You saved <?php echo $website_currency_symbol; ?><span id="tipadd" style="color: #9d2f88 !important;"><?php echo $totalsavings; ?></span></span><?php } ?>
    </p>
	</div>
                                  
                                            <div class="cartright-box cartright-box-two btnpaymentwrapper">
                                            <div class="procedcheckout-wrappr">
											<?php 
											//echo "pty=".$isUPS.$_COOKIE['grocery_tab_index'];
											$order_type_pick=getFieldWhere('zip_area','tbl_store_zip','zip',$_COOKIE['postalcode']);
											if($_SESSION['ship_type']=='Pick' && $order_type_pick=='UPS') { 
                                             if ($_REQUEST['changerequest'] == 'yes' || $_SESSION['value_user_id'] != '' || $_REQUEST['guestuser'] == 'yes' || $_SESSION['guestuser'] == 'yes') { ?>
                                                    <a href="javascript:void(0)" style="background-color:#9d2f88!important" class="cartclsBtn" id="proceedtop_ds" onclick="window.alert('Pickup service is not available for entered zipcode.');">Proceed to Payment</a>
                                                <?php } else { //procedcheckoutBtn   ?>
                                                    <a href="javascript:void(0)" style="background-color:#9d2f88!important" class="cartclsBtn" id="procedout_ds" onclick="window.alert('Pickup service is not available for entered zipcode.');">Proceed to Payment</a>
                                                <?php } ?>
												
											<?php } else { 
											
										             if ($_REQUEST['changerequest'] == 'yes' || $_SESSION['value_user_id'] != '' || $_REQUEST['guestuser'] == 'yes' || $_SESSION['guestuser'] == 'yes'  ) { 
													 if($_COOKIE['full_address']!='' && $_SESSION['email']){
													     if($subtotal>30)
													     {
													 ?>
                                                    <a title="results-sandbox-np.php?total=<?=$subtotalf?>&deliveryCharge=<?=$delivery_charges?>&eServiceFees=<?=number_format($eservicefee+$econveniencefee,2)?>&tax=<?=$taxtotal?>" style="background-color:#9d2f88!important" class="cartclsBtn"  id="proceedtopayment">Proceed to Payment</a>
													 <?php }
													 else
													 {
													  echo "<div> <p style='padding: 13px; text-align: center; font-size:16px; color: #000; font-weight: bold;'>Your cart is empty, please add some items in the cart.
													  <br>
													<center>  <a href='index.php' style=' background-color: #9d2f88; color: #fff; padding: 10px;'>Keep Shopping</a></center>
													  </p> </div>";   
													 }
													 } else {?>
													   <a href="javascript:void(0)" style="background-color:#9d2f88!important" class="cartclsBtn" id="changeAddrssBtn">Proceed to Payment</a>
													 <?php } ?>
                                                <?php } else { //procedcheckoutBtn   ?>
                                                    <a href="javascript:void(0)" style="background-color:#9d2f88!important" class="cartclsBtn" id="procedcheckoutBtn">Proceed to Payment</a>
                                                <?php } ?>
												
											<?php } ?>
                                            </div>
                                        </div>
                                        </div>
                                        </div>
                                        <!-- address ends-->

                                        </div>
                                        </div>
<?php include "modals.php"; ?>
                                        <!-- Product Removal modal Start -->
                                        <div class="modal productRemovalAlertModal" id="productRemovalAlertbox" tabindex="-1" role="dialog" aria-labelledby="productRemovalAlertboxformmodalLabel" aria-hidden="true">
                                            <div class="modal-dialog" role="document">
                                                <div class="modal-content">
                                                    <!--div class="modal-header">
                                                       <button type="button" class="close modalproductRemovalAlert-togglebtn" data-dismiss="modal" aria-label="Close" style="padding:5px 10px">
                                                           <span aria-hidden="true">X</span>
                                                       </button>
                                                   </div -->
                                                    <div class="modal-body productRemovalAlertmdl">

                                                        <button type="button" class="close modalproductRemovalAlert-togglebtn" data-dismiss="modal" aria-label="Close" style="padding:5px 10px">
                                                            <span aria-hidden="true">X</span>
                                                        </button>
                                                        <div class="removalProductCartImg-Wrapr">
                                                            <div class="crtImhWrppr">
                                                                <span><i class="fa fa-shopping-cart fa-2x" aria-hidden="true"></i></span>
                                                            </div>
                                                        </div>

                                                        <div class="productRemovalAlertmdl-wrapper">
<?php
echo $removedProductLst;
?>
                                                        </div>
                                                        <div class="productRemovalAlertmdl-okBtn">
                                                            <a class="productRemovalAlertmdlBtn">OK</a>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        </div>
              </div>                         
									   <!-- Product Removal modal Ends -->  

										 <div class="clsDialog clspricemodal" id="dvDialog-pricemodal">
            <div class="clsDialog-Box clsFoodCustomDialog">
                <a href="javascript:void(0);" class="clsClose" style="z-index: 9999999;" onClick="closeDialog('dvDialog-pricemodal');" title="Close"></a>

                <div class="clsContent clsFoodStoreCard exclude-calc">
				<div class="pricemodalcontent">
				<?php
                        echo $removedProductpriceLst;
                  ?>
				</div>
				</div>
				</div>
				</div>
													   <!--Mealme Product Removal modal Start -->  
										 <div class="clsDialog clspricemodal clsmealmemodal" id="dvDialog-mealme">
            <div class="clsDialog-Box clsFoodCustomDialog">
                

                <div class="clsContent clsFoodStoreCard exclude-calc">
				<div class="pricemodalcontent">
				<p>
				<?php
                        echo $mealmemsg;
                  ?>
				  </p>
				  <div class="mealmeproductRemovalAlertmdl-okBtn">
                                                            <a class="mealmeproductRemovalAlertmdlBtn" onClick="removemealmeproduct();">OK</a>
                 </div>
				</div>
				</div>
				</div>
				</div>
				
									 <div class="clsDialog clspricemodal" id="openofferpage">
            <div class="clsDialog-Box clsFoodCustomDialog">
                <a href="javascript:void(0);" class="clsClose" style="z-index: 9999999;" onClick="closeofferDialog('openofferpage');" title="Close"></a>

                <div class="clsContent clsFoodStoreCard exclude-calc">
				<div class="pricemodalcontent">
				<?php
                        echo $offerhtml;
                  ?>
				</div>
				</div>
				</div>
				</div>
                                        <!-- payment modal Start -->
                                        <div class="modal ChangeAddrssModal" id="paymentbox" tabindex="-1" role="dialog" aria-labelledby="changeAddrssformmodalLabel" aria-hidden="true" style="z-index:9900">
                                            <div class="modal-dialog modal-sl" role="document">
                                                <div class="modal-content">
                                                    
                                                    <div class="modal-body sinupformmdl" style="background-color: #f3f3f3; padding-top:10px;">
                                                        <div class="sinupformmdl-wrapper" id="payment-page" style=" border-radius:8px">
<?php
$alltotal=number_format(($subtotal + $taxtotal - $ediscount + $delivery_charges + $pkgcharge + $storemintotal + $tip + $eservicefee + $econveniencefee), 2, '.', '');

    include("app-payment.php"); //for production

?>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        </div>
                                        <!-- payment modal Ends -->
				
                                        <div class="clsTemplate">
																								<div id="tempcartStoreProd">
			<div class="tempcartcartStoreProd active" >
				<div class="tempcartclsCartStores" style="display: none;"></div>
											 
				<div class="tempcartclsCartProds"></div>
			 </div>
              </div>

			
                                            <div id="tempStore">
                                              <div class="clsStoreimgDetails">
                                                    <img src="[Simg]" alt="[Name]" />
													</div>
													<div class="clsStoreDetails">
													<p class="name">[Name2]</p>
													<span class="qty">[items]</span>
                                                    <span class="price"><?php echo $website_currency_symbol; ?>[total]</span>
																				 <div class="lang-select toprepcaementoption [visibility2]">
					 <p>Replacement Options</p>
                     <button class="btn-select showdefaultoption" id="showdefaultoption" value="Replace with Best Match"><li><img src="<?php echo SITE_URL;?>images/cart/replace-black.svg" alt="Replace with Best Match" value="Replace with Best Match"/><span>Replace with Best Match</span></li></button>
                     <div class="ballremarks">
                     <ul class="aallremarks bulkremarks"></ul>
                      </div>
                      </div>
													</div>
													 <div class="lang-select toprepcaementoption [visibility]">
					 <p>Replacement Options</p>
                     <button class="btn-select showdefaultoption" id="showdefaultoption" value="Replace with Best Match"><li><img src="<?php echo SITE_URL;?>images/cart/replace-black.svg" alt="Replace with Best Match" value="Replace with Best Match"/><span>Replace with Best Match</span></li></button>
                     <div class="ballremarks">
                     <ul class="aallremarks bulkremarks"></ul>
                      </div>
                      </div>
													<div class="clsStoreAction">
													 <button class="btnstoreupdown" id="btnstoreupdown" onClick="btnstoreupdown(this);"><img src="<?php echo SITE_URL;?>images/cart/cart-arrow-up-dropdown.svg" alt="cartclose" class="cartclose"><img src="<?php echo SITE_URL;?>images/cart/cart-arrow-down-dropdown.svg" alt="cartopen" class="cartopen"></button>
													</div>
                                                
                                            </div>
                                            <div id="tempProduct">
                                                <div class="clsCartProd">
										<div class="checkreplace"><label><input onChange="selectprodbox(this);" class="[SHOWHIDE]" type="checkbox" name="[CHECKENABLE]" data-i="[i3]" data-userdefaultremarks="[uremarks3]"></label></div>
												
												
                                                    <img src="[photo]" alt="[name2]" />
                                                    <div class="clsDetails">
                                                        <p class="name [groceryclass]">[name]</p>
														
                                                        <div class="detail">
                                                            <span><?php echo $website_currency_symbol; ?>[price][mrp]</span>
															<p class="name">[sub]</p>
                                                            <div class="extra"></div>
                                                            <input type="hidden" class="clsProdAdd"
                                                                    data-pid="[pid2]"
                                                                     >
																	 <div class="lang-select [SHOWHIDE1]">
					
                     <button class="btn-select" value="[uremarks]" id="btnselect[i4]" onClick="btnselect(this.id);"><li><img src="<?php echo SITE_URL;?>images/cart/[replacephoto]" alt="" value="[uremarks1]"><span>[uremarks2]</span></li></button>
                     <div class="ballremarks">
                     <ul class="aallremarks"></ul>
                      </div>
                      </div>
                                                            <span class="clsQty">
                                                                <select class="qty_[key3]" id="qty_[pid]" onChange="ddlQtyCartPg_onChange(this, '[key]');" 
                                                                        data-i="[i]">
                                                                    <option value="1">1</option>
                                                                    <option value="2">2</option>
                                                                    <option value="3">3</option>
                                                                    <option value="4">4</option>
                                                                    <option value="5">5</option>
                                                                    <option value="6">6</option>
                                                                    <option value="7">7</option>
                                                                    <option value="8">8</option>
                                                                    <option value="9">9</option>
                                                                    <option value="10">10</option>
                                                                    <option value="11">11</option>
                                                                    <option value="12">12</option>
                                                                    <option value="13">13</option>
                                                                    <option value="14">14</option>
                                                                    <option value="15">15</option>
                                                                    <option value="16">16</option>
                                                                    <option value="17">17</option>
                                                                    <option value="18">18</option>
                                                                    <option value="19">19</option>
                                                                    <option value="20">20</option>
                                                                </select>
                                                            </span>
                                                            <a href="javascript:void(0)" id="lnk_[pid]" onClick="removeFromCartPg([i2], '[key2]')">Remove</a>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>       
</div>
<?php include("footer.php"); ?>
                                        <?php include("js.php"); ?>
                                        <script type="text/javascript" src="<?php echo getFileVer('js/cart.js'); ?>" ></script>
                                          <div class="clsPgLoader"><span></span></div>

                                      
<?php
if ($_COOKIE['grocery_tab_index'] == 0) {
if (isset($_REQUEST['pincode'])) {
    if ($_REQUEST['pincode'] != $_COOKIE['postalcode']) {
        //include('unset_sessions.php');
        //echo "<script>  localStorage.clear();  refreshPhpCart();</script>"; 
        ?>
        <script>
        var cookie_zipcode = getCookie('postalcode').trim();
				var current_zipcode = '<?php echo $_REQUEST['pincode'];?>';

				checkZipStores(cookie_zipcode, current_zipcode);
				if(checkReturn != 0)
				{
					checkOutStores(cookie_zipcode, current_zipcode);
				}				
				//$.cookie('postalcode', current_zipcode, {expires: 1});
				
				</script>
        <?php
        setcookie('postalcode', $_REQUEST['pincode'], time() + (86400 * 30 * 12), "/"); // 86400 = 1 day
$_COOKIE['postalcode'] = strip_tags($_REQUEST['pincode']);
?><script>window.setTimeout(function(){location.reload()},1)</script><?php
    }
}
}
?>
<script>
	$( window ).on( "load", function() { 
//	$('#prod-loader').removeClass('onloadactive');
$(".clsPgLoader").hide();
	});
//Replacement Option
 $(document).ready(function(){

 <?php if($qpassdefaultcouponcode!='') {
	 if($_COOKIE['qpassremoveflag']!=1){
	 ?>
$("#e-vouchercode").val('<?php echo $qpassdefaultcouponcode;?>');
//$('#couponfrm').submit();
	 <?php } } ?> 
 $(".user-replacement-option").hide();
 
 $(".qty_cart_events").attr('disabled',true);
 $(".qty_cart_puja").attr('disabled',true);
  var cartCheck = window.localStorage.getItem('cart_grocery');
    if (cartCheck != null && cartCheck != '')
     var  cartChecklstCart = JSON.parse(cartCheck);
    if (cartChecklstCart.length > 0) {
         $(".user-replacement-option").show();
       		 
       
    } else {
		 $(".user-replacement-option").hide();	
	}
var langArray = [];
var langBulkArray = [];
$('.allremarks option').each(function(){
  var img = $(this).attr("data-thumbnail");
  var text = this.innerText;
  var value = $(this).val();
  var item = '<li data-operation="single" data-src="'+ img +'" data-value="'+value+'" onClick="selectreplaceoption(this);"><img src="'+ img +'" alt="" value="'+value+'"/><span>'+ text +'</span></li>';
   var item1 = '<li data-operation="bulk" data-src="'+ img +'" data-value="'+value+'" onClick="selectreplaceoption(this);"><img src="'+ img +'" alt="" value="'+value+'"/><span>'+ text +'</span></li>';
  langArray.push(item);
  langBulkArray.push(item1);
  
})

$('.aallremarks').html(langArray);
$('.bulkremarks').html();
$('.bulkremarks').html(langBulkArray);

var defaultimg='<?php echo SITE_URL;?>images/cart/replace-black.svg';
var defaultoption='Replace with Best Match';
//Set the button value to the first el of the array
//$('.showdefaultoption').html('<li><img src="'+ defaultimg +'" alt="" value="'+defaultoption+'"/><span>'+ defaultoption +'</span></li>');

//$('.showdefaultoption').attr('value', 'Replace with Best Match');

$(".showdefaultoption").on("click", function() {
	var $checkboxes2 = $('.clsCartProd input[type="checkbox"]');
	var countCheckedCheckboxes2 = $checkboxes2.filter(':checked').length;
	if(countCheckedCheckboxes2 >0){
	    $(this).addClass('currentoption');
        $(this).siblings(".ballremarks").toggle();
	} else {
		alert('Please select the product to change the replacement option.');
	}
    });

 });
  
 function checkall(cb) { 
if(cb.checked==true){
	$('.clsCartProd').find(".ballremarks").hide();
var ele=document.getElementsByName('check[]');  
$('.user-replacement-option').find('ms').text("selected("+ele.length+")");
                for(var i=0; i<ele.length; i++){  
                    if(ele[i].type=='checkbox')  
                        ele[i].checked=true;
					    //ele[i].disabled=false;
                } 
} else {
	
	 var ele=document.getElementsByName('check[]'); 
	 $('.user-replacement-option').find(".ballremarks").hide();
	 $('.clsCartProd').find(".ballremarks").hide();
	 $('.user-replacement-option').find(".showdefaultoption ").removeClass('currentoption');
$('.user-replacement-option').find('ms').text("Select All");	 
                for(var i=0; i<ele.length; i++){  
                    if(ele[i].type=='checkbox')  
                        ele[i].checked=false;
                         //ele[i].disabled=true;					
                      
                }  
}				
}
function selectprodbox(s){
	var $checkboxes1 = $('.clsCartProd input[type="checkbox"]');
   
        var countCheckedCheckboxes1 = $checkboxes1.filter(':checked').length;
		if(countCheckedCheckboxes1 >0){
			$('.user-replacement-option').find('ms').text("selected("+countCheckedCheckboxes1+")");
			
		} else {
			$('.user-replacement-option ').find('ms').text("Select All");
			$(".ballremarks").hide();
			$('.btn-select').removeClass('currentoption');
		}
  
}
function btnselect(clickid){
 
	//var $checkboxes2 = $('.clsCartProd input[type="checkbox"]');
	//var divchecked = $("#"+clickid).parents('.clsCartProd').find('input[type="checkbox"]').is(":checked");
	//var countCheckedCheckboxes2 = $checkboxes2.filter(':checked').length;
	//if(countCheckedCheckboxes2 >0 && divchecked==true){
	    
	//} else {
	//	alert('Please select the product to change the replacement option.');
	//}
	$("#"+clickid).addClass("currentoption");
     $("#"+clickid).siblings(".ballremarks").toggle();
   
}
function selectreplaceoption(d,choiceoption){
			$('.btn-select').removeClass('currentoption');
   var $checkboxes = $('.clsCartProd input[type="checkbox"]');
   var countCheckedCheckboxes = $checkboxes.filter(':checked').length;
   var grocerykey='cart_grocery';
   var operation = d.getAttribute("data-operation");
   var img = d.getAttribute("data-src");
   var value = d.getAttribute("data-value");
   var text = value;
   var item = '<li><img src="'+ img +'" alt="" /><span>'+ text +'</span></li>';
  $(d).parent().parent(".ballremarks").siblings('.btn-select').html(item);
  $(d).parent().parent(".ballremarks").siblings('.btn-select').attr('value', value);
  $(d).parents('.clsCartProd').find('input[type="checkbox"]').attr('data-userdefaultremarks', value);
  if(countCheckedCheckboxes >0) { 
   $.each($("input[name='check[]']:checked"), function(){ 
    var indexi = $(this).data("i"); 
	if(operation=='single'){
    var finalvalue = $(this).attr("data-userdefaultremarks");  
	} else {
	var finalvalue=value;	
	}
	var lstCart = [];
    var cart = window.localStorage.getItem(grocerykey);
    if (cart != null && cart != '')
        lstCart = JSON.parse(cart);
    if (lstCart.length > 0) {
        lstCart[indexi].uremarks = finalvalue;   
    }
    window.localStorage.setItem(grocerykey, JSON.stringify(lstCart));

   });
   updateMiniCart();
   //resetPhpCart();
   refreshPhpCart();
  } else {
	   // alert('Please select the product to change the replacement option.');
	 //  $('.user-replacement-option ').find('ms').text("&nbsp;Select All");
	var indexi = $(d).parents('.clsCartProd').find('input[type="checkbox"]').attr('data-i');; 
	var finalvalue=value;
	var lstCart = [];
    var cart = window.localStorage.getItem(grocerykey);
    if (cart != null && cart != '')
        lstCart = JSON.parse(cart);
    if (lstCart.length > 0) {
        lstCart[indexi].uremarks = finalvalue;   
    }
    window.localStorage.setItem(grocerykey, JSON.stringify(lstCart));
      updateMiniCart();
   //resetPhpCart();
   refreshPhpCart();
  }
  $(d).parent().parent(".ballremarks").toggle();
  //console.log(value);
        }
$(".user-replacement-option").hide();

$(document).mouseup(function(e){
    var container = $(".lang-select");
     var container2 = $(".checkreplace");
	 var container3 =$(".alllabel"); 					
    // If the target of the click isn't the container
    if(!container.is(e.target) && container.has(e.target).length === 0 && !container2.is(e.target) && container2.has(e.target).length === 0 && !container3.is(e.target) && container3.has(e.target).length === 0){
        $(".ballremarks").hide();
			$('.btn-select').removeClass('currentoption');
    }
});



</script>
                                        <script type="text/javascript">
                                                                if ($(window).width() < 800)
                                                                    addsupersaverslider();
                                                                if ($(window).width() > 800)
                                                                    addsupersaversliderdesk();

                                                                $(window).on("resize", function (event) {
                                                                    if ($(window).width() < 800)
                                                                        addsupersaverslider();
                                                                    else
                                                                        removesupersaverslider();
                                                                });
                                                                function addsupersaversliderdesk() {
                                                                    $('.clsChallengeSecCart .clsChallengeSlider').slick({

                                                                        infinite: true,

                                                                        slidesToShow: 4,

                                                                        slidesToScroll: 1,

                                                                        autoplay: false,

                                                                        variableWidth: true,

                                                                        arrows: true,

                                                                        prevArrow: '<i class="left">&#x2039;</i>',

                                                                        nextArrow: '<i class="right">&#x203A;</i>',

                                                                        centerMode: false,

                                                                        dots: false,
                                                                        responsive: [
                                                                            {
                                                                                breakpoint: 1024,
                                                                                settings: {
                                                                                    slidesToShow: 4,
                                                                                    slidesToScroll: 1,
                                                                                    infinite: true,
                                                                                    dots: true
                                                                                }
                                                                            },
                                                                            {
                                                                                breakpoint: 600,
                                                                                settings: {
                                                                                    slidesToShow: 2,
                                                                                    slidesToScroll: 1,
                                                                                }
                                                                            },
                                                                            {
                                                                                breakpoint: 480,
                                                                                settings: {
                                                                                    slidesToShow: 1,
                                                                                    slidesToScroll: 1,
                                                                                }
                                                                            }
                                                                            // You can unslick at a given breakpoint now by adding:
                                                                            // settings: "unslick"
                                                                            // instead of a settings object
                                                                        ]
                                                                    });
                                                                }

                                                                function addsupersaverslider() {
                                                                    $('.clsChallengeSecCart .clsChallengeSlider').slick({

                                                                        infinite: true,

                                                                        slidesToShow: 4,

                                                                        slidesToScroll: 1,

                                                                        autoplay: false,

                                                                        variableWidth: true,

                                                                        arrows: true,

                                                                        prevArrow: '<i class="left">&#x2039;</i>',

                                                                        nextArrow: '<i class="right">&#x203A;</i>',

                                                                        centerMode: false,

                                                                        dots: false,
                                                                        responsive: [
                                                                            {
                                                                                breakpoint: 1024,
                                                                                settings: {
                                                                                    slidesToShow: 3,
                                                                                    slidesToScroll: 1,
                                                                                    infinite: true,
                                                                                    dots: true
                                                                                }
                                                                            },
                                                                            {
                                                                                breakpoint: 600,
                                                                                settings: {
                                                                                    slidesToShow: 2,
                                                                                    slidesToScroll: 1,
                                                                                }
                                                                            },
                                                                            {
                                                                                breakpoint: 480,
                                                                                settings: {
                                                                                    slidesToShow: 1,
                                                                                    slidesToScroll: 1,
                                                                                }
                                                                            }
                                                                            // You can unslick at a given breakpoint now by adding:
                                                                            // settings: "unslick"
                                                                            // instead of a settings object
                                                                        ]
                                                                    });
                                                                }

                                                                function removesupersaverslider() {
                                                                    if ($('clsChallengeSecCart .clsChallengeSlider').hasClass('slick-initialized'))
                                                                        $('clsChallengeSecCart .clsChallengeSlider').slick('unslick');
                                                                }
                                                                //super saver ends
                                                                /*
                                                                $('#changeAdressSavebtn').on("click", function (e) {
                                                                    if ($('input[id="postal_code3"]').val().toString() != $('input[id="zipcode"]').val().toString() && isAddressSelected == true && isError == false) {
                                                                        return confirm('Dear Customer, It looks like the delivery address is changed. Your cart items and shipping charges are be updated based on product availability. Please review again before processing payment.');

                                                                    }
                                                                })
                                                                */
                                                                restoreCartSection();
                                                                //selectCartSection('Groceries');

                                                                if ($(window).width() < 800)
                                                                    addCartStoreSlider();
                                                                $(window).on("resize", function (event) {
                                                                    if ($(window).width() < 800)
                                                                        addCartStoreSlider();
                                                                    else
                                                                        removeCartStoreSlider();
                                                                });
                                                                function addCartStoreSlider() {
                                                                    $('.clsCartStores .clsContent').slick({
                                                                        infinite: false,
                                                                        slidesToScroll: 1,
                                                                        autoplay: false,
                                                                        variableWidth: true,
                                                                        arrows: true,
                                                                        prevArrow: '<i class="left round">&#x2039;</i>',
                                                                        nextArrow: '<i class="right round">&#x203A;</i>',
                                                                        centerMode: false,
                                                                        dots: false,
                                                                        responsive: [
                                                                            {
                                                                                breakpoint: 450,
                                                                                settings: {
                                                                                    slidesToShow: 1,
                                                                                    variableWidth: false,
                                                                                    centerMode: true
                                                                                }
                                                                            }
                                                                        ]
                                                                    });
                                                                }
                                                                function removeCartStoreSlider() {
                                                                    if ($('.clsCartStores .clsContent').hasClass('slick-initialized'))
                                                                        $('.clsCartStores .clsContent').slick('unslick');
                                                                }

                                                                //supersaver script
                                        </script>
                                        <script>
                                            $(".parRadioBtnDesc").hide();
                                            $("#parRadioOne").show();
                                            $('.parRadioBtn').click(function () {
                                                $(".parRadioBtnDesc").hide();
                                                $(".parRadioBtnDesc").hide();
                                                //get the value of data-album-id-trigger
                                                var tid = $(this).data('paymtmethod');

                                                //hide all album-list then show only the one's with data-album-id same as the clicked value
                                                $("#" + tid).show();

                                                //remove Spin Product Alredy Paid
                                                removeSpinDiwaliPrdct();
                                            })

                                        </script>
                                        <script>
                                            $('body').on('click', '.modal-togglebtn', function (e) {
                                                e.preventDefault();
                                                $('body').toggleClass('modal-open');
                                                $('#produtcRemovalAlertbox').toggleClass('show');
                                            });
                                        </script>

<?php
//Product Removal Code Start
if (!empty($productidarrNotPresent)) {
    echo "<script type='text/javascript'>
                                                $(document).ready(function(){
                                                $('body').toggleClass('modal-open');
                                                $('#productRemovalAlertbox').toggleClass('show');
                                                });
                                                </script>";
}

//Product Removal Code Start
if (count($productidForupdateprice)>0) {
    echo "<script type='text/javascript'>
                                                $(document).ready(function(){
                                                openDialog('dvDialog-pricemodal');
												 });
                                                </script>";
}
//Mealme Product Removal Code Start
if ($mealmemsg!='') {
    echo "<script type='text/javascript'>
                                                $(document).ready(function(){
                                                openDialog('dvDialog-mealme');
												 });
                                                </script>";
}
?>
<script type='text/javascript'>
function openofferpage(){
	 $('#openofferpage').fadeIn('fast', function () {
                                                $(this).find('.clsDialog-Box').slideDown('normal');
                                                $(this).find('.clsDialog-Box').css({'pointer-events': 'auto'});
                                            });
}
 function closeofferDialog(id) {
                                            $('#' + id).find('.clsDialog-Box').slideUp('fast', function () {
                                                $('#' + id).fadeOut('fast');
                                                $('#' + id).find('.clsDialog-Box').css({'pointer-events': 'none'});
                                            });
											
                                        }
function applycouponcode(copuponcode){
	//alert(copuponcode);
	$("#e-vouchercode").val(copuponcode);
     $('#couponfrm').submit();
}										
function openDialog(id) {
                                            $('#' + id).fadeIn('fast', function () {
                                                $(this).find('.clsDialog-Box').slideDown('normal');
                                                $(this).find('.clsDialog-Box').css({'pointer-events': 'auto'});
                                            });
                                        }

                                        function closeDialog(id) {
                                            $('#' + id).find('.clsDialog-Box').slideUp('fast', function () {
                                                $('#' + id).fadeOut('fast');
                                                $('#' + id).find('.clsDialog-Box').css({'pointer-events': 'none'});
                                            });
											 updateMiniCart();
                                             resetPhpCart();
                                        }
										function removeproductbyidandsection(pid,section){
											
	
    var lstCart = [];
	if(section=='grocery'){
		var key='cart_grocery';
	}
    var cart = window.localStorage.getItem(key);
    if (cart != null && cart != '') {
        lstCart = JSON.parse(cart);
        if (lstCart.length > 0) {
           
            for (var i = 0; i < lstCart.length; i++) {
				if(lstCart[i].pid==pid){
					removeMiniCartProd(i, key);
					closeDialog('dvDialog-pricemodal');
					
				}
				
            }
        }
    }
											
	}
														function removemealmeproduct(){
	var prodDBCheckarrmealme = <?php echo json_encode($prodDBCheckarrmealme); ?>;
	var vvcount=0;
	for(var kk=0; kk< prodDBCheckarrmealme.length; kk++){
	$.each(prodDBCheckarrmealme, function (key, item) {
		
                                              var indxid = item.indx;
                                              var sectChkProduct = item.section;
                                              removeFromCartDeltedOutoffstockInactive(indxid, sectChkProduct);
                                          });
										  vvcount++;
	}
if(vvcount==prodDBCheckarrmealme.length){
	updateMiniCart();
    resetPhpCart();
    refreshPhpCart();
}										  
										  
}
                                            function removeFromCartDeltedOutoffstockInactive(i, key) {
                                                var lstCart = [];
                                                var cart = window.localStorage.getItem(key);
                                                if (cart != null && cart != '')
                                                    lstCart = JSON.parse(cart);
                                                if (lstCart.length > 0)
                                                    lstCart.splice(i, 1);
                                                window.localStorage.setItem(key, JSON.stringify(lstCart));
                                                //updateMiniCart();
                                                //resetPhpCart();
                                            }

                                            $('body').on('click', '.modalproductRemovalAlert-togglebtn', function (e) {
                                                e.preventDefault();
                                                $('body').toggleClass('modal-open');
                                                $('#productRemovalAlertbox').toggleClass('show');
                                                updateMiniCart();
                                                resetPhpCart();
                                                refreshPhpCart();
                                            });
                                            $('body').on('click', '.productRemovalAlertmdlBtn', function (e) {
                                                e.preventDefault();
                                                $('body').toggleClass('modal-open');
                                                $('#productRemovalAlertbox').toggleClass('show');
                                                updateMiniCart();
                                                resetPhpCart();
                                                refreshPhpCart();
                                            });
											 <?php if ($_REQUEST['evcode'] == 'e-coupon' || $_REQUEST['evcode'] == 'e-reward' || $_REQUEST['evcode'] == 'e-wallet' || $_REQUEST['couponcoderemove']!='') {?>
											    updateMiniCart();
                                                resetPhpCart();
                                                refreshPhpCart();
											 <?php } ?>
                                        </script>

                                        <script type="text/javascript">
                                             $(document).ready(function(){
                                                 //setInterval(checkExpireSlot(),1000*60*15); 
                                              });
											  
											
                                            var prodDBCheckarrJS = <?php echo json_encode($productidarrNotPresent); ?>;

                                            $.each(prodDBCheckarrJS, function (key, item) {
                                                var indxid = item.indx;
                                                var sectChkProduct = item.section;

                                                removeFromCartDeltedOutoffstockInactive(indxid, sectChkProduct);
                                            });
											var prodpricrDBCheckarrJS = <?php echo json_encode($productidForupdateprice); ?>;
                                            
                                            $.each(prodpricrDBCheckarrJS, function (key, item) {
                                               
                                                var sectChkProduct = item.section;
												//alert(sectChkProduct);
												 var lstCart = [];
	if(item.section=='grocery'){
		var key='cart_grocery';
	}
    var cart = window.localStorage.getItem(key);
    if (cart != null && cart != '') {
        lstCart = JSON.parse(cart);
        if (lstCart.length > 0) {
           
            for (var i = 0; i < lstCart.length; i++) {
				if(lstCart[i].pid==item.pid){
					updatepricebyproductid(i, lstCart[i].qty, key, item.pid, item.latest_cost, item.latest_tax);
					
				}
				
            }
        }
    }

                                            });
					function updatepricebyproductid(i,qty,key,pid,lprice,ltax) {
						//alert(lprice);
					var lstCart = [];
    var cart = window.localStorage.getItem(key);
    if (cart != null && cart != '')
        lstCart = JSON.parse(cart);
        
      
    if (lstCart.length > 0) {
		if(lstCart[i].pid==pid){
		lstCart[i].price=(parseFloat(lprice)).toFixed(2);
		lstCart[i].calcprice=(parseFloat(lprice)).toFixed(2);
		lstCart[i].baseTax=(parseFloat(ltax)).toFixed(2);
        lstCart[i].total = (parseFloat(lstCart[i].calcprice) * parseInt(lstCart[i].qty)).toFixed(2);
        lstCart[i].tax = (parseFloat(lstCart[i].baseTax) * parseInt(lstCart[i].qty)).toFixed(2);
	}	
	}
    window.localStorage.setItem(key, JSON.stringify(lstCart));	
	}				
		
function btnstoreupdown(ink){
	 var prod = $(ink).parents('.tempcartcartStoreProd');
	
     $(prod).toggleClass('active');
	 $(prod).siblings().removeClass('active');
	  
}		
function setpDeliveryType(ink,type,section,amount,storeid){
	$(ink).toggleClass('activepriority');
	$(ink).siblings().removeClass('activepriority');
	if(section=='grocery'){
	if(type==1){
		 var tabValue=1;
		 
		 document.cookie = "grocerypriority" + "=" + tabValue + ";" + "path=/";
	} else {
		 var tabValue=0;
		 document.cookie = "grocerypriority" + "=" + tabValue + ";" + "path=/";
	}	
	}
	updateMiniCart();
     resetPhpCart();
     refreshPhpCart();
	
}
function setpDeliveryTypef(ink){
	$(ink).toggleClass('activepriority');
	$(ink).siblings().removeClass('activepriority');
	var type=$(ink).data('type')
	if(type==1){
		 var tabValue=1;
		 document.cookie = "foodpriority" + "=" + tabValue + ";" + "path=/";
	} else {
		 var tabValue=0;
		 document.cookie = "foodpriority" + "=" + tabValue + ";" + "path=/";
	}	
	
	 updateMiniCart();
     resetPhpCart();
     refreshPhpCart();
}
<?php if ($_REQUEST['changerequest'] == 'yes'){?>
updateMiniCart();
resetPhpCart();
refreshPhpCart();
<?php } ?>
function closetooltip(){
	$('.tooltipcheckoutbody').removeClass('active');
}
function opentooltip(){
	$('.tooltipcheckoutbody').addClass('active');
	
}

                                           /* $.each(prodDBCheckarrJS, function(key, item){ 
                                             var indxid= item.indx;
                                             var sectChkProduct= item.section;
                                             //removeFromCartPg(indxid,'sectChkProduct');
                                             
                                             removeFromCart(indxid,sectChkProduct);
                                             }); */
                                            //refreshPhpCart();
                                            //  Product Removal Code Ends
                                        </script>

                                        </body>
                                        </html>
                                        <?php
//print_r($_SESSION); 
setcookie('firstTimeSubmitYes','Yes', time() + (86400 * 30 * 12), "/"); // 86400 = 1 day
?>

 

Directory Contents

Dirs: 9 × Files: 57

Name Size Perms Modified Actions
calender DIR
- drwxrwxr-x 2024-09-18 10:03:34
Edit Download
css DIR
- drwxrwxr-x 2024-09-18 10:03:34
Edit Download
fonts DIR
- drwxrwxr-x 2024-09-18 10:03:34
Edit Download
images DIR
- drwxrwxr-x 2024-10-07 09:56:45
Edit Download
include DIR
- drwxrwxr-x 2024-10-07 04:22:30
Edit Download
js DIR
- drwxrwxr-x 2025-01-17 12:35:12
Edit Download
nplogs DIR
- drwxrwxr-x 2025-01-16 17:15:32
Edit Download
plugin DIR
- drwxrwxr-x 2024-09-18 10:03:34
Edit Download
vendor DIR
- drwxrwxr-x 2023-05-04 22:10:04
Edit Download
22.01 KB lrwxrwxr-x 2024-09-21 10:02:40
Edit Download
10.15 KB lrwxrwxr-x 2024-09-18 10:03:34
Edit Download
1.00 KB lrwxrwxr-x 2024-09-18 10:03:34
Edit Download
2.65 KB lrwxrwxr-x 2024-09-18 10:03:34
Edit Download
19.84 KB lrwxrwxr-x 2024-09-18 10:03:34
Edit Download
21.43 KB lrwxrwxr-x 2024-09-18 10:03:34
Edit Download
1.60 KB lrwxrwxr-x 2024-09-18 10:03:34
Edit Download
130.09 KB lrwxrwxr-x 2024-09-18 10:03:34
Edit Download
148.96 KB lrwxrwxr-x 2025-01-17 13:33:24
Edit Download
13.15 KB lrwxrwxr-x 2024-10-07 08:34:13
Edit Download
11.35 KB lrwxrwxr-x 2024-12-12 08:05:39
Edit Download
562 B lrwxrwxr-x 2024-09-18 10:03:34
Edit Download
5.22 KB lrwxrwxr-x 2024-09-18 10:03:34
Edit Download
60.62 KB lrwxrwxr-x 2024-09-18 10:03:34
Edit Download
40.00 KB lrwxrwxr-x 2024-09-18 10:03:34
Edit Download
162.98 KB lrwxrwxr-x 2024-09-18 10:03:34
Edit Download
5.67 KB lrwxrwxr-x 2024-09-18 12:41:24
Edit Download
9.63 KB lrwxrwxr-x 2024-09-18 10:03:34
Edit Download
2.45 KB lrwxrwxr-x 2024-09-18 10:03:34
Edit Download
294 B lrwxrwxr-x 2024-10-07 15:26:12
Edit Download
99.28 KB lrwxrwxr-x 2024-12-03 09:10:10
Edit Download
1.13 KB lrwxrwxr-x 2024-09-18 10:03:34
Edit Download
64.12 KB lrwxrwxr-x 2024-09-18 10:03:34
Edit Download
23.42 KB lrwxrwxr-x 2024-09-18 10:03:34
Edit Download
4.33 KB lrwxrwxr-x 2024-09-18 10:03:34
Edit Download
8.25 KB lrwxrwxr-x 2024-10-26 12:58:33
Edit Download
9.62 KB lrwxrwxr-x 2024-09-18 10:03:34
Edit Download
32.86 KB lrwxrwxr-x 2024-09-18 10:03:34
Edit Download
35.14 KB lrwxrwxr-x 2024-10-07 06:47:20
Edit Download
48.84 KB lrwxrwxr-x 2024-10-07 06:45:37
Edit Download
41.42 KB lrwxrwxr-x 2025-01-14 13:31:42
Edit Download
72.76 KB lrwxrwxr-x 2024-09-18 10:03:34
Edit Download
51.54 MB lrwxrwxr-x 2025-01-10 05:10:16
Edit Download
6.66 KB lrwxrwxr-x 2024-09-18 10:03:34
Edit Download
1.22 KB lrwxrwxr-x 2024-09-18 10:03:34
Edit Download
4.74 KB lrwxrwxr-x 2024-09-21 10:04:35
Edit Download
48.69 KB lrwxrwxr-x 2024-10-04 10:12:32
Edit Download
9.35 KB lrwxrwxr-x 2024-09-18 14:59:22
Edit Download
3.25 KB lrwxrwxr-x 2024-10-04 14:26:58
Edit Download
7.69 KB lrwxrwxr-x 2024-09-18 17:17:18
Edit Download
10.49 KB lrwxrwxr-x 2024-09-18 10:03:34
Edit Download
4.50 KB lrwxrwxr-x 2024-09-18 10:03:34
Edit Download
73.11 KB lrwxrwxr-x 2025-01-15 13:40:49
Edit Download
5.40 KB lrwxrwxr-x 2024-09-18 10:03:34
Edit Download
156.66 KB lrwxrwxr-x 2025-01-08 09:40:55
Edit Download
1.99 KB lrwxrwxr-x 2024-09-18 10:03:34
Edit Download
911 B lrwxrwxr-x 2024-09-18 10:03:34
Edit Download
8.75 KB lrwxrwxr-x 2024-09-18 10:03:34
Edit Download
5.91 KB lrwxrwxr-x 2024-10-04 10:30:55
Edit Download
23.14 KB lrwxrwxr-x 2024-10-26 12:52:36
Edit Download
5.40 KB lrwxrwxr-x 2024-09-18 10:03:34
Edit Download
268.66 KB lrwxrwxr-x 2024-12-24 14:22:54
Edit Download
4.65 KB lrwxrwxr-x 2024-09-18 10:03:34
Edit Download
1.23 KB lrwxrwxr-x 2024-09-18 10:03:34
Edit Download
3.99 KB lrwxrwxr-x 2024-10-07 03:39:36
Edit Download
29.37 KB lrwxrwxr-x 2024-10-04 14:59:07
Edit Download
1.32 KB lrwxrwxr-x 2024-10-04 11:52:07
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).