Preview: store-edit.php
Size: 26.36 KB
/home/godevadmin/public_html/admin/store-edit.php
<?php
include("../include/config.php");
include("../include/functions.php");
include("../include/simpleimage.php");
validate_admin();
$cat_id=mysqli_real_escape_string($GLOBALS['conn'],$_POST['cat_id']);
$catAr=getCategoryArray($cat_id,$array='');
if(count($catAr)>0){
$categories=implode(",",$catAr);
}
$cat_id = mysqli_real_escape_string($GLOBALS['conn'],$_POST['cat_id']);
$storename = mysqli_real_escape_string($GLOBALS['conn'],$_POST['storename']);
$storeaddress = mysqli_real_escape_string($GLOBALS['conn'],$_POST['storeaddress']);
$state = mysqli_real_escape_string($GLOBALS['conn'],$_POST['state']);
$city = mysqli_real_escape_string($GLOBALS['conn'],$_POST['city']);
$zip = mysqli_real_escape_string($GLOBALS['conn'],$_POST['zip']);
$email = mysqli_real_escape_string($GLOBALS['conn'],$_POST['email']);
$phone = mysqli_real_escape_string($GLOBALS['conn'],$_POST['phone']);
$in_stock = mysqli_real_escape_string($GLOBALS['conn'],$_POST['in_stock']);
$del_fee = mysqli_real_escape_string($GLOBALS['conn'],$_POST['del_fee']);
$del_min = mysqli_real_escape_string($GLOBALS['conn'],$_POST['del_min']);
$hour = mysqli_real_escape_string($GLOBALS['conn'],$_POST['hour']);
$minute = mysqli_real_escape_string($GLOBALS['conn'],$_POST['minute']);
$monday = mysqli_real_escape_string($GLOBALS['conn'],$_POST['monday']);
$tuesday = mysqli_real_escape_string($GLOBALS['conn'],$_POST['tuesday']);
$wednesday = mysqli_real_escape_string($GLOBALS['conn'],$_POST['wednesday']);
$thursday = mysqli_real_escape_string($GLOBALS['conn'],$_POST['thursday']);
$friday = mysqli_real_escape_string($GLOBALS['conn'],$_POST['friday']);
$saturday = mysqli_real_escape_string($GLOBALS['conn'],$_POST['saturday']);
$sunday = mysqli_real_escape_string($GLOBALS['conn'],$_POST['sunday']);
$opentime1 = mysqli_real_escape_string($GLOBALS['conn'],$_POST['opentime1']);
$opentime2 = mysqli_real_escape_string($GLOBALS['conn'],$_POST['opentime2']);
$opentime3 =mysqli_real_escape_string($GLOBALS['conn'],$_POST['opentime3']);
$opentime4 = mysqli_real_escape_string($GLOBALS['conn'],$_POST['opentime4']);
$opentime5 = mysqli_real_escape_string($GLOBALS['conn'],$_POST['opentime5']);
$opentime6 = mysqli_real_escape_string($GLOBALS['conn'],$_POST['opentime6']);
$opentime7 = mysqli_real_escape_string($GLOBALS['conn'],$_POST['opentime7']);
$closetime1 = mysqli_real_escape_string($GLOBALS['conn'],$_POST['closetime1']);
$closetime2 = mysqli_real_escape_string($GLOBALS['conn'],$_POST['closetime2']);
$closetime3 = mysqli_real_escape_string($GLOBALS['conn'],$_POST['closetime3']);
$closetime4 = mysqli_real_escape_string($GLOBALS['conn'],$_POST['closetime4']);
$closetime5 = mysqli_real_escape_string($GLOBALS['conn'],$_POST['closetime5']);
$closetime6 = mysqli_real_escape_string($GLOBALS['conn'],$_POST['closetime6']);
$closetime7 = mysqli_real_escape_string($GLOBALS['conn'],$_POST['closetime7']);
$description= mysqli_real_escape_string($GLOBALS['conn'],$_POST['description']);
$area= mysqli_real_escape_string($GLOBALS['conn'],$_POST['area']);
$display_order=mysqli_real_escape_string($GLOBALS['conn'],$_POST['display_order']);
if($_POST['submit']=="Submit"){
if($_FILES['photo']['size']>0 && $_FILES['photo']['error']==''){
$product_img_name = buildURL($storename);
$Image= new SimpleImage();
$filename = $_FILES['photo']['name'];
$ext = pathinfo($filename, PATHINFO_EXTENSION);
$img=time()."-".$product_img_name.".".$ext;
move_uploaded_file($_FILES['photo']['tmp_name'],"../seller/upload_images/store/".$img);
copy("../seller/upload_images/store/".$img,"../seller/upload_images/store/thumb/".$img);
copy("../seller/upload_images/store/".$img,"../seller/upload_images/store/tiny/".$img);
$Image->load("../seller/upload_images/store/thumb/".$img);
$Image->resize(180,180);
$Image->save("../seller/upload_images/store/thumb/".$img);
$Image->load("../seller/upload_images/store/tiny/".$img);
$Image->resize(300,300);
$Image->save("../seller/upload_images/store/tiny/".$img);
}
$sqlstore= mysqli_query($GLOBALS['conn'],"Update stores SET catid='$cat_id', storename='$storename', photo='$img', storeaddress='$storeaddress', state='$state', city='$city', email='$email', phone='$phone', in_stock='$in_stock', fee='$del_fee', minimum='$del_min', hour='$hour', minute='$minute', description='$description', zip='$zip', area= '$area', display_order='$display_order' where storeid=".$_REQUEST['storeid']."");
$sqlwork1 = mysqli_query($GLOBALS['conn'],"update store_delivery SET monday='$monday', mono='$opentime1', monc='$closetime1', tuesday='$tuesday', tueo='$opentime2', tuec='$closetime2', wednesday='$wednesday', wedo='$opentime3', wedc='$closetime3', thursday='$thursday', thuo='$opentime4', thuc='$closetime4', friday='$friday', frio='$opentime5', fric='$closetime5', saturday='$saturday', sato='$opentime6', satc='$closetime6', sunday='$sunday', suno='$opentime7', sunc='$closetime7' where storeid=".$_REQUEST['storeid']."");
$_SESSION['sess_msg']='Store updated sucessfully';
$check=$obj->query("select sectionid from stores where storeid='".$_REQUEST['storeid']."'");
while($result=$obj->fetchNextObject($check))
{
$section=$result->sectionid;
if($section==1)
{
$section='grocery';
$parameter='grocery-store';
clearlaravelcache($section,$parameter);
}
}
header("location:storelist.php");
exit();
}
if($_REQUEST['storeid']!=''){
$sql=$obj->query("select * from stores where storeid=".$_REQUEST['storeid']."");
$result=$obj->fetchNextObject($sql);
$sqldelivery=$obj->query("select * from store_delivery where storeid=".$_REQUEST['storeid']."");
$resultdelivery=$obj->fetchNextObject($sqldelivery);
}
?>
<!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 type="text/javascript" language="javascript">
function validate(obj)
{
if(obj.cat_id.value==''){
alert("Please select category");
obj.cat_id.focus();
return false;
}
}
</script>
<script type="text/javascript" src="../include/ckeditor/ckeditor.js"></script>
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<?php include("header.php") ?>
<link rel="stylesheet" href="../seller/css/jquery-ui.css" />
<script src="../seller/js/jquery-ui.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#category').autocomplete({
search: function () {},
source: function (request, response)
{
$.ajax(
{
url:"getCategoryTree.php" ,
dataType: "json",
data:
{
q: request.term,
},
success: function (data)
{
response(data);
}
});
},
minLength: 2,
select: function( event, ui ) {
$( "#category" ).val( ui.item.value );
$( "#hdnId" ).val( ui.item.key );
var cat_id=$( "#hdnId" ).val();
//alert(cat_id);
$.ajax({
url:"getBrand.php",
data:{cat_id:cat_id},
beforeSend:function(){
$("#brand_id").html('<option value="">Select Brand</option>');
},
success:function(data){
$("#brand_id").append(data);
}
})
$.ajax({
url:"getAttribute.php",
data:{cat_id:cat_id,product_id:"<?php echo $_REQUEST['uid']; ?>"},
beforeSend:function(){
$("#features").html('');
},
success:function(data){
$("#features").html(data);
}
})
return false;
}
});
})
</script>
<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="../seller/simg/arrow2.gif" width="21" height="21" hspace="10" align="absmiddle" /></em>Admin: Edit Store
<span style="float:right; padding-right:10px;">
<input type="button" name="add" value="View Stores" class="button" onclick="location.href='storelist.php'" /></span></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['storeid'];?>" />
<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 align="right" class="paddBot11 paddRt14"><h2>Store Details</h2></td>
<td align="left" class="paddBot11" style="color:#F00">All fields are Mandatory</td>
</tr>
<!--
<tr>
<td align="right" class="paddBot11 paddRt14"><strong>Category :</strong></td>
<td align="left" class="paddBot11">
<select name="cat_id" style="width:250px;" id="cat_id">
<option value=""><?php if($result->catid=="4001") { echo "Grocery & Staples"; } else{ echo "Select Category"; } ?></option>
<?php
$catArr=$obj->query("select * from $tbl_maincategory where status=1 and uid like '%,$loged_userid,%' and parent_id=0 order by id ",$debug=-1);
while($resultCat=$obj->fetchNextObject($catArr)){
?>
<option value="<?php echo $resultCat->id; ?>"<?php if($resultCat->id==$result->cat_id){?>selected<?php } ?>><?php echo stripslashes($resultCat->maincategory); ?></option>
<?php } ?>
</select>
</td>
</tr>-->
<tr>
<td align="right" class="paddBot11 paddRt14"><strong>Store Name :</strong></td>
<td align="left" class="paddBot11">
<input type="text" name="storename" required="required" size="38" maxlength="500" value="<?php echo $result->storename; ?>" />
</td>
</tr>
<tr>
<td align="right" class="paddBot11 paddRt14"><strong>Logo<br/>
<div class="res_wrap">
(300 X 300px)(Not more than 100 KB):</strong></td>
<td align="left" class="paddBot11"><input name="photo" type="file" /><br/>
<?php if(is_file("../seller/upload_images/store/thumb/".$result->photo)) {?>
<img src="../seller/upload_images/store/thumb/<?php echo $result->photo; ?>" width="200" />
<?php } ?>
</td>
</tr>
<tr>
<td align="right" class="paddBot11 paddRt14"><strong>Address:</strong></td>
<td align="left" class="paddBot11"><textarea id="store_address" name="storeaddress" required="required" cols="28"><?php echo $result->storeaddress; ?></textarea></td>
</tr>
<tr>
<td align="right" class="paddBot11 paddRt14"><strong>State :</strong></td>
<td align="left" class="paddBot11">
<select name="state" style="width:250px;" id="state_id">
<option value=""><?php echo $result->state; ?></option>
<?php $stateArr=$obj->query("select * from sl_states order by state_name");
while($resultstate=$obj->fetchNextObject($stateArr)){
?>
<option value="<?php echo $resultstate->state_name; ?>"<?php if($resultstate->state_name==$result->state_name){?>selected<?php } ?>><?php echo stripslashes($resultstate->state_name); ?></option>
<?php } ?>
</select></td>
</tr>
<tr>
<td align="right" class="paddBot11 paddRt14"><strong>City :</strong></td>
<td align="left" class="paddBot11"><input name="city" required="required" type="text" size="38" value="<?php echo $result->city; ?>" /></td>
</tr>
<tr>
<td align="right" class="paddBot11 paddRt14"><strong>Email :</strong></td>
<td align="left" class="paddBot11"><input name="email" type="email" required="required" value="<?php echo $result->email; ?>" size="38" /></td>
</tr>
<tr>
<td align="right" class="paddBot11 paddRt14"><strong>Contact Number :</strong></td>
<td align="left" class="paddBot11"><input name="phone" type="tel" required="required" size="38" value="<?php echo $result->phone; ?>" /></td>
</tr>
<tr>
<td align="right" class="paddBot11 paddRt14"><strong>Active:</strong></td>
<td align="left" class="paddBot11">
<input type="checkbox" name="in_stock" value="1" checked="checked"/>
</td>
</tr>
<tr>
<td align="right" class="paddBot11 paddRt14"><strong>Delivery Fee:</strong></td>
<td align="left" class="paddBot11"><input name="del_fee" type="text" size="20" value="<?php echo $result->fee; ?>" required="required"/> <strong><?php echo $website_currency_code; ?></strong></td>
</tr>
<tr>
<td align="right" class="paddBot11 paddRt14"><strong>Minimum Delivery Amount:</strong></td>
<td align="left" class="paddBot11"><input name="del_min" type="text" size="20" value="<?php echo $result->minimum; ?>" required="required" /> <strong><?php echo $website_currency_code; ?></strong></td>
</tr>
<tr>
<td align="right" class="paddBot11 paddRt14"><strong>Delivery Time:</strong></td>
<td align="left" class="paddBot11"><input name="hour" type="number" size="2" maxlength="2" value="<?php echo $result->hour; ?>" required="required" /> <strong> Hour </strong> <input name="minute" type="number" size="2" value="<?php echo $result->minute; ?>" maxlength="2" required="required" /><strong> Minute </strong>
</td>
</tr>
<tr>
<td align="right" class="paddBot11 paddRt14"><strong>Working Days & Time:</strong></td>
<td align="left" class="paddBot11">
<input type="text" value="Monday" name="monday" required="required" /><strong style="margin-left:15px; font-size:15px"> Open</strong> <input name="check_for_address" id="check_file" type="checkbox" style="margin-top:5px">
<span style="display: none;" id="show_box">
<label for="opentime">Open Time:</label>
<input name="opentime1" size="20" value="<?php echo $resultdelivery->mono; ?>" class="input-text" type="text" maxlength="300" placeholder="9:00AM-5:00PM"> AM
<label for="closetime">Close Time:</label>
<input name="closetime1" size="20" value="<?php echo $resultdelivery->monc; ?>" class="input-text" type="text" maxlength="300" placeholder="9:00AM-5:00PM"> PM
</td>
</tr>
<tr>
<td align="right" class="paddBot11 paddRt14"></td>
<td align="left" class="paddBot11"> <input type="text" value="Tuesday" name="tuesday" required="required" /> <strong style="margin-left:15px; font-size:15px">Open</strong> <input name="check_for_address" id="check_file1" type="checkbox" style="margin-top:5px">
<span style="display: none;" id="show_box1">
<label for="opentime">Open Time:</label>
<input name="opentime2" size="20" value="<?php echo $resultdelivery->tueo; ?>" class="input-text" type="text" maxlength="300" placeholder="9:00AM-5:00PM"> AM
<label for="closetime">Close Time:</label>
<input name="closetime2" size="20" value="<?php echo $resultdelivery->tuec; ?>" class="input-text" type="text" maxlength="300" placeholder="9:00AM-5:00PM"> PM
</td>
</tr>
<tr>
<td align="right" class="paddBot11 paddRt14"></td>
<td align="left" class="paddBot11"> <input type="text" value="Wednesday" name="wednesday" required="required" /> <strong style="margin-left:15px; font-size:15px">Open</strong> <input name="check_for_address" id="check_file2" type="checkbox" style="margin-top:5px">
<span style="display: none;" id="show_box2">
<label for="opentime">Open Time:</label>
<input name="opentime3" size="20" value="<?php echo $resultdelivery->wedo; ?>" class="input-text" type="text" maxlength="300" placeholder="9:00AM-5:00PM"> AM
<label for="closetime">Close Time:</label>
<input name="closetime3" size="20" value="<?php echo $resultdelivery->wedc; ?>" class="input-text" type="text" maxlength="300" placeholder="9:00AM-5:00PM"> PM
</td>
</tr>
<tr>
<td align="right" class="paddBot11 paddRt14"></td>
<td align="left" class="paddBot11"> <input type="text" value="Thursday" name="thursday" required="required" /> <strong style="margin-left:15px; font-size:15px">Open</strong> <input name="check_for_address" id="check_file3" type="checkbox" style="margin-top:5px">
<span style="display: none;" id="show_box3">
<label for="opentime">Open Time:</label>
<input name="opentime4" size="20" value="<?php echo $resultdelivery->thuo; ?>" class="input-text" type="text" maxlength="300" placeholder="9:00AM-5:00PM"> AM
<label for="closetime">Close Time:</label>
<input name="closetime4" size="20" value="<?php echo $resultdelivery->thuc; ?>" class="input-text" type="text" maxlength="300" placeholder="9:00AM-5:00PM"> PM
</td>
</tr>
<tr>
<td align="right" class="paddBot11 paddRt14"></td>
<td align="left" class="paddBot11"> <input type="text" value="Friday" name="friday" required="required" /> <strong style="margin-left:15px; font-size:15px">Open</strong> <input name="check_for_address" id="check_file4" type="checkbox" style="margin-top:5px">
<span style="display: none;" id="show_box4">
<label for="opentime">Open Time:</label>
<input name="opentime5" size="20" value="<?php echo $resultdelivery->frio; ?>" class="input-text" type="text" maxlength="300" placeholder="9:00AM-5:00PM"> AM
<label for="closetime">Close Time:</label>
<input name="closetime5" size="20" value="<?php echo $resultdelivery->fric; ?>" class="input-text" type="text" maxlength="300" placeholder="9:00AM-5:00PM"> PM
</td>
</tr>
<tr>
<td align="right" class="paddBot11 paddRt14"></td>
<td align="left" class="paddBot11"> <input type="text" value="Saturday" name="saturday" required="required" /><strong style="margin-left:15px; font-size:15px"> Open</strong> <input name="check_for_address" id="check_file5" type="checkbox" style="margin-top:5px">
<span style="display: none;" id="show_box5">
<label for="opentime">Open Time:</label>
<input name="opentime6" size="20" value="<?php echo $resultdelivery->sato; ?>" class="input-text" type="text" maxlength="300" placeholder="9:00AM-5:00PM"> AM
<label for="closetime">Close Time:</label>
<input name="closetime6" size="20" value="<?php echo $resultdelivery->satc; ?>" class="input-text" type="text" maxlength="300" placeholder="9:00AM-5:00PM"> PM
</td>
</tr>
<tr>
<td align="right" class="paddBot11 paddRt14"></td>
<td align="left" class="paddBot11"> <input type="text" value="Sunday" name="sunday" required="required" /><strong style="margin-left:15px; font-size:15px"> Open</strong> <input name="check_for_address" id="check_file6" type="checkbox" style="margin-top:5px">
<span style="display: none;" id="show_box6">
<label for="opentime">Open Time:</label>
<input name="opentime7" size="20" value="<?php echo $resultdelivery->suno; ?>" class="input-text" type="text" maxlength="300" placeholder="9:00AM-5:00PM"> AM
<label for="closetime">Close Time:</label>
<input name="closetime7" size="20" value="<?php echo $resultdelivery->sunc; ?>" class="input-text" type="text" maxlength="300" placeholder="9:00AM-5:00PM"> PM
</td>
</tr>
<tr>
<td align="right" class="paddBot11 paddRt14"><strong> Zip Code:</strong></td>
<td align="left" class="paddBot11"><textarea name="zip" id="zip" required="required" rows="10" cols="80"><?php echo stripslashes($result->zip); ?></textarea></td>
</tr>
<tr>
<td align="right" class="paddBot11 paddRt14"><strong> Area Name:</strong></td>
<td align="left" class="paddBot11"><textarea name="area" id="area" required="required" rows="10" cols="80"><?php echo stripslashes($result->area); ?></textarea></td>
</tr>
<tr>
<td align="right" class="paddBot11 paddRt14"><strong> Details:</strong></td>
<td align="left" class="paddBot11"><textarea name="description" id="description" required="required" rows="5" cols="40"><?php echo stripslashes($result->description); ?></textarea></td>
</tr>
<tr>
<td align="right" class="paddBot11 paddRt14"><strong> Display Order:</strong></td>
<td align="left" class="paddBot11"><input type="number" name="display_order" value="<?php echo stripslashes($result->display_order); ?>"></td>
</tr>
<tr>
<td width="25%" align="right" class="paddRt14 paddBot11"> </td>
<td width="75%" align="left" class="paddBot11">
<input type="submit" name="submit" value="Submit" class="submit" border="0"/>
</tr>
</table></form>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<?php include('footer.php'); ?>
<script type="text/javascript">
$(document).ready(function() {
$('#show_box').hide();
$("#check_file").click(function() {
$('#show_box').toggle();
})
$(".text_show").hover(function() {
$('.text_hid').toggle();
})
$("#text_show").hover(function() {
$('#text_hid').toggle();
})
});
$(document).ready(function() {
$('#show_box1').hide();
$("#check_file1").click(function() {
$('#show_box1').toggle();
})
});
$(document).ready(function() {
$('#show_box2').hide();
$("#check_file2").click(function() {
$('#show_box2').toggle();
})
});
$(document).ready(function() {
$('#show_box3').hide();
$("#check_file3").click(function() {
$('#show_box3').toggle();
})
});
$(document).ready(function() {
$('#show_box4').hide();
$("#check_file4").click(function() {
$('#show_box4').toggle();
})
});
$(document).ready(function() {
$('#show_box5').hide();
$("#check_file5").click(function() {
$('#show_box5').toggle();
})
});
$(document).ready(function() {
$('#show_box6').hide();
$("#check_file6").click(function() {
$('#show_box6').toggle();
})
});
</script>
</table>
</body>
</html>
Directory Contents
Dirs: 10 × Files: 414