]]jkjjgdjffksdkdxdsghfghdfghfgdfsdsdfsdfsfdsbcxvxcbccwewqeqwewqskfgj
במ12[cxvbcxvbxcvbcxvcxvbcvxcvbsdfsdfsdfsdfsdfsdfxcvbxcvxbbxqwqewqewv;'
/
home
/
u506006416
/
domains
/
crystalmiracle.co.in
/
public_html
/
admin
/
Upload FileeE
HOME
<?php /*echo "<pre>"; print_r($_POST);die;*/ include("header.php"); $ins_obj= new config(); ?> <?php include("sidebar.php");?> <?php @$postaction=$_GET['edit']; if($postaction=='1') { $url = BASE_URL."all_varients.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) { } } $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') { // 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']; } $condition1Main = " p_id=".$_POST['main_product']; $queryMain=$ins_obj->display_rcd('product',$condition1Main); if(is_array($queryMain) || !empty($queryMain)) { foreach($queryMain as $prdDataMain) { } } /*-------------------------------------*/ $insertdata = array( 'p_name' => $ins_obj->validation($_POST['p_name']) ?? $prdDataMain['p_name'], 'p_code' => $ins_obj->validation($_POST['p_code']) ?? $prdDataMain['p_code'], 'buyType' => $ins_obj->validation($_POST['buyType']) ?? $prdDataMain['buyType'], 'p_img' => $ins_obj->validation($basename) ?? $prdDataMain['p_img'], 'short_desc' => $ins_obj->validation($_POST['short_desc']) ?? $prdDataMain['short_desc'], 'd_estimate_time' => $ins_obj->validation($_POST['d_estimate_time']) ?? $prdDataMain['d_estimate_time'], 'stock_left' => 50, 'meta_title' => $ins_obj->validation($_POST['meta_title']) ?? $prdDataMain['meta_title'], 'meta_desc' => $ins_obj->validation($_POST['meta_desc']) ?? $prdDataMain['meta_desc'], 'meta_keyword' => $ins_obj->validation($_POST['meta_keyword']) ?? $prdDataMain['meta_keyword'], 'price' => $ins_obj->validation($_POST['price']) ?? $prdDataMain['price'], 'd_price' => $ins_obj->validation($_POST['d_price']) ?? $prdDataMain['d_price'], 'quan_available' => $ins_obj->validation($_POST['quan_available']) ?? $prdDataMain['quan_available'], 'gst' => $ins_obj->validation($_POST['gst']) ?? $prdDataMain['gst'], 'weight' => $ins_obj->validation($_POST['weight']) ?? $prdDataMain['weight'], 'b_sellar' => 1, 'p_desc' => $ins_obj->validation($_POST['p_desc']) ?? $prdDataMain['p_desc'], 'delivery' => $ins_obj->validation($_POST['delivery']) ?? $prdDataMain['delivery'], 'add_information' => $ins_obj->validation($_POST['add_information']) ?? $prdDataMain['add_information'], 'short_order' => $ins_obj->validation($_POST['short_order']) ?? $prdDataMain['short_order'], 'status' => 1, 'shipping_price' => $ins_obj->validation($_POST['shipping_price']) ?? $prdDataMain['shipping_price'], 'packaging_price' => $ins_obj->validation($_POST['packaging_price']) ?? $prdDataMain['packaging_price'], 'updated_at' => date("Y-m-d h:i:s") ?? $prdDataMain['updated_at'], 'price_drop_date' => $price_drop_date ?? $prdDataMain['price_drop_date'], 'admin_recommendation' => $ins_obj->validation($_POST['admin_recommendation']) ?? $prdDataMain['admin_recommendation'], 'admin_star' => $ins_obj->validation($_POST['admin_star']) ?? $prdDataMain['admin_star'], 'max_qty_per_user' => $ins_obj->validation($_POST['max_qty_per_user']) ?? $prdDataMain['max_qty_per_user'], 'hsn_code' => $ins_obj->validation($_POST['hsn_code']) ?? $prdDataMain['hsn_code'], 'length' => $ins_obj->validation($_POST['length']) ?? $prdDataMain['length'], 'breadth' => $ins_obj->validation($_POST['breadth']) ?? $prdDataMain['breadth'], 'height' => $ins_obj->validation($_POST['height']) ?? $prdDataMain['height'], 'size_unit' => $ins_obj->validation($_POST['size_unit']) ?? $prdDataMain['size_unit'], 'offers' => $offers ?? $prdDataMain['offers'], 'length_cm' => $length_cm ?? $prdDataMain['length_cm'], 'breadth_cm' => $breadth_cm ?? $prdDataMain['breadth_cm'], 'height_cm' => $height_cm ?? $prdDataMain['height_cm'], 'combo_product_ids' => $combo_product_ids ?? $prdDataMain['combo_product_ids'], 'parrent'=>$_POST['main_product'], 'type'=>2 ); 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 = uniqid() . "$im-" . time()."_".$_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_varients.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 = uniqid() . "$im-" . time()."_".$_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="new_varient.php?edit=1&&post_id=<?php echo $_GET['post_id']; ?>"; } ); </script> <?php } else { echo "error".mysqli_error($this->con); } } } } ?> <!-- -------- Multi-select option ----- --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/chosen/1.8.7/chosen.min.css" /> <script src="https://cdnjs.cloudflare.com/ajax/libs/chosen/1.8.7/chosen.jquery.js" ></script> <!-- ---------------------------------- --> <!-- 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_varients.php">Varient 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" style="display:none"> <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" style="display:none"> <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="hsn_code" class="col-sm-2 col-form-label">Main Products</label> <div class="col-sm-10"> <select class="form-control" name="main_product"> <?php $condition1Main = "`type`= 1"; $queryPrd=$ins_obj->display_rcd('product',$condition1Main); if(is_array($queryPrd) || !empty($queryPrd)) { foreach ($queryPrd as $data){ ?> <option value="<?=$data['p_id']?>" <?php if(isset($olddata['parrent'])): if($olddata['parrent'] == $data['p_id']): ?> selected <?php endif;endif;?>><?=$data['p_name']?></option> <?php } } ?> </select> </div> </div> <div class="form-group row"> <label for="inputEmail3" class="col-sm-2 col-form-label"> Varients Name</label> <div class="col-sm-10"> <input type="text" value="<?php echo @$olddata['p_name'];?>" class="form-control" id="inputEmail3" placeholder="Varients Name" name="p_name" required> </div> </div> <div class="form-group row" > <label for="inputEmail3" class="col-sm-2 col-form-label">Varients 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" style="display:none" > <label for="hsn_code" class="col-sm-2 col-form-label">Product Type</label> <div class="col-sm-10"> <select class="form-control" name="buyType"> <option value="1" selected>Buy Now</option> <option value="2">Enquiry Now</option> </select> </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" style="display:none"> <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"> <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">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="weight (kg)"> </div> </div> <div class="form-group row" style="display:none"> <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'] ?? 10;?>"> </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"> <?php if(isset($olddata['p_desc']) && $olddata['p_desc']!=""){ $product_desc = $olddata['p_desc']; }else{ $product_desc = '<table class="table table-bordered"><tbody><tr><td>Model Name : <br></td><td><br></td></tr><tr><td>Model Number : <br></td><td><br></td></tr><tr><td>Ideal For :<br></td><td><br></td></tr><tr><td>Item Dimensions : <br></td><td><br></td></tr><tr><td>Type :<br></td><td><br></td></tr><tr><td>Color :<br></td><td><br></td></tr><tr><td>Base Material : <br></td><td><br></td></tr><tr><td>Item Size : <br></td><td><br></td></tr><tr><td>Pack of : <br></td><td><br></td></tr><tr><td>Finish : <br></td><td><br></td></tr></tbody></table><br> '; } ?> <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 @$product_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[]" > <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" > <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[]" > <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" > <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 --> <!-- --------- Combo Product Sets ---------- --> <script> document.getElementById('output').innerHTML = ''; $(".chosen-select").chosen(); // $(".chosen-select").chosen({width: "95%"}); // $('.chosen-select').innerWidth("100%"); </script> <?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[]" > <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" > <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>