PHP 7.4.33
Preview: js.php Size: 41.42 KB
//home/justbyquicklly-old/public_html/test/js.php

<script src="plugin/jquery-3.1.0.min.js" type="text/javascript" ></script>

<script src="js/jquery.easing.min.js" type="text/javascript"></script>
<!--Slider-->



<script src="plugin/slick_1.8.1/slick.min.js" type="text/javascript"></script>



<?php 
$_COOKIE['grocery_tab_index'] = sanitizeInputVar($_COOKIE['grocery_tab_index']);
$_COOKIE['state'] = sanitizeInputVar($_COOKIE['state']);
$_COOKIE['pincode'] = sanitizeInputVar($_COOKIE['pincode']);
$_COOKIE['email'] = sanitizeInputVar($_COOKIE['email']);
$_COOKIE['mobile'] = sanitizeInputVar($_COOKIE['mobile']);
$_COOKIE['street'] = sanitizeInputVar($_COOKIE['street']);

if(basename($_SERVER['SCRIPT_NAME']) != 'index.php' && basename($_SERVER['SCRIPT_NAME'])!='curry-box-product-select.php' && basename($_SERVER['SCRIPT_NAME']) != 'meal-kit-select.php'){ ?>
<script src="plugin/tabcontent_2013.7.6/tabcontent.min.js" type="text/javascript"></script>
<script src="js/jquery.easing.min.js" type="text/javascript"></script>
<script src="js/jquery.validate.min.js" type="text/javascript"></script>

<?php }

/*$sqlloginuser = $obj->query("select user_type,fname,lname,chef_flag,email,house_no,street,city_id,pincode from tbl_user where id='" . $_SESSION['value_user_id'] . "'");
$resuserlogin = $obj->fetchNextObject($sqlloginuser);
$_SESSION['pincode'] = $resuserlogin->pincode;*/
$pincode='0';
if(trim($_SESSION['pincode'])==''){  $pincode='0'; }else{   $pincode=trim($_SESSION['pincode']);}

if (!isset($_COOKIE['postalcode']) && basename($_SERVER['SCRIPT_NAME'] != 'index.php')) { ?>
    <style>
        a.inactive-link {
            pointer-events:none;
        }  
    </style>
    <script>
        GetStyleClass('a').pointerEvents = "none"

        function GetStyleClass(className)
        {
            for (var i = 0; i < document.styleSheets.length; i++) {
                var styleSheet = document.styleSheets[i]

                var rules = styleSheet.cssRules || styleSheet.rules

                for (var j = 0; j < rules.length; j++) {
                    var rule = rules[j]
                    console.log(rule.selectorText);
                    if (rule.selectorText === className) {
                        return(rule.style)
                    }
                }
            }

            return 0
        }
    </script>
<?php } ?>
<script>
    function changeStoreZip() {
        if (getCookie('postalcode').trim() != '') {
            if (getCookie('postalcode').trim() != $("#subscribe").find("#zipcode").val().trim()) {
                	var cart_food = window.localStorage.getItem('cart_food');
                	var cartgrocery = window.localStorage.getItem('cart_grocery');
		        	var cartshef = window.localStorage.getItem('cart_shef');
		        	let checkcart_val=0;
		        	if(typeof(cart_food) != "undefined" && cart_food != null && cart_food != '')
		        	{
		        	    checkcart_val=1;
		        	}
		        	else if(typeof(cartgrocery) != "undefined" && cartgrocery != null && cartgrocery != '')
		        	{
		        	    checkcart_val=1;
		        	}
		        		else if(typeof(cartshef) != "undefined" && cartshef != null && cartshef != '')
		        	{
		        	    checkcart_val=1;
		        	}
		        
		        	if(checkcart_val==1)
		        	{
                var flgConfirm = confirm('Your cart will get clear on changing zipcode! Continue?');

                if (flgConfirm) {
                    localStorage.clear();
                }

                return flgConfirm;
		        	}
            }
        }

        return true;
    }
    
    function isNumberKey(evt) {
        var charCode = (evt.which) ? evt.which : event.keyCode
        if (charCode > 31 && (charCode < 48 || charCode > 57 || charCode == 13))
            return false;

        return true;
    }
</script>
<?php if(basename($_SERVER['SCRIPT_NAME']) != 'index.php'){ ?>
<script>
    //Mini cart - Food Suggest Popup
   /* function checkFoodPopUp(){
	toggleInnerCart();
        //CHECK SLOT EXPIRY
		checkExpireSlot();
		if(chkSlot == false){
				//alert('inside false');
				return false;
		}
        var flgProceed = true;

        if(getCookie('foodSuggestPopup') == '0')
            flgProceed = false;
        else{
            var cart = window.localStorage.getItem('cart_food');
            if (cart != null && cart != '') {
                lstCart = JSON.parse(cart);
                if (lstCart.length > 0) {
                    for (var i = 0; i < lstCart.length; i++){
                        if(lstCart[i].section == 'food' || lstCart[i].section == 'catering' || lstCart[i].section == 'tiffin'){
                            flgProceed = false;
                            break;
                        }
                    }
                }
            }
        }

        if(flgProceed && $('.clsFSP_StoreSlider .clsFSP_Store').length > 0){
            var CookieDate = new Date;
            CookieDate.setFullYear(CookieDate.getFullYear() +1);
            document.cookie = "fspd=1; expires=" + CookieDate.toGMTString() + "; path=/";

            $('#dvFoodSuggestPopup').fadeIn('fast', function () {
                $(this).find('.clsDialog-Box').slideDown('normal');
                $(this).find('.clsDialog-Box').css({'pointer-events': 'auto'});
                
                if(!$('.clsFSP_StoreSlider').hasClass('slick-initialized')){
                    $('.clsFSP .clsFSP_StoreSlider').on('init', function(event, slick){
                        $('.clsFSP .clsFSP_StoreSlider').fadeIn();
                    });

                    $('.clsFSP .clsFSP_StoreSlider').slick({
                        infinite: false,
                        slidesToShow: 4,
                        slidesToScroll: 4,
                        autoplay: false,
                        variableWidth: false,
                        arrows: true,
                        prevArrow: '<i class="left">&#x2039;</i>',
                        nextArrow: '<i class="right">&#x203A;</i>',
                        centerMode: false,
                        dots: false,
                        responsive: [
                            {
                                breakpoint: 700,
                                settings: {
                                    slidesToShow: 3,
                                    slidesToScroll: 3
                                }
                            },
                            {
                                breakpoint: 600,
                                settings: {
                                    slidesToShow: 2,
                                    slidesToScroll: 2
                                }
                            }
                        ]
                    });

                    $('.clsFSP .clsFSP_StoreSlider').on('afterChange', function (event, slick, currentSlide) {
                        console.log(currentSlide);

                        // if(currentSlide === 8) {
                        //     $('.clsContent.clsFSP .clsFSP_StoreSlider .slick-arrow.right').fadeOut();
                        // }
                        // else {
                        //     $('.clsContent.clsFSP .clsFSP_StoreSlider .slick-arrow.right').fadeIn();
                        // }

                        // if(currentSlide === 0)
                        //     $('.clsContent.clsFSP .clsFSP_StoreSlider .slick-arrow.left').fadeOut();
                        // else
                        //     $('.clsContent.clsFSP .clsFSP_StoreSlider .slick-arrow.left').fadeIn();
                    });

                    //$('.clsContent.clsFSP .clsFSP_StoreSlider .slick-arrow.left').hide();
                }

                $('.clsContent.clsFSP .popup-bg').animate({bottom:'-21%'},1500);
            });

            return false;
        }
        else
            return true;
    }*/

    function closeFoodPopUp(flg){
        $('#dvFoodSuggestPopup').find('.clsDialog-Box').slideUp('fast', function () {
            $('#dvFoodSuggestPopup').fadeOut('fast');
            $('#dvFoodSuggestPopup').find('.clsDialog-Box').css({'pointer-events': 'none'});
            $('.clsContent.clsFSP .popup-bg').css('bottom','-50%');
        });

        document.cookie = "foodSuggestPopup=0; expires=0; path=/";
        $('#prod-loader').fadeIn();

        if(!flg)
            window.location.href = '/checkout';
    }

    function getCookie(cname) {
        var name = cname + "=";
        var ca = document.cookie.split(';');
        for (var i = 0; i < ca.length; i++) {
            var c = ca[i];
            while (c.charAt(0) == ' ') c = c.substring(1);
            if (c.indexOf(name) != -1) return c.substring(name.length, c.length);
        }
        return "";
    }
</script>
<?php } ?>
<script>

    $(document).ready(function () {
        $('.complete-address').on('keyup', function(e) {   
                isAddressSelected = false;
                console.log($(this));
                if($(this).val()=='' && $(this).attr('id')=='autocomplete3'){
                    $("#autocomplete3").next().next().hide();
                }
                if($(this).val()=='' && $(this).attr('id')=='autocomplete2'){
                    $("#autocomplete2").next().next().hide();
                }
                 if($(this).val()=='' && $(this).attr('id')=='autocomplete'){
                    $("#autocomplete").next().next().hide();
                }
                 if($(this).val()=='' && $(this).attr('id')=='autocomplete4'){
                    $("#autocomplete4").next().next().hide();
                }
         });
        var guestAddressValidator =  $("#frmGuestAddress").validate({
            submitHandler: function(form) {
                var msg = "";
				var chkVerify = $("#chk_verify_sts_gst").val();
				$("#frm_action_type").val('guestu');
				var resenMnum = window.btoa($("#mobilegst").val());
				var resenEml = window.btoa($("#emlgst").val());
				var countryCd = window.btoa($("#country_code").val());
				$("#chk_qcphn").val(resenMnum);
				$("#chk_qceml").val(resenEml);
				
				$("#chk_qcctr_cd").val(countryCd);
				//var resenMnum= window.btoa(resenMnum);
                //var countryCd= window.btoa(countryCd);
				//alert(countryCd);
				
                if($("#street_number2").val()==''){
                     msg = ("Google does not recognize your address. Your street name needs to be revised.");
                 }
                /*if($("#locality2").val()==''){
                     msg = ("Google does not recognize your address. Your city name needs to be revised.");
                 } */
                if($("#administrative_area_level_12").val()==''){
                     msg = ("Google does not recognize your address. Your state name needs to be revised.");
                 }
                 if($("#postal_code2").val()==''){
                     msg = ("Google does not recognize your address. Your Zip code is not valid.");
                 }
                if( isAddressSelected == false){
                    msg = ("Your current address does not look right. Please select a valid address!");
                 }  
                if(msg!=""){
                          guestAddressValidator.showErrors({
                             street_address: msg  
                         });

                 } else {
                     if ($('input[id="postal_code2"]').val().toString() != $('input[id="zipcode"]').val().toString() ) {
                            <?php if ($_COOKIE['grocery_tab_index'] == 0) { ?>
															
														var cookie_zipcode = '<?php echo $_COOKIE['postalcode'];?>';
														var current_zipcode = $('input[id="postal_code2"]').val().toString();
														
									if((current_zipcode != cookie_zipcode) && chkVerify==0)
									{
										if(confirm('Your browsing zipcode is different from your shipping address. Do you want to continue?'))
										{
											var flgConfirm = true;
										}
										else{
											var flgConfirm = false;
										}
									}
									else
									{
										var flgConfirm = true;
										//alert(current_zipcode +'='+ cookie_zipcode);
										if(current_zipcode != cookie_zipcode)
										{
											changeZipcode(cookie_zipcode, current_zipcode);
										}
									}
									
									if(flgConfirm == false)
									{
										return false;															
									}
								   else{
									   //alert(chkVerify);
									 if(chkVerify==0) {
										 getGuestOtpc(resenMnum,countryCd,resenEml);
										 //$('#loginpanelguess').show();
										 //$('#loginpanelguess').hide();
										 //$('#acc_verify_btn').show();
									 }
									 else{	 
                                     form.submit();
									 }
                                   }
                         //if(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.')){
                              //form.submit();
                         //}
                            <?php 
                           } else { ?>
                               //echo " alert('1');form.submit();";
							   		if(chkVerify==0) {
										 getGuestOtpc(resenMnum,countryCd,resenEml);
										 //$('#loginpanelguess').hide();
										 //$('#acc_verify_btn').show();
									 }
									 else{	 
                                     form.submit();
									 }
                           <?php } ?>
                     } else {
						 //alert('2');
								if(chkVerify==0) {
									getGuestOtpc(resenMnum,countryCd,resenEml);
									//$('#loginpanelguess').hide();
									//$('#acc_verify_btn').show();
								}
							   else{	 
									form.submit();
							   }
                         }
                 }
                   
                
            }
          });
         var changeAddressValidator = $("#changeAddress").validate({
            submitHandler: function(form) {
                
                var msg = "";
				var chkVerify = $("#chk_verify_sts_gst").val();
				var changerequest = $("#changerequest").val();
				
				$("#frm_action_type").val('guestu');
				var resenMnum = window.btoa($("#mobilegst").val());
				var resenEml = window.btoa($("#emlgst").val());
				var countryCd = window.btoa($("#country_code").val());
				$("#chk_qcphn").val(resenMnum);
				$("#chk_qceml").val(resenEml);
				
				$("#chk_qcctr_cd").val(countryCd);
				
                if($("#street_number3").val() ==''){
                     msg = ("Google does not recognize your address. Your street name needs to be revised.");
                 }
                /*if($("#locality3").val()==''){
                     msg = ("Google does not recognize your address. Your city name needs to be revised.");
                 }*/
                if($("#administrative_area_level_13").val()==''){
                     msg = ("Google does not recognize your address. Your state name needs to be revised.");
                 }
                if($("#postal_code3").val()==''){
                     msg = ("Google does not recognize your address. Your Zip code is not valid.");
                 }
                if( isAddressSelected == false){
                    msg = ("Your current address does not look right. Please select a valid address!");
                 }  
                if(msg != ""){
                          changeAddressValidator.showErrors({
                             street_address: msg  
                         });

                 } else {
                      
                        if ($('input[id="postal_code3"]').val().toString() != $('input[id="zipcode"]').val().toString() ) {
                            <?php if ($_COOKIE['grocery_tab_index'] == 0) { ?>
                         //if(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.')){
                         if(confirm('')){
                              //form.submit();
							  if(chkVerify==0 && changerequest !='yes') {
									getGuestOtpc(resenMnum,countryCd,resenEml);
									//$('#loginpanelguess').hide();
									//$('#acc_verify_btn').show();
								}
							   else{	 
									form.submit();
							   }
                         }
                            <?php 
                           } else {
                               echo " form.submit();";
                           }
                            ?>
                     } else {
                        if(chkVerify==0 && changerequest !='yes') {
							
									getGuestOtpc(resenMnum,countryCd,resenEml);
									//$('#loginpanelguess').hide();
									//$('#acc_verify_btn').show();
								}
							   else{	 
									form.submit();
							   }
                     }
                 }
                 
            }
          });
     });
    $('body').on('click', '#procedcheckoutBtn', function (e) {
        $('body').toggleClass('modal-open');
        $('#signupformmodal').toggleClass('show');
        $('#signuppanel').hide();
        $('#loginpanelguess').hide();
        $('#loginpanellogin').show();
		$('#acc_verify_btn').hide();
    });

    $('body').on('click', '#proceedregister', function (e) {
        $('body').toggleClass('modal-open');
        $('#signupformmodal').toggleClass('show');
        $('#signuppanel').show();
        $('#loginpanellogin').hide();
        $('#loginpanelguess').hide();
		$('#acc_verify_btn').hide();
    });


    $('body').on('click', '.modal-togglebtn', function (e) {
        e.preventDefault();
        $('body').toggleClass('modal-open');
        $('#signupformmodal').toggleClass('show');
    });
    $('body').on('click', '.modalpayment-togglebtn', function (e) {
        e.preventDefault();
        $('body').toggleClass('modal-open');
        $('#paymentbox').toggleClass('show');
    });
    /*payment modal end*/
    /*Change Address Start*/
    $('body').on('click', '#changeAddrssBtn', function (e) {
        $('body').toggleClass('modal-open');
        $('#changeAddrssformmodal').toggleClass('show');
    });
    $('body').on('click', '.modalChangeAddress-togglebtn', function (e) {
        e.preventDefault();
        $('body').toggleClass('modal-open');
        $('#changeAddrssformmodal').toggleClass('show');
    });
    /*Change Address Ends*/

    $('body').on('click', '.guestcntBtn', function (e) {
        e.preventDefault();
        $('.usercntBtn').show();
        $('#loginpanellogin').hide();
        $('#loginpanelguess').show();
        $('#signuppanel').hide();
        $('.guestcntBtn').hide();
        $('.signupcntBtn').show();
        if($("#autocomplete2").val()=='' && isAddressSelected == true){
            isAddressSelected = false;
        }
        $('#acc_verify_btn').hide();
    });
    $('body').on('click', '.usercntBtn', function (e) {
        e.preventDefault();
        $('#loginpanelguess').hide();
        $('#loginpanellogin').show();
        $('#signuppanel').hide();
        $('.guestcntBtn').show();
        $('.signupcntBtn').show();
        $('.usercntBtn').hide();
		$('#acc_verify_btn').hide();
    });
    $('body').on('click', '.signupcntBtn', function (e) {
        e.preventDefault();
        $('#loginpanelguess').hide();
        $('#loginpanellogin').hide();
        $('#signuppanel').show();
        $('.guestcntBtn').show();
        $('.usercntBtn').show();
        $('.signupcntBtn').hide();
        if($("#autocomplete").val()=='' && isAddressSelected == true){
            isAddressSelected = false;
        }
		$('#acc_verify_btn').hide();
    });
</script>
<?php //if(basename($_SERVER['SCRIPT_NAME']) != 'index.php'){ ?>
<script>
    
    var chkStores = true;
    
    /* payment modal start*/
    $('body').on('click', '#proceedtopayment', function (e) {
        
     <?php if ( $_COOKIE['pincode'] != $_COOKIE['postalcode']) {	?>
			 
			 var old_zipcode = getCookie('pincode').trim();
			 var cur_zipcode = getCookie('postalcode').trim();		
			 			 
						if (getCookie('grocery_tab_index') == '0') {
							var flgConfirm = changeZipcode(cur_zipcode, old_zipcode);
							
							if(flgConfirm == false)
							{											
								return false;
							}

						/*if(!confirm("Your Address zip code is different from browsing zipcode! Do you want to Continue? ")){											
									return false;
								}
								else{
									//CHECK ZIPCODE STORES FROM OUT-SIDE
									checkOutStores(old_zipcode, cur_zipcode);
									if(chkStores == false){
										return false;
									}
								}*/
						}
						
		<?php	}	?>
        
        if(chkStores == false){
			return false;
		}
    
        //CHECK SLOT EXPIRY
	//	checkExpireSlot();
	/*	if(chkSlot == false){
				//alert('inside false');
				return false;
		}*/
		
		/*
		if(typeof cart_food_lstorage !== "undefined" && cart_food_lstorage != null && cart_food_session == ''){
			//alert('session food empty');
			refreshPhpCart();
			return false;
		}
		else if(typeof cart_giftcard_lstorage !== "undefined" && cart_giftcard_lstorage != null && cart_giftcard_session == ''){
			//alert('session giftcard empty');
			refreshPhpCart();
			return false;
		}
		else if(typeof cart_grocery_lstorage !== "undefined" && cart_grocery_lstorage != null && cart_grocery_session == ''){
			//alert('session grocery empty');
			refreshPhpCart();
			return false;
		}
		*/
		
        var deliverynote = $('#delivery_notesbox').val();
        if (deliverynote != '') {
            document.cookie = "delivery_notes" + "=" + deliverynote + ";" + ";path=/";
        }
        if(getCookie('grocery_tab_index') == '0')
	{
                if( isAddressSelected == false){
                    // alert("We didn't recognise your address, please update your address!");
                    // return false;
                 }

    


        var state = '<?php echo $_COOKIE['state'] ?>'
<?php
if ( $_COOKIE['state'] == '') {
    ?>

            if ($("#administrative_area_level_13").val() == '' || state == '') {
                alert("Please Add your state from \"Change Address\" button! ");
                return false;
            }   

    <?php
}
?>
        var pincode = '<?php echo $_COOKIE['pincode'] ?>'
<?php if ($_COOKIE['pincode'] == '') {
    ?>

            if ($("#postal_code3").val() == '' || pincode == '') {
                alert("Please Add your Zip Code from \"Enter Delivery Details\" button! ");
                return false;
            }

    <?php
}
?>
        var email = '<?php echo $_COOKIE['email'] ?>'
<?php if ( $_COOKIE['email'] == '') {
    ?>

            if ($("#emailid").val() == '' || email == '') {
                alert("Please Add your Email from \"Enter Delivery Details\" button! ");
                return false;
            }

    <?php
}
?>
        var mobilenum = '<?php echo $_COOKIE['mobile'] ?>'
<?php if ($_COOKIE['mobile'] == '') {
    ?>

            if ($("#user-mobile").val() == '' || mobilenum == '') {
                alert("Please Add your mobile number from \"Change Address\" button! ");
                return false;
            }

    <?php
}
?>
        var street = '<?php echo $_COOKIE['street'] ?>'

<?php
if ($_COOKIE['street'] == '') {
    ?>

            if ($("#street_number3").val() == '' || street == '') {
                //alert("Please Add your streat number from \"Change Address\" button! ");
                //return false;
            }
<?php } ?>
    
 <?php  /*if ( $_COOKIE['pincode'] != $_COOKIE['postalcode']) {
    ?>

            if ('<?php echo $_COOKIE['pincode'] ;?>' != '<?php echo $_COOKIE['postalcode'] ;?>' && getCookie('grocery_tab_index') == '0') {
                
                if(!confirm("Your Address zip code is different from browsing zipcode! Do you want to Continue? ")){
                    
                  return false;
                }
                
            }

    <?php
}*/
?>
    }
        $('body').toggleClass('modal-open');
        $('#paymentbox').toggleClass('show');
   });
   
   var checkReturn = 0;
   //function to check with changed zipcode
   function changeZipcode(old_zipcode, current_zipcode)
   {
			
	 }
	 
	  function changeZipcodeForMoments(old_zipcode, current_zipcode)
   {
			var cf_length = 0;
			var cg_length = 0;
			var cs_length = 0;
			var user_length = 0;
			var cartfood = window.localStorage.getItem('cart_food');
			var cartgrocery = window.localStorage.getItem('cart_grocery');
			var cartshef = window.localStorage.getItem('cart_shef');
			var cur_user = '<?php echo $_SESSION['value_user_id'] ?>';		
			
			if(typeof(cartfood) != "undefined" && cartfood != null && cartfood != ''){
				cart_food = JSON.parse(cartfood);
				cf_length = cart_food.length;
			}			
			if(typeof(cartgrocery) != "undefined" && cartgrocery != null && cartgrocery != ''){
				cart_grocery = JSON.parse(cartgrocery);
				cg_length = cart_grocery.length;
			}
           if(typeof(cartshef) != "undefined" && cartshef != null && cartshef != ''){
				cart_shef = JSON.parse(cartshef);
				cs_length = cart_shef.length;
			}			
			if(typeof(cur_user) != "undefined" && cur_user != null && cur_user != ''){
				user_length = 1;
			}
			
			if(cf_length == 0 && cg_length == 0 && cs_length==0 && user_length == 0)	//User not logged in & no data for food and grocery cart
			{
				//alert('11');
				return true;
			}
			else if(cf_length == 0 && cg_length == 0 && cs_length==0 && user_length != 0)	//User logged in & no data for food and grocery cart
			{
				var user_pincode = getCookie('pincode').trim();
				//alert('22');
				
			/*	if(current_zipcode != user_pincode)
				{
					if(confirm('Your browsing zipcode is different from your shipping address. Do you want to continue?'))
					{
						return true;
					}
					else{
						return false;
					}
				}
				else
				{
					return true;
				}*/
				
			}
			else if((cf_length != 0 || cg_length != 0 || cs_length!=0) && user_length == 0)  // User not logged in & data exist for food or grocery cart
			{
				//alert('33');
				//alert(old_zipcode+' >> '+current_zipcode);
				checkZipStores(old_zipcode, current_zipcode); // Check stores difference in old & new zipcode 

				if(checkReturn == 0) //No store from out of zipcode
				{
					return true;
				}
				else{
				/*	flgConfirm = confirm('Some of the items/stores does not serves in your new zipcode and will be removed from the cart. Click ok to proceed.');
					if(flgConfirm)
					{
						checkOutStores(old_zipcode, current_zipcode);		// Update cart based on new zipcode
					}
					else
					{
						return false;
					}*/
				}				
			}
			else if((cf_length != 0 || cg_length != 0 || cs_length != 0) && user_length != 0)		// User logged in & data exist for food or grocery cart
			{
				//alert('44');				
				//alert(old_zipcode+' >> '+current_zipcode);
				checkZipStores(old_zipcode, current_zipcode);
				
				if(checkReturn == 0)
				{
					var user_pincode = getCookie('pincode').trim();
				
					/*if(current_zipcode != user_pincode)
					{
						if(confirm('Your browsing zipcode is different from your shipping address. Some of the items/stores does not serves in your new zipcode and will be removed from the cart. Do you want to continue?'))
						{
							return true;
						}
						else{
							return false;
						}
					}
					else{
						return true;
					}*/
				}
				else{
				/*	flgConfirm = confirm('Some of the items/stores does not serves in your new zipcode and will be removed from the cart. Click ok to proceed.');
					if(flgConfirm)
					{
						checkOutStores(old_zipcode, current_zipcode);
					}
					else
					{
						return false;
					}*/
				}	
			}
	 }
	 
	 function changeLoginZipcode(old_zipcode, current_zipcode, cur_user)
   {
			var cf_length = 0;
			var cg_length = 0;
			var user_length = 0;
			var cartfood = window.localStorage.getItem('cart_food');
			var cartgrocery = window.localStorage.getItem('cart_grocery');
			
			if(typeof(cartfood) != "undefined" && cartfood != null && cartfood != ''){
				cart_food = JSON.parse(cartfood);
				cf_length = cart_food.length;
			}			
			if(typeof(cartgrocery) != "undefined" && cartgrocery != null && cartgrocery != ''){
				cart_grocery = JSON.parse(cartgrocery);
				cg_length = cart_grocery.length;
			}						
			if(typeof(cur_user) != "undefined" && cur_user != null && cur_user != ''){
				user_length = 1;
			}		
												
			if(cf_length == 0 && cg_length == 0 && user_length != 0)	//User logged in & no data for food and grocery cart
			{
				//alert('22');				
				if(current_zipcode != old_zipcode)
				{
					alert('Your browsing zipcode is different from your shipping address.');
				}			
			}			
			else if((cf_length != 0 || cg_length != 0) && user_length != 0)		// User logged in & data exist for food or grocery cart
			{
				//alert('44');				
				checkZipStores(old_zipcode, current_zipcode);
				
				if(checkReturn == 0)
				{
					return true;
				}
				else{
					alert('Some of the items/stores does not serves in your new zipcode and will be removed from the cart. Click ok to proceed.');
					checkOutStores(old_zipcode, current_zipcode);
					
					setCookie('postalcode', current_zipcode);
					/*flgConfirm = confirm('Some of the items/stores does not serves in your new zipcode and will be removed from the cart. Click ok to proceed.');
					if(flgConfirm)
					{
						checkOutStores(old_zipcode, current_zipcode);
					}
					else
					{
						return false;
					}*/
				}	
			}
	 }
	 
	 //FUNCTION TO CHECK ZIPCODE STORES FROM OUT-SIDE
   function checkZipStores(old_zipcode, current_zipcode)
   {		 
			var cart_food = window.localStorage.getItem('cart_food');
			var cart_grocery = window.localStorage.getItem('cart_grocery');
            var cart_shef = window.localStorage.getItem('cart_shef');
			var shef_length=0;
			if(typeof(cart_shef) != "undefined" && cart_shef != null && cart_shef != ''){
				cart_shef = JSON.parse(cart_shef);
				shef_length = cart_shef.length;
			}	
             			
			//alert(old_zipcode+ ' >> ' +current_zipcode);
			$.ajax({
					url: "ajax-zipcode-stores.php",
					async: false,
          data: { cart_food: cart_food, cart_grocery: cart_grocery, old_zipcode: old_zipcode, current_zipcode:current_zipcode },
					type: "POST",
					success: function (data) {

						var sids = JSON.parse(data);
						var fsid = sids.food_sid;
						var gsid = sids.grocery_sid;
						
						if(fsid.length == 0 && gsid.length == 0 && shef_length==0)
						{		
							checkReturn = 0;
						}
						else if(fsid.length != 0 || gsid.length != 0 || shef_length != 0)
						{		
							checkReturn = 1;
						}																																				
					},
					error: function (jqXHR, exception) {
							var msg = '';
							if (jqXHR.status === 0) {
									msg = 'Not connect.\n Verify Network.';
							} else if (jqXHR.status == 404) {
									msg = 'Requested page not found. [404]';
							} else if (jqXHR.status == 500) {
									msg = 'Internal Server Error [500].';
							} else if (exception === 'parsererror') {
									msg = 'Requested JSON parse failed.';
							} else if (exception === 'timeout') {
									msg = 'Time out error.';
							} else if (exception === 'abort') {
									msg = 'Ajax request aborted.';
							} else {
									msg = 'Uncaught Error.\n' + jqXHR.responseText;
							}
					}
			});
	 }
	 
   
   //FUNCTION TO CHECK ZIPCODE STORES FROM OUT-SIDE
   function checkOutStores(old_zipcode, cur_zipcode)
   {		 
			chkStores = false;
			var cart_food = window.localStorage.getItem('cart_food');
			var cart_grocery = window.localStorage.getItem('cart_grocery');	
            var cart_shef = window.localStorage.getItem('cart_shef');
			var shefn_length=0;
			if(typeof(cart_shef) != "undefined" && cart_shef != null && cart_shef != ''){
				cart_shef = JSON.parse(cart_shef);
				shefn_length = cart_shef.length;
			}				
			
			//var old_zipcode = '<?php echo $_COOKIE['postalcode']; ?>';
			//var current_zipcode = '<?php echo $_COOKIE['pincode']; ?>';

			$.ajax({
					url: "ajax-zipcode-stores.php",
					async: false,
          data: { cart_food: cart_food, cart_grocery: cart_grocery, old_zipcode: old_zipcode, current_zipcode:cur_zipcode },
					type: "POST",
					success: function (data) {
						removenationwide(data, cur_zipcode);
						var sids = JSON.parse(data);
						var fsid = sids.food_sid;
						var gsid = sids.grocery_sid;
						
						if(fsid.length == 0 && gsid.length == 0 && shefn_length==0)
						{		
							chkStores = true;
							return;
						}
						else {
							chkStores = false;
							update_cart_store(data, cur_zipcode);																
							updateMiniCart();
							resetPhpCart();	
						}																																				
					},
					error: function (jqXHR, exception) {
							var msg = '';
							if (jqXHR.status === 0) {
									msg = 'Not connect.\n Verify Network.';
							} else if (jqXHR.status == 404) {
									msg = 'Requested page not found. [404]';
							} else if (jqXHR.status == 500) {
									msg = 'Internal Server Error [500].';
							} else if (exception === 'parsererror') {
									msg = 'Requested JSON parse failed.';
							} else if (exception === 'timeout') {
									msg = 'Time out error.';
							} else if (exception === 'abort') {
									msg = 'Ajax request aborted.';
							} else {
									msg = 'Uncaught Error.\n' + jqXHR.responseText;
							}
					}
			});
	 }
   
   function update_cart_store(data, cur_zipcode)
   {        localStorage.removeItem('cart_shef');
			var lstCartF = [];
			var lstCartG = [];
			var cart_food = window.localStorage.getItem('cart_food');
			var cart_grocery = window.localStorage.getItem('cart_grocery');
			if (cart_food != null && cart_food != '') {
				lstCartF = JSON.parse(cart_food);
			}
			if (cart_grocery != null && cart_grocery != '') {
				lstCartG = JSON.parse(cart_grocery);
			}
			
		 var sids = JSON.parse(data);
		 var fsid = sids.food_sid;
		 var gsid = sids.grocery_sid;
		 var chkStore = 0;

			if (lstCartF.length > 0) {
				for (var i = 0; i < lstCartF.length; i++) {
					if(fsid.indexOf(lstCartF[i].sid) > -1)
					{
						lstCartF.splice(i, 1);
						chkStore++;
					}
				}
			}											
			
			if (lstCartG.length > 0) {
				for (var i = 0; i < lstCartG.length; i++) {
					if(gsid.indexOf(lstCartG[i].sid) > -1)
					{
						lstCartG.splice(i, 1);
						chkStore++;
					}
				}
			}

			window.localStorage.setItem("cart_food", JSON.stringify(lstCartF));
			window.localStorage.setItem("cart_grocery", JSON.stringify(lstCartG));
			
			if(chkStore > 0){
				update_cart_store(data, cur_zipcode)
			}
			else{
				update_cart_grocery_item(cur_zipcode);
				return true;
			}			
	 }
	 function removenationwide(data, cur_zipcode)
	 {
	     console.log('ok');
	     
	     	var cart_food = window.localStorage.getItem('cart_food');
	     	var dd = JSON.parse(cart_food);
	     	var chkStore = 0;
	     	var b = 0;
	     	
	     	if(typeof(cart_food) != "undefined" && cart_food != null && cart_food != '')
	     	{
	     	for (var i = 0; i < dd.length; i++)
	     	{
	     	    b++;
	     	    //console.log(dd[i].section);
	     	    if(dd[i].section!='moments')
	     	    {
	     	        
	     	        dd.splice(i, 1);
						chkStore++;
				
	     	    }
	     	}
	     	console.log(dd);
	     		window.localStorage.setItem("cart_food", JSON.stringify(dd));
				if(chkStore > 0){
	     			update_cart_store(data, cur_zipcode);
	     			updateMiniCart();
					resetPhpCart();	
				}
				//console.log(dd.length);
	   // console.log(chkStore);
				}
	 }
	
	 function update_cart_grocery_item(cur_zipcode)
	 {
			var cart_grocery = window.localStorage.getItem('cart_grocery');
			if (cart_grocery != null && cart_grocery != '') {
				lstCartG = JSON.parse(cart_grocery);
			}
			
			if(lstCartG.length > 0)
			{
				$.ajax({
						url: "ajax-update-grocery-stores.php",
						async: false,
						data: { cart_grocery: cart_grocery, current_zipcode:cur_zipcode },
						type: "POST",
						success: function (data) {
							//alert(data)
							window.localStorage.setItem("cart_grocery", data);
							//alert(data);
							//return false;
						},
						error: function (jqXHR, exception) {
								var msg = '';
								if (jqXHR.status === 0) {
										msg = 'Not connect.\n Verify Network.';
								} else if (jqXHR.status == 404) {
										msg = 'Requested page not found. [404]';
								} else if (jqXHR.status == 500) {
										msg = 'Internal Server Error [500].';
								} else if (exception === 'parsererror') {
										msg = 'Requested JSON parse failed.';
								} else if (exception === 'timeout') {
										msg = 'Time out error.';
								} else if (exception === 'abort') {
										msg = 'Ajax request aborted.';
								} else {
										msg = 'Uncaught Error.\n' + jqXHR.responseText;
								}
						}
				});
			}
	 }
</script>
    <?php //} ?>
<!-- google address integration -->
<script>
// This example displays an address form, using the autocomplete feature
// of the Google Places API to help users fill in the information.

// This example requires the Places library. Include the libraries=places
// parameter when you first load the API. For example:
// <script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&libraries=places">

    var placeSearch, autocomplete;
    var componentForm = {
        street_number: 'short_name',
        route: 'long_name',
        locality: 'long_name',
        administrative_area_level_1: 'short_name',
        country: 'long_name',
        postal_code: 'short_name'
    };

    function initAutocomplete() {
// Create the autocomplete object, restricting the search to geographical
// location types.
        autocomplete = new google.maps.places.Autocomplete(
                /** @type {!HTMLInputElement} */(document.getElementById('autocomplete')),
                {types: ['geocode']});

        autocomplete2 = new google.maps.places.Autocomplete(
                /** @type {!HTMLInputElement} */(document.getElementById('autocomplete2')),
                {types: ['geocode']});

        autocomplete3 = new google.maps.places.Autocomplete(
                /** @type {!HTMLInputElement} */(document.getElementById('autocomplete3')),
                {types: ['geocode']});
        autocomplete4 = new google.maps.places.Autocomplete(
                /** @type {!HTMLInputElement} */(document.getElementById('autocomplete4')),
                {types: ['geocode']});       

// When the user selects an address from the dropdown, populate the address
// fields in the form.
        autocomplete.addListener('place_changed', function () {
            fillInAddress(autocomplete, "");
            isAddressSelected = true;
            $("#autocomplete").next().next().hide();
            $('#latitude').val(autocomplete.getPlace().geometry.location.lat());
            $('#longitude').val(autocomplete.getPlace().geometry.location.lng());
        });
        autocomplete2.addListener('place_changed', function () {
            fillInAddress(autocomplete2, "2");
            isAddressSelected = true;
            $("#autocomplete2").next().next().hide();
            $('#latitude2').val(autocomplete2.getPlace().geometry.location.lat());
            $('#longitude2').val(autocomplete2.getPlace().geometry.location.lng());
        });
        autocomplete3.addListener('place_changed', function () {      
            fillInAddress(autocomplete3, "3");
            isAddressSelected = true;
            $("#autocomplete3").next().next().hide();
            $('#latitude3').val(autocomplete3.getPlace().geometry.location.lat());
            $('#longitude3').val(autocomplete3.getPlace().geometry.location.lng());
        });
        autocomplete4.addListener('place_changed', function () {      
            fillInAddress(autocomplete4, "4");
            isAddressSelected = true;
            $("#autocomplete4").next().next().hide();
            $('#latitude4').val(autocomplete4.getPlace().geometry.location.lat());
            $('#longitude4').val(autocomplete4.getPlace().geometry.location.lng());
        });
    }


    function fillInAddress(autocomplete, unique) {
// Get the place details from the autocomplete object.
        var place = autocomplete.getPlace();

        for (var component in componentForm) {
            if (!!document.getElementById(component + unique)) {
                document.getElementById(component + unique).value = '';
                //document.getElementById(component + unique).disabled = false;
            }
        }

// Get each component of the address from the place details
// and fill the corresponding field on the form.
        for (var i = 0; i < place.address_components.length; i++) {
            var addressType = place.address_components[i].types[0];
             if (componentForm[addressType] && document.getElementById(addressType + unique)  || addressType=='route') {
                var val = place.address_components[i][componentForm[addressType]];
                 if(addressType=='route'){
                    document.getElementById('street_number' + unique).value = document.getElementById('street_number' + unique).value +" "+ val;
                } else {
                    document.getElementById(addressType + unique).value = val;
                }
            }
        }
    }

// Bias the autocomplete object to the user's geographical location,
// as supplied by the browser's 'navigator.geolocation' object.
    function geolocate() {
        if (navigator.geolocation) {
            navigator.geolocation.getCurrentPosition(function (position) {
                var geolocation = {
                    lat: position.coords.latitude,
                    lng: position.coords.longitude
                };
                var circle = new google.maps.Circle({
                    center: geolocation,
                    radius: position.coords.accuracy
                });
                autocomplete.setBounds(circle.getBounds());
            });
        }
    }

</script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyC7FCoN0eNTNGEsX6d-BUW-Uh1SiVzn2f0&libraries=places&callback=initAutocomplete"
async defer></script>

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).