]]jkjjgdjffksdkdxdsghfghdfghfgdfsdsdfsdfsfdsbcxvxcbccwewqeqwewqskfgj
במ12[cxvbcxvbxcvbcxvcxvbcvxcvbsdfsdfsdfsdfsdfsdfxcvbxcvxbbxqwqewqewv;'
/
home
/
u506006416
/
domains
/
crystalmiracle.co.in
/
public_html
/
admin
/
Upload FileeE
HOME
<?php include("header.php"); $ins_obj= new config(); ?> <?php include("sidebar.php");?> <?php @$postaction=$_GET['edit']; if($postaction=='1') { $url = BASE_URL."product_details.php?p_id=$insert_id&&cat_id=$cat_id"; $condition1="`p_id`=".$_GET['post_id']; $query=$ins_obj->display_rcd('product',$condition1); if(is_array($query) || !empty($query)) { foreach($query as $olddata) { } } // print_r($olddata); // print_r(json_decode($olddata['offers'], true)); // die(); $offers_data = json_decode($olddata['offers'], true); // print_r($offers_data); die(); // -----------------type 1 category fetch ----------------- $type_1_condi="`p_id`=".$_GET['post_id']; $type1_query=$ins_obj->display_rcd('multiple_category',$type_1_condi); if(is_array($type1_query) || !empty($type1_query)) { foreach($type1_query as $type1update) { $type1_array[]=$type1update['cat_id']; } } // -----------------type 2 category fetch ----------------- $type_2_condi="`p_id`=".$_GET['post_id']; $type2_query=$ins_obj->display_rcd('multiple_category',$type_2_condi); if(is_array($type2_query) || !empty($type2_query)) { foreach($type2_query as $type2update) { $type2_array[]=$type2update['b_id']; } } } ?> <?php if($_SERVER['REQUEST_METHOD']=='POST') { /*--------- Offer Array ----------------*/ $offer_array = []; $on = count($_POST['offer_title']); for ($i=0; $i < $on; $i++) { if($_POST['offer_title'][$i]!=''){ /*---------- Offer Images --------*/ if($_FILES["offer_image"]["name"][$i]!='') { $file_type = $_FILES['offer_image']['type'][$i]; $temp=explode('.',$_FILES['offer_image']['name'][$i]); $file_ext=end($temp); $expensions= array("jpeg","jpg","png"); if(in_array($file_ext,$expensions)=== false) { echo "<script>alert('extension not allowed, please choose a JPEG or PNG file.'); window.location = ".$url."; exit();</script>"; } else { $filename = uniqid() . "-" . time(); $extension = pathinfo( $_FILES["offer_image"]["name"][$i], PATHINFO_EXTENSION ); $offer_img_name = $filename . "." . $extension; $source = $_FILES["offer_image"]["tmp_name"][$i]; $destination = "img/offer_image/".$offer_img_name; move_uploaded_file($source, $destination); @unlink("img/offer_image/".$_POST['offer_image_old'][$i]); } } else { if ($_POST['remove_image'][$i]==1) { @unlink("img/offer_image/".$_POST['offer_image_old'][$i]); $offer_img_name = ""; }else{ $offer_img_name=$ins_obj->validation($_POST['offer_image_old'][$i]); } } /*-------------------------------------*/ $offer_array[] = array( 'offer_title' => $_POST['offer_title'][$i], 'offer_qty' => $_POST['offer_qty'][$i], 'offer_discount_type' => $_POST['offer_discount_type'][$i], 'offer_discount' => $_POST['offer_discount'][$i], 'offer_discription' => $ins_obj->validation($_POST['offer_discription'][$i]), 'free_delivery' => $_POST['free_delivery'][$i], 'free_packaging' => $_POST['free_packaging'][$i], 'product_name' => $_POST['product_name'][$i], 'offer_image' => $offer_img_name ); } } // print_r($offer_array); // echo "<br>"; // echo json_encode($offer_array); // die(); /*-------- SOrting Array ---------*/ function array_sort_by_column(&$arr, $col, $dir = SORT_ASC) { $sort_col = array(); foreach ($arr as $key => $row) { $sort_col[$key] = $row[$col]; } array_multisort($sort_col, $dir, $arr); } array_sort_by_column($offer_array, 'offer_qty'); /*--------------------------------*/ if (!empty($offer_array)) { $offers = json_encode($offer_array, JSON_UNESCAPED_UNICODE); }else{ $offers = NULL; } // echo $offers ; die(); /*-----------------------------------*/ if($_FILES["cateimg"]["name"]!='') { $file_type = $_FILES['cateimg']['type']; $temp=explode('.',$_FILES['cateimg']['name']); $file_ext=end($temp); $expensions= array("jpeg","jpg","png"); if(in_array($file_ext,$expensions)=== false) { ?> <script type='text/javascript'>alert('extension not allowed, please choose a JPEG or PNG file.');</script> <script type='text/javascript'>window.location.href="product.php";</script> <?php return; ?> <?php } else { $filename = uniqid() . "-" . time(); $extension = pathinfo( $_FILES["cateimg"]["name"], PATHINFO_EXTENSION ); $basename = $filename . "." . $extension; $source = $_FILES["cateimg"]["tmp_name"]; $destination = "upload/".$basename; move_uploaded_file($source, $destination); } } else { $basename=$ins_obj->validation($_POST['old_img']); } /*---------Check Price Drop ------------*/ if ($_POST['old_d_price']>$_POST['d_price']) { $price_drop_date = date("Y-m-d h:i:s"); }else{ $price_drop_date = NULL; } /*----------- Calculate Dimensions ----*/ if ($_POST['size_unit']=='millimeter') { $length_cm = $_POST['length']/10; $breadth_cm = $_POST['breadth']/10; $height_cm = $_POST['height']/10; }if ($_POST['size_unit']=='meter') { $length_cm = $_POST['length']*100; $breadth_cm = $_POST['breadth']*100; $height_cm = $_POST['height']*100; }if ($_POST['size_unit']=='inch') { $length_cm = $_POST['length']*2.54; $breadth_cm = $_POST['breadth']*2.54; $height_cm = $_POST['height']*2.54; }if ($_POST['size_unit']=='centimeter') { $length_cm = $_POST['length']; $breadth_cm = $_POST['breadth']; $height_cm = $_POST['height']; } /*-------------------------------------*/ $insertdata = array( 'p_name' => $ins_obj->validation($_POST['p_name']), 'p_code' => $ins_obj->validation($_POST['p_code']), 'p_img' => $ins_obj->validation($basename), 'short_desc' => $ins_obj->validation($_POST['short_desc']), 'd_estimate_time' => $ins_obj->validation($_POST['d_estimate_time']), 'stock_left' => $ins_obj->validation($_POST['stock_left']), 'meta_title' => $ins_obj->validation($_POST['meta_title']), 'meta_desc' => $ins_obj->validation($_POST['meta_desc']), 'meta_keyword' => $ins_obj->validation($_POST['meta_keyword']), 'price' => $ins_obj->validation($_POST['price']), 'd_price' => $ins_obj->validation($_POST['d_price']), 'quan_available' => $ins_obj->validation($_POST['quan_available']), 'gst' => $ins_obj->validation($_POST['gst']), 'weight' => $ins_obj->validation($_POST['weight']), 'b_sellar' => $ins_obj->validation($_POST['b_sellar']), 'p_desc' => $ins_obj->validation($_POST['p_desc']), 'delivery' => $ins_obj->validation($_POST['delivery']), 'add_information' => $ins_obj->validation($_POST['add_information']), 'short_order' => $ins_obj->validation($_POST['short_order']), 'status' => $ins_obj->validation($_POST['status']), 'shipping_price' => $ins_obj->validation($_POST['shipping_price']), 'packaging_price' => $ins_obj->validation($_POST['packaging_price']), 'updated_at' => date("Y-m-d h:i:s"), 'price_drop_date' => $price_drop_date, 'admin_recommendation' => $ins_obj->validation($_POST['admin_recommendation']), 'admin_star' => $ins_obj->validation($_POST['admin_star']), 'max_qty_per_user' => $ins_obj->validation($_POST['max_qty_per_user']), 'hsn_code' => $ins_obj->validation($_POST['hsn_code']), 'length' => $ins_obj->validation($_POST['length']), 'breadth' => $ins_obj->validation($_POST['breadth']), 'height' => $ins_obj->validation($_POST['height']), 'size_unit' => $ins_obj->validation($_POST['size_unit']), 'offers' => $offers, 'length_cm' => $length_cm, 'breadth_cm' => $breadth_cm, 'height_cm' => $height_cm ); if(isset($_POST['submit'])) { $action=$_GET['action']; if($action!= "1") { $data= $ins_obj->insert("product", $insertdata); $insert_id = $ins_obj->last_id($ins_obj->con); if($data=='TRUE') { $condition1=" status=1 ORDER BY `p_id` DESC LIMIT 1"; $querym=$ins_obj->display_rcd('product',$condition1); if($querym) foreach($querym as $datam) { } // $array[]=$_POST['p_cat']; // $arraybrand[]=$_POST['b_id']; // $catnumber=count($array); // for($i = 0; $i < $catnumber; $i++) // { foreach($_POST['p_cat'] as $value) { foreach($_POST['b_id_'.$value] as $valuebrand) { $post_key = "type_".$value; $multidata = array( 'p_id' => $ins_obj->validation($datam['p_id']), 'cat_id' => $ins_obj->validation($value), 'b_id' => $ins_obj->validation($valuebrand), 'type' => $_POST[$post_key], ); $data1= $ins_obj->insert("multiple_category", $multidata); } } // } // ==================multi img=========================== for($im = 0; $im < $cou=count($_FILES['m_img']['name']); $im++) { $filetmp = $_FILES["m_img"]["tmp_name"][$im]; $filename = $_FILES["m_img"]["name"][$im]; $filetype = $_FILES["m_img"]["type"][$im]; $filepath = "upload/".$filename; move_uploaded_file($filetmp,$filepath); $multiimg = array( 'p_id' => $ins_obj->validation($datam['p_id']), 'img' => $ins_obj->validation($filename), ); $mimgdata= $ins_obj->insert("multi_p_img", $multiimg); } //===================multi img ends===================== /*------------ Send Push Notification -----------*/ $contentData = $_POST['p_name']; $cat_id = $_POST['p_cat'][0]; $image = $destination; $url = BASE_URL."product_details.php?p_id=$insert_id&&cat_id=$cat_id"; $sendPush = $ins_obj->send_push_notification($contentData,$url,$image); /*-----------------------------------------------*/ // echo $url; die(); ?> <script type='text/javascript'>alert ('Add sucessfully') var timer = setTimeout(function() { window.location.href="all_product.php" } ); </script> <?php } else { echo "error".mysqli_error($this->con); } // =============================update========================== } else { $where_condition=array( 'p_id'=> $postaction ); $update_query=$ins_obj->update("product",$insertdata,$where_condition); if($update_query=='TRUE') { // ================multi category=============== $catdelete=$ins_obj->delete('multiple_category',$where_condition); if($catdelete==true) { // $array[]=$_POST['p_cat']; // $arraybrand[]=$_POST['b_id']; // $catnumber=count($array); // for($i = 0; $i < $catnumber; $i++) // { foreach($_POST['p_cat'] as $value) { foreach($_POST['b_id_'.$value] as $valuebrand) { $post_key = "type_".$value; $multidata = array( 'p_id' => $ins_obj->validation($postaction), 'cat_id' => $ins_obj->validation($value), 'b_id' => $ins_obj->validation($valuebrand), 'type' => $_POST[$post_key], ); $data1= $ins_obj->insert("multiple_category", $multidata); } } // } } // ================multi img=============== if($_FILES['m_img']['name']!='') { for($im = 0; $im < $cou=count($_FILES['m_img']['name']); $im++) { $filetmp = $_FILES["m_img"]["tmp_name"][$im]; $filename = $_FILES["m_img"]["name"][$im]; $filetype = $_FILES["m_img"]["type"][$im]; $filepath = "upload/".$filename; move_uploaded_file($filetmp,$filepath); $multiimg = array( 'p_id' => $ins_obj->validation($postaction), 'img' => $ins_obj->validation($filename), ); $mimgdata= $ins_obj->insert("multi_p_img", $multiimg); } } else { $old_m_img[]=$_POST['old_multi_img']; $oldm_imgcount=count($old_m_img); for($omi=0; $omi <= $oldm_imgcount; $omi++) { foreach($old_m_img=$_POST['old_multi_img'] as $multioldvales) { $multi_old_img = array( 'p_id' => $ins_obj->validation($postaction), 'img' => $ins_obj->validation($multioldvales),); $multiimg_query=$ins_obj->update("multi_p_img",$multi_old_img,$where_condition); } } } // ============================update color ends================= // } ?> <script type='text/javascript'>alert ('update sucessfully') var timer = setTimeout(function() { // window.location.href="all_product.php" window.location.href="product.php?edit=1&&post_id=<?php echo $_GET['post_id']; ?>"; } ); </script> <?php } else { echo "error".mysqli_error($this->con); } } } } ?> <!-- Content Wrapper. Contains page content --> <div class="content-wrapper"> <!-- Content Header (Page header) --> <div class="content-header"> <div class="container-fluid"> <div class="row mb-2"> <div class="col-sm-6"> <h1 class="m-0 text-dark">Dashboard</h1> </div> <!-- /.col --> <div class="col-sm-6"> <ol class="breadcrumb float-sm-right"> <li class="breadcrumb-item"><a href="all_product.php">Product List</a></li> <!-- <li class="breadcrumb-item active">Dashboard</li> --> </ol> </div> <!-- /.col --> </div> <!-- /.row --> </div> <!-- /.container-fluid --> </div> <!-- /.content-header --> <!-- Main content --> <section class="content"> <div class="container-fluid"> <!-- Small boxes (Stat box) --> <!-- /.row --> <!-- Main row --> <div class="row"> <div class="col-md-12"> <div class="card card-primary card-tabs"> <div class="card-header p-0 pt-1"> <ul class="nav nav-tabs" id="custom-tabs-five-tab" role="tablist"> <li class="nav-item"> <a class="nav-link active" id="custom-tabs-five-normal-tab" data-toggle="pill" href="#general" role="tab" aria-controls="custom-tabs-five-normal" aria-selected="false">General</a> </li> <li class="nav-item"> <a class="nav-link" id="custom-tabs-five-normal-tab" data-toggle="pill" href="#data" role="tab" aria-controls="custom-tabs-five-normal" aria-selected="false">Data</a> </li> <li class="nav-item"> <a class="nav-link" id="custom-tabs-five-normal-tab" data-toggle="pill" href="#extrainformation" role="tab" aria-controls="custom-tabs-five-normal" aria-selected="false">Extra Information</a> </li> <li class="nav-item"> <a class="nav-link" id="custom-tabs-five-normal-tab" data-toggle="pill" href="#eximage" role="tab" aria-controls="custom-tabs-five-normal" aria-selected="false">Extra image</a> </li> <li class="nav-item"> <a class="nav-link" id="custom-tabs-five-normal-tab" data-toggle="pill" href="#offer" role="tab" aria-controls="custom-tabs-five-normal" aria-selected="false">Offers</a> </li> </ul> </div> <form class="form-horizontal" action="?action=<?php echo @$postaction;?>&&edit=<?php echo @$olddata['p_id'];?>&&post_id=<?php echo $_GET['post_id'];?>" method="post" enctype="multipart/form-data"> <div class="card-body"> <div class="tab-content" id="custom-tabs-five-tabContent"> <div class="tab-pane fade active show" id="general"> <div class="card-body"> <div class="form-group row"> <label for="inputEmail3" class="col-sm-2 col-form-label">Product Name</label> <div class="col-sm-10"> <input type="text" value="<?php echo @$olddata['p_name'];?>" class="form-control" id="inputEmail3" placeholder="Product Name" name="p_name" required> </div> </div> <div class="form-group row"> <label for="inputEmail3" class="col-sm-2 col-form-label">Product Code</label> <div class="col-sm-10"> <?php if (isset($olddata['p_code'])) { $p_code = $olddata['p_code']; }else{ $p_code = bin2hex(random_bytes(3)); } ?> <input type="text" value="<?php echo @$p_code;?>" class="form-control" id="inputEmail3" placeholder="Product Code" name="p_code"> </div> </div> <div class="form-group row"> <label for="hsn_code" class="col-sm-2 col-form-label">HSN Code</label> <div class="col-sm-10"> <input type="text" value="<?php echo @$olddata['hsn_code'];?>" class="form-control" id="hsn_code" placeholder="Product Name" name="hsn_code"> </div> </div> <div class="form-group row"> <label for="exampleInputEmail1" class="col-md-2">Uplaod Image</label> <div class="col-md-7"> <input type="file" name="cateimg" class="form-control "> <p>(Image size should be <b>600 X 600</b>)</p> <input type="hidden" value="<?php echo @$olddata['p_img'];?>" name="old_img"> <?php if(isset($olddata['p_img'])) { ?> </div> <div class="col-md-3"> <img src="upload/<?php echo @$olddata['p_img'];?>" width="150" height="100"> <?php } ?> </div> </div> <div class="form-group row"> <label for="inputPassword3" class="col-sm-2 col-form-label">Short Description</label> <div class="col-sm-10"> <textarea class="form-control" name="short_desc" placeholder="Short Description"><?php echo @$olddata['short_desc'];?></textarea> </div> </div> <div class="form-group row"> <label for="inputPassword3" class="col-sm-2 col-form-label">Delivery information</label> <div class="col-sm-10"> <?php if (isset($olddata['d_estimate_time'])) { $d_estimate_time = $olddata['d_estimate_time']; }else{ $d_estimate_time = "Delhi NCR 1 day delivery"; } ?> <input type="text" value="<?php echo @$d_estimate_time;?>" class="form-control" name="d_estimate_time" id="inputPassword3" placeholder="Delivery estimate time and other information"> </div> </div> <div class="form-group row"> <label for="inputPassword3" class="col-sm-2 col-form-label">Stock Left</label> <div class="col-sm-10"> <input type="text" value="<?php echo @$olddata['stock_left'];?>" class="form-control" name="stock_left" id="inputPassword3" placeholder="Stock left"> </div> </div> <div class="form-group row"> <label for="inputPassword3" class="col-sm-2 col-form-label">Meta Tag Title</label> <div class="col-sm-10"> <input type="text" value="<?php echo @$olddata['meta_title'];?>" class="form-control" name="meta_title" id="inputPassword3" placeholder="Meta Tag Title"> </div> </div> <div class="form-group row"> <label for="inputPassword3" class="col-sm-2 col-form-label">Meta Tag Description</label> <div class="col-sm-10"> <textarea class="form-control" name="meta_desc" placeholder="Meta Tag Description"><?php echo @$olddata['meta_desc'];?></textarea> </div> </div> <div class="form-group row"> <label for="inputPassword3" class="col-sm-2 col-form-label">Meta Tag Keywords</label> <div class="col-sm-10"> <textarea class="form-control" name="meta_keyword" placeholder="Meta Tag Keywords"><?php echo @$olddata['meta_keyword'];?></textarea> <small>Enter the list of keywords. It helps to search the product.</small> </div> </div> <!-- ------------------------------------ --> <div class="form-group row mt-5"> <label for="recommendation" class="col-sm-2 col-form-label">Recommendation Message</label> <div class="col-sm-10"> <textarea class="form-control" name="admin_recommendation" placeholder="Recommendation Message"><?php echo @$olddata['admin_recommendation'];?></textarea> </div> </div> <div class="form-group row"> <label for="star" class="col-sm-2 col-form-label">Rating by Admin</label> <div class="col-sm-10"> <div class="d-flex flex-row bd-highlight align-items-center"> <div class="p-2 bd-highlight"> <select name="admin_star" class="form-control"> <?php $star = $olddata['admin_star']; ?> <option value="0" <?=($star==0)?'selected':''?>>No Rating</option> <option value="1" <?=($star==1)?'selected':''?>>1</option> <option value="1.5" <?=($star==1.5)?'selected':''?>>1.5</option> <option value="2" <?=($star==2)?'selected':''?>>2</option> <option value="2.5" <?=($star==2.5)?'selected':''?>>2.5</option> <option value="3" <?=($star==3)?'selected':''?>>3</option> <option value="3.5" <?=($star==3.5)?'selected':''?>>3.5</option> <option value="4" <?=($star==4)?'selected':''?>>4</option> <option value="4.5" <?=($star==4.5)?'selected':''?>>4.5</option> <option value="5" <?=($star==5)?'selected':''?>>5</option> </select> </div> <div class="p-2 bd-highlight"><i class="fa fa-star"></i></div> </div> </div> </div> <div class="form-group row"> <label for="max_qty_per_user" class="col-sm-2 col-form-label">Max Qty Per Order</label> <div class="col-sm-2"> <input type="number" name="max_qty_per_user" class="form-control" value="<?php echo @$olddata['max_qty_per_user'];?>"> </div> </div> <div class="form-group row"> <label class="col-sm-2 col-form-label">Packing Size</label> <div class="col-sm-10"> <div class="d-flex flex-row bd-highlight align-items-center"> <div class="bd-highlight"> <!-- <input type="number" step="any" name="size" class="form-control" value="<?php //echo @$olddata['size'];?>"> --> <style> .dimension_input{width: 100px; border: 1px solid #ced4da;} </style> <div class=" d-flex"> <div class="for_jjfh_"> <p class="mb-0"><small>Length</small></p> <input type="number" step="any" name="length" class="dimension_input" value="<?php echo @$olddata['length'];?>"> X </div> <div class="for_jjfh_"> <p class="mb-0"><small>Breadth</small></p> <input type="number" step="any" name="breadth" class="dimension_input" value="<?php echo @$olddata['breadth'];?>"> X </div> <div class="for_jjfh_"> <p class="mb-0"><small>Height</small></p> <input type="number" step="any" name="height" class="dimension_input" value="<?php echo @$olddata['height'];?>"> </div> </div> </div> <!-- <div class="p-2 bd-highlight"><span style="font-size: 14px;">(Enter value in millimeter)</span></div> --> <div class="p-2 bd-highlight mt-4"> <select name="size_unit" class="form-control"> <option value="centimeter" <?php echo ($olddata['size_unit']=='centimeter')?"selected":""; ?>>centimeter</option> <option value="millimeter" <?php echo ($olddata['size_unit']=='millimeter')?"selected":""; ?>>millimeter</option> <option value="inch" <?php echo ($olddata['size_unit']=='inch')?"selected":""; ?>>inch</option> <option value="meter" <?php echo ($olddata['size_unit']=='meter')?"selected":""; ?>>meter</option> </select> </div> </div> </div> </div> <!-- ----------------------------------------- --> </div> </div> <div class="tab-pane fade" id="data"> <div class="card-body"> <div class="form-group row"> <div class="col-sm-8"> <div class="form-group row"> <label for="inputPassword3" class="col-sm-2 col-form-label"> Price <small class="danger">(M.R.P.)</small></label> <div class="col-sm-10"> <input type="number" step="any" value="<?php echo @$olddata['price'];?>" name="price" class="form-control" id="inputPassword3" placeholder="Price" required> </div> </div> <div class="form-group row"> <label for="inputPassword3" class="col-sm-2 col-form-label">Discounted price <small class="danger">(Selling Price)</small></label> <div class="col-sm-10"> <!-- ----UKP---- --> <input type="hidden" name="old_d_price" value="<?php echo @$olddata['d_price'];?>"> <!-- ----------- --> <input type="number" step="any" value="<?php echo @$olddata['d_price'];?>" name="d_price" class="form-control" id="inputPassword3" placeholder="Dicounted price" required> </div> </div> <div class="form-group row"> <label for="inputPassword3" class="col-sm-2 col-form-label">Shipping Price</label> <div class="col-sm-10"> <input type="number" step="any" min="0" value="<?php echo @$olddata['shipping_price'];?>" name="shipping_price" class="form-control" id="inputPassword3" placeholder="Shipping Price"> </div> </div> <div class="form-group row"> <label for="inputPassword3" class="col-sm-2 col-form-label">Packaging Price</label> <div class="col-sm-10"> <input type="number" min="0" step="any" value="<?php echo @$olddata['packaging_price'];?>" name="packaging_price" class="form-control" id="inputPassword3" placeholder="Packaging Price" > </div> </div> <div class="form-group row"> <label for="inputPassword3" class="col-sm-2 col-form-label">Quantity Available</label> <div class="col-sm-10"> <input type="number" step="any" value="<?php echo @$olddata['quan_available'];?>" name="quan_available" class="form-control" id="inputPassword3" placeholder="Quantity Available" required> </div> </div> <div class="form-group row"> <label for="inputPassword3" class="col-sm-2 col-form-label">GST %</label> <div class="col-sm-10"> <input type="number" step="any" value="<?php echo @$olddata['gst'];?>" name="gst" class="form-control" id="inputPassword3" placeholder="GST"> </div> </div> <div class="form-group row"> <label for="inputPassword3" class="col-sm-2 col-form-label">weight (kg)</label> <div class="col-sm-10"> <input type="number" step="any" value="<?php echo @$olddata['weight'];?>" name="weight" class="form-control" id="inputPassword3" placeholder="GST"> </div> </div> <div class="form-group row"> <label for="inputPassword3" class="col-sm-2 col-form-label">Top Sellar </label> <div class="col-sm-10"> <select class="form-control" name="b_sellar"> <option <?php if(@$data['b_sellar']=='1'){?> selected <?php }?> value="1">Yes</option> <option <?php if(@$data['b_sellar']=='0'){?> selected <?php }?>value="0">No</option> </select> </div> </div> <div class="form-group row"> <label for="inputPassword3" class="col-sm-2 col-form-label">Sort Order</label> <div class="col-sm-10"> <input type="number" step="any" class="form-control" value="<?php echo @$data['short_order'];?>" name="short_order" placeholder="sort order"> </div> </div> <div class="form-group row"> <label for="inputPassword3" class="col-sm-2 col-form-label">Status </label> <div class="col-sm-10"> <select class="form-control" name="status"> <option <?php if(@$data['status']=='1'){?> selected <?php }?> value="1">Yes</option> <option <?php if(@$data['status']=='0'){?> selected <?php }?>value="0">No</option> </select> </div> </div> </div> <div class="col-lg-4"> <div class="rightbar"> <label> Choose Category and Brands</label> <ul> <?php $condition1="`parent_id`= 0 AND `type`=1"; $query=$ins_obj->display_rcd('category',$condition1); if(is_array($query) || !empty($query)) { foreach($query as $data1) { // ======================update============================ ?> <li> <label> <input type="checkbox" <?php if(@in_array($data1['cat_id'], $type1_array)){?> checked <?php } ?> value="<?php echo $data1['cat_id'];?>" name="p_cat[]"> <span><?php echo $data1['name'];?></span> <input type="hidden" name="type_<?php echo $data1['cat_id']; ?>" value="<?php echo $data1['type'];?>"> </label> <!-- ======================update============================ --> <ul> <?php $condition1="`cat_id`=".$data1['cat_id']; $query=$ins_obj->display_rcd('multi_order_cat',$condition1); if(is_array($query) || !empty($query)) { foreach($query as $data2) { $brandcondition="`id`=".$data2['o_id']; $brand_query=$ins_obj->display_rcd('all_brands',$brandcondition); if(is_array($brand_query) || !empty($brand_query)) { foreach($brand_query as $brand) { ?> <li> <label><input <?php if(@in_array($brand['id'], $type2_array) &&@in_array($data1['cat_id'], $type1_array)){?> checked<?php }?> type="checkbox" name="b_id_<?php echo $data1['cat_id']?>[]" value="<?php echo $brand['id'];?>"> <span><?php echo $brand['name'];?></span> <input type="hidden" name="type_<?php echo $brand['id']; ?>" value="<?php echo 2;?>"> </label> <?php ?> </li> <?php } } } } ?> </ul> </li> <?php } } ?> </ul> </div> </div> </div> </div> </div> <div class="tab-pane fade" id="extrainformation"> <div class="card-body"> <div class="form-group row"> <label for="inputPassword3" class="col-sm-2 col-form-label">Product Description</label> <div class="col-sm-10"> <textarea class="textarea" name="p_desc" placeholder="Place some text here" style="width: 100%; height: 200px; font-size: 14px; line-height: 18px; border: 1px solid #dddddd; padding: 10px;"><?php echo @$olddata['p_desc'];?></textarea> </div> </div> <div class="form-group row"> <label for="inputPassword3" class="col-sm-2 col-form-label">Delivery</label> <div class="col-sm-10"> <?php if (isset($olddata['delivery'])) { $delivery_info = $olddata['delivery']; }else{ $delivery_info = "Delhi NCR 1 day delivery"; } ?> <textarea class="textarea" name="delivery" placeholder="Place some text here" style="width: 100%; height: 200px; font-size: 14px; line-height: 18px; border: 1px solid #dddddd; padding: 10px;"><?php echo @$delivery_info;?></textarea> </div> </div> <div class="form-group row"> <label for="inputPassword3" class="col-sm-2 col-form-label">Additional Information</label> <div class="col-sm-10"> <textarea class="textarea" name="add_information" placeholder="Place some text here" style="width: 100%; height: 200px; font-size: 14px; line-height: 18px; border: 1px solid #dddddd; padding: 10px;"><?php echo @$olddata['add_information'];?></textarea> </div> </div> </div> </div> <div class="tab-pane fade" id="eximage"> <div class="card-body"> <div class="form-group row"> <label for="inputPassword3" class="col-sm-2 col-form-label">Upload image</label> <div class="col-sm-10"> <div class="custom-file"> <input type="file" name="m_img[]" multiple id="exampleInputFile"> <p>(Image size should be <b>600 X 600</b>)</p> </div> <?php if($postaction=='1') { ?> <table class="table table-striped table-bordered"> <tr > <td id="results" colspan="2"></td> </tr> <thead class="thead-light"> <tr> <th>All Images</th> <th>Action</th> </tr> </thead> <?php $condition1="`p_id`=".$_GET['post_id']; $query=$ins_obj->display_rcd('multi_p_img',$condition1); if(is_array($query) || !empty($query)) { foreach($query as $bulkimg) { if($bulkimg['img']!='') { ?> <tr class="test_<?php echo $bulkimg['id'];?>"> <td><img src="upload/<?php echo $bulkimg['img'];?>" width="70" class="img_thumbnail"> <input type="hidden" name="old_multi_img[]" value="<?php echo $bulkimg['img'];?>"> </td> <td><a style="color:#fff;" class="btn btn-danger btn-sm delete" id="<?php echo $bulkimg['id']; ?>"><i class="fa fa-times"></i> Remove</a> </td> </tr> <?php } } } ?> </table> <?php } ?> </div> </div> </div> </div> <!-- =================== Offer ================================ --> <div class="tab-pane fade " id="offer"> <div class="" id="add_offer"> <!-- ---------------------- Div - 1 Data ----------- --> <?php if(!empty($offers_data)) { $p = 0; foreach ($offers_data as $offer_data) { ?> <div class="p-2 mb-2" style="border: 1px solid #d6cece;"> <b class="text-info"><u>Offer</u></b> <button style="float:right;" class="remove_field btn-xs btn-danger">Remove</button> <div class="card-body"> <div class="form-group row"> <label class="col-sm-2 col-form-label">Offer Title</label> <div class="col-sm-12 col-md-10 col-lg-8"> <input type="text" value="<?php echo @$offer_data['offer_title'];?>" class="form-control" placeholder="Offer Title" name="offer_title[]"> </div> </div> <div class="form-group row"> <label class="col-sm-2 col-form-label">Minimum Qty</label> <div class="col-sm-12 col-md-10 col-lg-8"> <input type="number" value="<?php echo @$offer_data['offer_qty'];?>" class="form-control" placeholder="Offer Quantity" name="offer_qty[]"> </div> </div> <div class="form-group row"> <label class="col-sm-2 col-form-label">Discount Type</label> <div class="col-sm-12 col-md-10 col-lg-8"> <select class="form-control" name="offer_discount_type[]" required> <option value="percent" <?php if($offer_data['offer_discount_type']=='percent'){echo " selected";} ?>>Percentage</option> <option value="flat" <?php if($offer_data['offer_discount_type']=='flat'){echo " selected";} ?>>Flat Amount</option> </select> </div> </div> <div class="form-group row"> <label class="col-sm-2 col-form-label">Discount</label> <div class="col-sm-12 col-md-10 col-lg-8" required> <input type="number" value="<?php echo @$offer_data['offer_discount'];?>" name="offer_discount[]" class="form-control" placeholder="Offer Discount"> </div> </div> <div class="form-group row"> <label class="col-sm-2 col-form-label"></label> <div class="col-md-3"> <input type="checkbox" value="1" name="free_delivery[<?=$p?>]" <?php if(@$offer_data['free_delivery']==1){echo " checked";} ?>> <label class="">Free Delivery</label> </div> <div class="col-md-3"> <input type="checkbox" value="1" name="free_packaging[<?=$p?>]" <?php if(@$offer_data['free_packaging']==1){echo " checked";} ?>> <label class="">Free Packaging</label> </div> </div> <div class="form-group row"> <label class="col-sm-2 col-form-label">Offer Desciption</label> <div class="col-sm-12 col-md-10 col-lg-8"> <textarea name="offer_discription[]" class="form-control"><?php echo @$offer_data['offer_discription'];?></textarea> </div> </div> <div class="form-group row"> <label class="col-sm-2 col-form-label">Product Name</label> <div class="col-sm-12 col-md-10 col-lg-8"> <input type="text" value="<?php echo @$offer_data['product_name'];?>" class="form-control" placeholder="Product Name" name="product_name[]"> </div> </div> <div class="form-group row"> <label class="col-sm-2 col-form-label">Offer Image <small>(Optional)</small></label> <div class="col-sm-12 col-md-10 col-lg-8"> <div class="row"> <?php if($offer_data['offer_image']){ ?> <div class="col-md-3"> <div class="p-1" id="ofrimg<?php echo $p;?>" style="border: 1px solid #dddddd;"> <img src="img/offer_image/<?php echo @$offer_data['offer_image'];?>" class="img-fluid"> <a class="btn btn-danger btn-xs pl-2 pr-2 text-light" id="rembtn<?php echo $p;?>" style="position: absolute;top: 4px; right: 12px;"> X </a> </div> </div> <?php } ?> <div class="col-md-7"> <input type="file" name="offer_image[]" class="form-control"> <small>(Image size should be <b>100 X 100</b>)</small> <input type="hidden" name="offer_image_old[]" value="<?php echo @$offer_data['offer_image'];?>"> <input type="hidden" name="remove_image[]" value="0" id="remove_image<?php echo $p;?>"> </div> </div> </div> </div> </div> </div> <script> $("#rembtn<?php echo $p;?>").click(function(){ $("#remove_image<?php echo $p;?>").val("1"); $("#ofrimg<?php echo $p;?>").fadeOut(900, function(){ $(this).remove(); }); }); </script> <?php $p++;} }else{ ?> <!-- ------------- Div -1 Empaty ------------------- --> <div class="p-2 mb-2" style="border: 1px solid #d6cece;"> <b class="text-info"><u>Offer</u></b> <div class="card-body"> <div class="form-group row"> <label class="col-sm-2 col-form-label">Offer Title</label> <div class="col-sm-12 col-md-10 col-lg-8"> <input type="text" value="" class="form-control" placeholder="Offer Title" name="offer_title[]"> </div> </div> <div class="form-group row"> <label class="col-sm-2 col-form-label">Minimum Qty</label> <div class="col-sm-12 col-md-10 col-lg-8"> <input type="number" value="1" class="form-control" placeholder="Offer Quantity" name="offer_qty[]"> </div> </div> <div class="form-group row"> <label class="col-sm-2 col-form-label">Discount Type</label> <div class="col-sm-12 col-md-10 col-lg-8"> <select class="form-control" name="offer_discount_type[]" required> <option value="percent">Percentage</option> <option value="flat">Flat Amount</option> <!-- <option value="free_delivery">Free Delivery</option> --> </select> </div> </div> <div class="form-group row"> <label class="col-sm-2 col-form-label">Discount</label> <div class="col-sm-12 col-md-10 col-lg-8" required> <input type="number" value="0" name="offer_discount[]" class="form-control" placeholder="Discount"> </div> </div> <div class="form-group row"> <label class="col-sm-2 col-form-label"></label> <div class="col-md-3"> <input type="checkbox" value="1" name="free_delivery[0]"> <label class="">Free Delivery</label> </div> <div class="col-md-3"> <input type="checkbox" value="1" name="free_packaging[0]"> <label class="">Free Packaging</label> </div> </div> <div class="form-group row"> <label class="col-sm-2 col-form-label">Offer Desciption</label> <div class="col-sm-12 col-md-10 col-lg-8"> <textarea name="offer_discription[]" class="form-control"></textarea> </div> </div> <div class="form-group row"> <label class="col-sm-2 col-form-label">Product Name</label> <div class="col-sm-12 col-md-10 col-lg-8"> <input type="text" value="<?php echo @$offer_data['product_name'];?>" class="form-control" placeholder="Product Name" name="product_name[]"> </div> </div> <div class="form-group row"> <label class="col-sm-2 col-form-label">Offer Image <small>(Optional)</small></label> <div class="col-sm-12 col-md-10 col-lg-8"> <input type="file" name="offer_image[]" class="form-control"> <small>(Image size should be <b>100 X 100</b>)</small> </div> </div> </div> </div> <!-- --------------------------------------- --> <?php } ?> </div> <div class="text-right"> <button class="add_field_button btn-success">Add More Offer</button> </div> </div> <!-- ========================================================== --> </div> </div> <div class="card-footer"> <?php if($postaction=='1') { ?> <button type="submit" name="submit" class="btn btn-primary">Update</button> <?php } else { ?> <button type="submit" name="submit" class="btn btn-primary">Submit</button> <?php } ?> </div> </form> </div> </div> </div> <!-- /.row (main row) --> </div> <!-- /.container-fluid --> </section> <!-- /.content --> </div> <!-- /.content-wrapper --> <?php include("footer.php");?> <!-- ------ Offer ---------- --> <script> $(document).ready(function() { var max_fields = 10; //maximum input boxes allowed var wrapper = $("#add_offer"); //Fields wrapper var add_button = $(".add_field_button"); //Add button ID var x = <?php if(isset($p)){echo $p;}else{echo 1;} ?>; //initlal text box count $(add_button).click(function(e){ //on add input button click e.preventDefault(); if(x < max_fields){ //max input box allowed var html = `<div class=" p-2 mb-2" style="border: 1px solid #d6cece;"> <b class="text-info"><u>Offer</u></b> <button style="float:right;" class="remove_field btn-xs btn-danger">Remove</button> <div class="card-body"> <div class="form-group row"> <label class="col-sm-2 col-form-label">Offer Title</label> <div class="col-sm-12 col-md-10 col-lg-8"> <input type="text" value="" class="form-control" placeholder="Offer Title" name="offer_title[]"> </div> </div> <div class="form-group row"> <label class="col-sm-2 col-form-label">Minimum Qty</label> <div class="col-sm-12 col-md-10 col-lg-8"> <input type="number" value="1" class="form-control" placeholder="Offer Quantity" name="offer_qty[]"> </div> </div> <div class="form-group row"> <label class="col-sm-2 col-form-label">Discount Type</label> <div class="col-sm-12 col-md-10 col-lg-8"> <select class="form-control" name="offer_discount_type[]" required> <option value="percent">Percentage</option> <option value="flat">Flat Amount</option> </select> </div> </div> <div class="form-group row"> <label class="col-sm-2 col-form-label">Discount</label> <div class="col-sm-12 col-md-10 col-lg-8" required> <input type="number" value="0" name="offer_discount[]" class="form-control" placeholder="Discount"> </div> </div> <div class="form-group row"> <label class="col-sm-2 col-form-label"></label> <div class="col-md-3"> <input type="checkbox" value="1" name="free_delivery[`+x+`]"> <label class="">Free Delivery</label> </div> <div class="col-md-3"> <input type="checkbox" value="1" name="free_packaging[`+x+`]"> <label class="">Free Packaging</label> </div> </div> <div class="form-group row"> <label class="col-sm-2 col-form-label">Offer Desciption</label> <div class="col-sm-12 col-md-10 col-lg-8"> <textarea name="offer_discription[]" class="form-control"></textarea> </div> </div> <div class="form-group row"> <label class="col-sm-2 col-form-label">Product Name</label> <div class="col-sm-12 col-md-10 col-lg-8"> <input type="text" value="" class="form-control" placeholder="Product Name" name="product_name[]"> </div> </div> <div class="form-group row"> <label class="col-sm-2 col-form-label">Offer Image <small>(Optional)</small></label> <div class="col-sm-12 col-md-10 col-lg-8"> <input type="file" name="offer_image[]" class="form-control"> </div> </div> </div> </div>`; x++; //text box increment $(wrapper).append(html); //add input box } }); $(wrapper).on("click",".remove_field", function(e){ //user click on remove text e.preventDefault(); $(this).parent('div').remove(); x--; }) }); </script> <!-- ---------------------------- --> <script type="text/javascript"> $(document).on('click','.delete',function() { if(confirm("Are you sure you want to delete this post?")) { var post_id = $(this).attr("id"); $.ajax({ type: 'POST', url: 'delete_img.php', data: ({id:post_id}), cache: false, success: function(data) { $('#results').html(data); $('.test_'+post_id).hide(); } }) return false; } }); </script> <!-- ==========================upload size======================== --> <script type="text/javascript"> $(document).on('click','.sizeupload',function() { var o_size = $("#o_size").val(); var o_price = $("#o_price").val(); var o_d_price = $("#o_d_price").val(); var o_quantity = $("#o_quantity").val(); var o_sortorder = $("#o_sortorder").val(); var p_id = $("#p_id").val(); var u_id = $("#u_id").val(); var dataString = 'o_size='+ o_size + '&o_price='+ o_price + '&o_d_price='+ o_d_price + '&o_quantity='+ o_quantity + '&o_sortorder='+ o_sortorder + '&p_id='+ p_id + '&u_id=' + u_id; if(o_size=='0') { alert("Please Choose Size"); } else if(o_price=='') { alert("Please Fill Price"); } else if(o_quantity=='') { alert("Please Fill Quantity"); } else if(o_sortorder=='') { alert("Please Fill Sort Order"); } else { // alert(dataString); $.ajax({ type: 'POST', url: 'upload_size.php', data: dataString, cache: false, success: function(data) { var o_size = $("#o_size").val(''); var o_price = $("#o_price").val(''); var o_quantity = $("#o_quantity").val(''); var o_sortorder = $("#o_sortorder").val(''); $('#sizeresults').html(data); } }) return false; } }); </script> <!-- ========================update options starts========================= --> <script type="text/javascript"> $(document).on('click','.updatemultioption',function(){ var mdi = $(this).data('id'); var n_o_size = $("#n_o_size"+mdi).val(); var n_o_price = $("#n_o_price"+mdi).val(); var n_d_o_price = $("#n_d_o_price"+mdi).val(); var n_o_quantity = $("#n_o_quantity"+mdi).val(); var n_o_sortorder = $("#n_o_sortorder"+mdi).val(); var current_id = mdi; var p_id = $("#p_id").val(); var u_id = $("#u_id").val(); // var current_id = $(this).attr("id"); // alert(current_id); var dataString = 'n_o_size='+ n_o_size + '&n_o_price='+ n_o_price + '&n_d_o_price='+ n_d_o_price + '&n_o_quantity='+ n_o_quantity + '&n_o_sortorder='+ n_o_sortorder + '¤t_id='+ current_id + '&p_id='+ p_id + '&u_id=' + u_id; alert(dataString); $.ajax({ type: 'POST', url: 'update_size.php', data: dataString, cache: false, success: function(data) { $('#sizeresults').html(data); } }) return false; }); </script> <!-- =============================update options ends============================ --> <!-- ===========================delete options========================================== --> <script type="text/javascript"> $(document).on('click','.optiondelete',function(){ if(confirm("Are you sure you want to delete this option?")) { var option_id = $(this).attr("id"); alert(option_id); $.ajax({ type: 'POST', url: 'delete_multi_options.php', data: ({id:option_id}), cache: false, success: function(data) { $('#deleteresult').html(data); $('.optiondele_'+option_id).hide(); } }) return false; } }); </script> <script type="text/javascript"> window.setTimeout(function() { $(".alert").fadeTo(1000, 0).slideUp(10, function(){ $(this).remove(); }); }, 200); </script> <!-- ===============================color========================= --> <script type="text/javascript"> $(document).ready(function(){ $(document).on('click', '.add', function(){ var html = ''; html += '<tr>'; html += '<td><input type="color" name="item_name[]" class="form-control item_name" /></td>'; html += '<td><input type="text" name="item_quantity[]" class="form-control item_quantity" /></td>'; html += '<td><select name="item_unit[]" class="form-control item_unit"><option value="">Select status</option><option value="1">Enabled</option><option value="0">Disabled</option></select></td>'; html += '<td><button type="button" name="remove" class="btn btn-danger btn-sm remove"><span class="fa fa-minus"></span></button></td></tr>'; $('#item_table').append(html); }); $(document).on('click', '.remove', function(){ $(this).closest('tr').remove(); }); var error = ''; $('.item_name').each(function(){ var count = 1; if($(this).val() == '') { error += "<p>Enter Item Name at "+count+" Row</p>"; return false; } count = count + 1; }); $('.item_quantity').each(function(){ var count = 1; if($(this).val() == '') { error += "<p>Enter Item Quantity at "+count+" Row</p>"; return false; } count = count + 1; }); }); </script>