<?php

session_start();

include("../include/config.php");

include("../include/functions.php"); 

 validate_admin();



  

 

  if($_REQUEST['submitForm']=='yes'){
	$shippingamount=mysqli_real_escape_string($GLOBALS['conn'],$_POST['shippingamount']);
	$expressdeliveryamount=mysqli_real_escape_string($GLOBALS['conn'],$_POST['expressdeliveryamount']);
	$pkgcharge=mysqli_real_escape_string($GLOBALS['conn'],$_POST['pkgcharge']);
	$minorderamount=mysqli_real_escape_string($GLOBALS['conn'],$_POST['minorderamount']);
	$landline=mysqli_real_escape_string($GLOBALS['conn'],$_POST['landline']);
	$mobile=mysqli_real_escape_string($GLOBALS['conn'],$_POST['mobile']);
	$show_slot=mysqli_real_escape_string($GLOBALS['conn'],$_POST['show_slot']);
	$address=mysqli_real_escape_string($GLOBALS['conn'],$_POST['address']);
	$service_fee_type=mysqli_real_escape_string($GLOBALS['conn'],$_POST['service_fee_type']);
	$service_fee=mysqli_real_escape_string($GLOBALS['conn'],$_POST['service_fee']);
	$conveniencefeetype=mysqli_real_escape_string($GLOBALS['conn'],$_POST['conveniencefeetype']);
	$conveniencefee=mysqli_real_escape_string($GLOBALS['conn'],$_POST['conveniencefee']);
  
  	// Prod suggest titles
	$title_you_may_like=mysqli_real_escape_string($GLOBALS['conn'],$_POST['title_you_may_like']);
	$title_zip_prods=mysqli_real_escape_string($GLOBALS['conn'],$_POST['title_zip_prods']);
	$title_deals=mysqli_real_escape_string($GLOBALS['conn'],$_POST['title_deals']);
	$title_limited_prods=mysqli_real_escape_string($GLOBALS['conn'],$_POST['title_limited_prods']);
	$title_food_prods=mysqli_real_escape_string($GLOBALS['conn'],$_POST['title_food_prods']);
	

	  $obj->query("update $tbl_setting set shippingamount='".$shippingamount."' ,expressdeliveryamount='$expressdeliveryamount',
	  					pkgcharge='$pkgcharge',minorderamount='$minorderamount',address='$address',
						mobile='$mobile',landline='$landline',show_slot='$show_slot',
						service_fee_type='$service_fee_type',service_fee='$service_fee',conveniencefeetype='$conveniencefeetype',conveniencefee='$conveniencefee', 
						title_you_may_like='$title_you_may_like',title_zip_prods='$title_zip_prods',title_deals='$title_deals',
						title_limited_prods='$title_limited_prods',title_food_prods='$title_food_prods'
						where id=1");

	  $_SESSION['sess_msg']='Setting updated successfully';   
  }      

	   



$sql=$obj->query("select * from $tbl_setting where id=1");

$result=$obj->fetchNextObject($sql);



	

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo SITE_TITLE; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/admin.css" rel="stylesheet" type="text/css" />
<script src="../js/jquery-1.5.1.min.js"></script>
<script type="text/javascript" language="javascript">
function validate(obj)
{
if(obj.title.value==''){
alert("Please enter title");
obj.title.focus();
return false;
}


}
</script>
<script type="text/javascript" src="../include/ckeditor/ckeditor.js"></script>
</head>
<body>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">

<?php include("header.php") ?>

<tr>

	<td align="right" class="paddRtLt70" valign="top">

		<table width="99%" border="0" cellspacing="0" cellpadding="0">

			<tr>

				

				<td align="right" valign="top">

					<table width="100%" border="0" cellspacing="0" cellpadding="0">

						<tr>

							<td align="left" valign="middle" class="headingbg bodr text14">

					<em><img src="images/arrow2.gif" width="21" height="21" hspace="10" align="absmiddle" /></em>Admin: Update Setting </td>

						</tr>

						

						<tr>

							<td height="100" align="left" valign="top" bgcolor="#f3f4f6" class="bodr">

                            

                            <form name="frm" method="POST" enctype="multipart/form-data" action="" onsubmit="return validate(this)">

						<input type="hidden" name="submitForm" value="yes" />

						<input type="hidden" name="id" value="<?php echo $_REQUEST['id'];?>" />

							<table width="100%" cellpadding="0" cellspacing="0">

									<tr>

										<td align="center" colspan="2" class="paddRt14 paddBot11">

										<font color="#FF0000"><strong><?php echo $_SESSION['sess_msg']; $_SESSION['sess_msg']='';?></strong></font></td>

									</tr>

									<tr>

										<td width="18%" align="right" class="paddBot11 paddRt14">&nbsp;</td>

										<td width="82%" align="left" class="paddBot11"></td>

									</tr>

									

									<tr>

                                      <td align="right" class="paddBot11 paddRt14"><strong>Express Delivery Amount:</strong></td>

									  <td align="left" class="paddBot11"><input name="expressdeliveryamount" type="text" id="expressdeliveryamount" size="36" value="<?php echo stripslashes($result->expressdeliveryamount);?>" /> <?php echo $website_currency_code; ?></td>

							        </tr>
                                    
                                    <tr>

                                      <td align="right" class="paddBot11 paddRt14"><strong>Shipping Amount:</strong></td>

									  <td align="left" class="paddBot11"><input name="shippingamount" type="text" id="shippingamount" size="36" value="<?php echo stripslashes($result->shippingamount);?>" /> <?php echo $website_currency_code; ?></td>

							        </tr>
                                    

										<tr>

                                      <td align="right" class="paddBot11 paddRt14"><strong>Minium Order Amount for free shipping:</strong></td>

									  <td align="left" class="paddBot11"><input name="minorderamount" type="text" id="minorderamount" size="36" value="<?php echo stripslashes($result->minorderamount);?>" /> <?php echo $website_currency_code; ?></td>

							        </tr>
									<tr>

                                      <td align="right" class="paddBot11 paddRt14"><strong>Packaging/Handling Charge:</strong></td>

									  <td align="left" class="paddBot11"><input name="pkgcharge" type="text" id="pkgcharge" size="36" value="<?php echo stripslashes($result->pkgcharge);?>" /> <?php echo $website_currency_code; ?></td>

							        </tr>
							        <tr>

                                      <td align="right" class="paddBot11 paddRt14"><strong>Service Fee Type:</strong></td>

									  <td align="left" class="paddBot11"><select name="service_fee_type" id="service_fee_type" />
									  <option value="percent" <?php if($result->service_fee_type=='percent'){ ?> selected<?php } ?>>Percent</option>
									  <option value="fixed" <?php if($result->service_fee_type=='fixed'){ ?> selected<?php } ?>>Fixed</option>
									  </select>
									  </td>

							        </tr>
							        <tr>

                                      <td align="right" class="paddBot11 paddRt14"><strong>Service Fee Amount:</strong></td>

									  <td align="left" class="paddBot11"><input name="service_fee" type="text" id="service_fee" size="36" value="<?php echo stripslashes($result->service_fee);?>" /> <?php echo $website_currency_code; ?></td>

							        </tr>
									<tr>
                                      <td align="right" class="paddBot11 paddRt14"><strong>Convenience Fee Type:</strong></td>
									  <td align="left" class="paddBot11"><select name="conveniencefeetype" id="service_fee_type" />
									  <option value="percent" <?php if($result->conveniencefeetype=='percent'){ ?> selected<?php } ?>>Percent</option>
									  
									  </select>
									  </td>
							        </tr>
							        <tr>
                                      <td align="right" class="paddBot11 paddRt14"><strong>Convenience Fee Amount:</strong></td>
									  <td align="left" class="paddBot11"><input name="conveniencefee" type="text" id="conveniencefee" size="36" value="<?php echo stripslashes($result->conveniencefee);?>" /> <?php echo $website_currency_code; ?></td>
							        </tr>

                                    <tr>

                                      <td align="right" class="paddBot11 paddRt14"><strong>Mobile:</strong></td>

									  <td align="left" class="paddBot11"><input name="mobile" type="text" id="mobile" size="36" value="<?php echo stripslashes($result->mobile);?>" /></td>

							        </tr>					

					              <tr>

                                      <td align="right" class="paddBot11 paddRt14"><strong>Phone:</strong></td>

									  <td align="left" class="paddBot11"><input name="landline" type="text" id="landline" size="36" value="<?php echo stripslashes($result->landline);?>" /></td>

							        </tr>

                                     <tr>

                                      <td align="right" class="paddBot11 paddRt14"><strong>Show Delivery Slot on Front:</strong></td>

									  <td align="left" class="paddBot11"><input type="checkbox" name="show_slot" value="1" <?php if($result->show_slot==1) {?>checked<?php }?> /> </td>

							        </tr>	
                                     <tr>

                                      <td align="right" class="paddBot11 paddRt14"><strong>Store Address</strong></td>

									  <td align="left" class="paddBot11">
                                      <textarea name="address" rows="20" cols="80" class="ckeditor" id="address"><?php echo stripslashes($result->address);?></textarea>
                                      </td>

							        </tr>	
									<tr>
                                      <td align="right" class="paddBot11 paddRt14"><strong>Title - You May Like Products:</strong></td>
									  <td align="left" class="paddBot11"><input name="title_you_may_like" type="text" id="title_you_may_like" size="50" maxlength="100" value="<?php echo stripslashes($result->title_you_may_like);?>" /></td>
							        </tr>
									<tr>
                                      <td align="right" class="paddBot11 paddRt14"><strong>Title - Popular In Your Area Products:</strong></td>
									  <td align="left" class="paddBot11"><input name="title_zip_prods" type="text" id="title_zip_prods" size="50" maxlength="100" value="<?php echo stripslashes($result->title_zip_prods);?>" /></td>
							        </tr>
									<tr>
                                      <td align="right" class="paddBot11 paddRt14"><strong>Title - Products Deals:</strong></td>
									  <td align="left" class="paddBot11"><input name="title_deals" type="text" id="title_deals" size="50" maxlength="100" value="<?php echo stripslashes($result->title_deals);?>" /></td>
							        </tr>
									<tr>
                                      <td align="right" class="paddBot11 paddRt14"><strong>Title - Limited Time Products:</strong></td>
									  <td align="left" class="paddBot11"><input name="title_limited_prods" type="text" id="title_limited_prods" size="50" maxlength="100" value="<?php echo stripslashes($result->title_limited_prods);?>" /></td>
							        </tr>
									<tr>
                                      <td align="right" class="paddBot11 paddRt14"><strong>Title - Food Suggestions Products:</strong></td>
									  <td align="left" class="paddBot11"><input name="title_food_prods" type="text" id="title_food_prods" size="50" maxlength="100" value="<?php echo stripslashes($result->title_food_prods);?>" /></td>
							        </tr>	

									<tr>

									  <td align="right" class="paddRt14 paddBot11">&nbsp;</td>

									  <td align="left" class="paddBot11">&nbsp;</td>

							  </tr>

									<tr>

										<td width="18%" align="right" class="paddRt14 paddBot11">&nbsp;</td>

										<td width="82%" align="left" class="paddBot11">

											<input type="submit" name="submit" value="Update"  class="submit" border="0"/> 	                  		 &nbsp;&nbsp;</td>

									</tr>

								</table></form>

							</td>

						</tr>

						

					</table>

				</td>

			</tr>

		</table>

	</td>

</tr>

<?php include('footer.php'); ?>

</table>

</body>

</html>





