MMCT TEAM
Server IP : 162.214.80.37  /  Your IP : 216.73.216.68
Web Server : Apache
System : Linux sh013.webhostingservices.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : imyrqtmy ( 2189)
PHP Version : 8.2.18
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home2/imyrqtmy/www/agriba/admin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/imyrqtmy/www/agriba/admin/edit-product-varient.php
<?php include'loginQuery/session_start.php';
include'dbc.php';
$pageTitle="Add a new Product Varient with photographs and other attributes";
$pageName="Product Varient";
$linkName="Show All Product Varient";
$tableName="tbl_product";
$listPageUrl="product-varient-list.php";
?>

<!DOCTYPE html>
<html>
    <head>
    
        <meta charset="utf-8">
            <meta content="width=device-width, initial-scale=1.0" name="viewport">
                <meta content="IE=edge" http-equiv="X-UA-Compatible">
                    <!-- Page title -->
                    <title>
                      <?php echo $pageName?>
                    </title>
                    <!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
                    <!--<link rel="shortcut icon" type="image/ico" href="favicon.ico" />-->
                    <!-- Vendor styles -->
                    <?php include'include/header-file.php';?>
          <!--select feild css-->                    
          <link rel="stylesheet" href="vendor/select2-3.5.2/select2.css" />
                    <link rel="stylesheet" href="vendor/select2-bootstrap/select2-bootstrap.css" />
            <link rel="stylesheet" href="vendor/bootstrap-touchspin/dist/jquery.bootstrap-touchspin.min.css" />
                    <link rel="stylesheet" href="vendor/summernote/dist/summernote.css" />
                        <link rel="stylesheet" href="vendor/summernote/dist/summernote-bs3.css" />
                </meta>
            </meta>
        </meta>
        <script type="text/javascript" src="js/tinymce/tinymce.min.js"></script>
<script type="text/javascript">
tinymce.init({
    selector: "textarea",
    
    plugins: [
        "codesample",
        "advlist autolink lists link image charmap print preview anchor",
        "searchreplace visualblocks code fullscreen",
        "insertdatetime media table contextmenu paste"
    ],
    toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | codesample "
});


</script>
    </head>
   
<style>
    .small-header .panel-body h2 {
      margin-top:3px;
    }
    .hbreadcrumb {
      margin-top:0;
    }
</style>    
    <body class="hide-sidebar">
        <!-- Simple splash screen-->
    
        <!--[if lt IE 7]>
<p class="alert alert-danger">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
        <!-- Header -->
        <?php include'include/header.php';?>
        <!-- Header End-->

        <!-- Navigation -->
        <?php include'include/side-menu.php';?>
        <!-- Navigation -->
<?php
  
  if(isset($_GET['id']))
  {
    
    $idd=$_GET['id'];
    $sql=mysqli_query($conn,"select * from $tableName where id='$idd'") or die(mysqli_error($conn));
    $row=mysqli_fetch_assoc($sql);
    extract($row);
        $productid=$row['productid'];
        $varient_id=$row['varient_id'];
        $category_id=$row['category_id'];
        $sub_category_id=$row['sub_category_id'];
        //
        $sql2=mysqli_query($conn,"select * from tbl_product_price where productId='$productid'") or die(mysqli_error($conn));
        $row2=mysqli_fetch_assoc($sql2);
        $pprice=$row2['pprice'];
        //
    
    $mode="editProductVarient";
    $btnname="Update Product";
  }
  else
  {
    $id                     ="";
        if(isset($_GET['cid'])){
        $category_id = $_GET['cid'];   
        }else{
            $category_id            ="";    
        }

        $sub_category_id           ="";
    $productname           ="";
     $stock              ="";
        $pprice               ="";
        $pqty               ="";
        $weight ="";
        $mrp_price              ="";
        $short_description       ="";
    $thumb1        ="";
        $thumb2            ="";
        $thumb3            ="";
        $thumb4            ="";
        $thumb5            ="";
        $thumb6            ="";
         $status  ="1";
         $latest  ="0";
         $featured="0";
         $productpage="0";
         $shipping="";
         $shippingzonal= "";
         $shippinginternational ="";
         $skucode ="";
    $mode="addProductVarient";
    $idd="";
    $btnname="Save this Product";
    $active='';
  }
  
?>        
        <!-- Main Wrapper -->
        <div id="wrapper">
       <!--small header start-->    
<div class="small-header">
    <div class="hpanel">
        <div class="panel-body">
            <div id="hbreadcrumb" class="pull-right">
                <ol class="hbreadcrumb breadcrumb">
                    <li><a href="product-varient-list.php?varientid=<?php echo $varient_id;?>" class="btn  btn-warning"><strong><?php echo $linkName;?></strong></a></li>
                </ol>
            </div>
            <h2 class="font-light m-b-xs">
               <?php echo $pageName;?>
            </h2>
            <small><?php echo $pageTitle;?></small>
        </div>
    </div>
</div>     
                    
 <script type="text/javascript">
    $(document).ready(function()
    {
        $('#cateId').on('change', function()
         {
            var v=$('#cateId').val();
            $.get("ajax.php",{vl:v},function(data){
            $("#subcateid").html(data);

            });
});
 });
  </script>
     <script type="text/javascript">
    $(document).ready(function()
    {
        $('#subcateid').on('change', function()
         {
            var v2=$('#subcateid').val();
            $.get("ajax2.php",{vl:v2},function(data){
            $("#subsubcateid").html(data);

            });
});
 });
  </script>
<!--small header end-->   
            <div class="content ">
                <div class="row">
                
                    <div class="col-lg-12">
                        <div class="hpanel">
                            
                           
                            
                            <div class="panel-body">
                                <!-- Page Form-->
                                <form id="form_2" role="form" action="dataQuery/process.php" method="post" enctype="multipart/form-data">
                                    <input type="hidden" id="getaction" name="action" value="editProductVarient"/>
                                    <input type="hidden" id="getid" name="txtid" value="<?php echo $id;?>"/>
                                    <input type="hidden"  name="txtproductid" value="<?php echo $productid;?>"/>
                                    <input type="hidden" id="getvarientid" name="txtvarientid" value="<?php echo $_GET['varientid'];?>"   />

    <div class="form-group row">
        <div class="col-xs-12 col-sm-2" >
            <label for="name">Category Name<span class="text-danger">*</span></label>
            <select name="selcategory" id="cateId" class="form-control" required="">
                <option value="">Select</option>
                <?php $sql=mysqli_query($conn,"select * from tbl_category order by name")or die(mysqli_error($conn));
                while($row=mysqli_fetch_assoc($sql))
                {
                    $cid=$row['id'];
                    $cname=$row['name'];
                    if($cid==$category_id)
                        {
                            $select="selected";
                        }
                    else
                        {
                            $select="";
                        }
                        echo "<option value='$cid' $select>$cname</option>";
                }

                ?>
            </select>
        </div> 
        <div class="col-xs-12 col-sm-2" >
            
            
            <label for="name">Sub Category Name</label>
            <select name="selsubcategory" id="subcateid" class="form-control" >
                <option value="">Select</option>
                <?php 
                $sql=mysqli_query($conn,"select * from tbl_subcategory where category_id='$category_id' order by name")or die(mysqli_error($conn));
                while($row=mysqli_fetch_assoc($sql))
                {
                                  $cid2=$row['id'];
                                  $scname=$row['name'];
                                  if($cid2==$sub_category_id)
                                  {
                                    $select="selected";
                                  }
                                  else
                                  {
                                    $select="";
                                  }
                                  echo "<option value='$cid2' $select>$scname</option>";
                                }
                              ?>
            </select>
        </div>
          <div class="col-xs-12 col-sm-2" >
            
            
            <label for="name">Sub Sub Category Name</label>
            <select name="selsubsubcategory" id="subsubcateid" class="form-control">
                <option value="">Select</option>
                <?php 
                $sql=mysqli_query($conn,"select * from tbl_sub_subcategory where sub_category_id='$sub_category_id' order by name")or die(mysqli_error($conn));
                while($row=mysqli_fetch_assoc($sql))
                {
                                  $sid2=$row['id'];
                                  $sscname=$row['name'];
                                  if($sid2==$sub_sub_category_id)
                                  {
                                    $select="selected";
                                  }
                                  else
                                  {
                                    $select="";
                                  }
                                  echo "<option value='$sid2' $select>$sscname</option>";
                                }
                              ?>
            </select>
        </div>
        <div class="col-sm-2 " style="margin-top: 28px;" >
             <input type="checkbox" id="featured" name="txtfeatured" <?php 
                if($featured==1){ echo "checked";} ?>>
                 <label for="featured">Featured Prdouct</label>  
        </div>
        <div class="col-sm-2 " style="margin-top: 28px;" >
             <input type="checkbox" id="latest" name="txtlatests" <?php 
                if($latest==1){ echo "checked";} ?>>
                 <label for="latest">Latest product </label>  
        </div>
        <div class="col-sm-1" style="margin-top: 28px;" >
             <input type="checkbox" id="productpage" name="txtproductpage" <?php 
                if($productpage==1){ echo "checked";} ?>>
                 <label for="productpage">Product Page </label>  
        </div>
         <div class="col-sm-1" style="margin-top: 28px;" >
             <input type="checkbox" id="name" name="txtstatus" <?php 
                if($status==1){ echo "checked";} ?>>
                 <label for="name">Active </label>  
        </div>
    </div>    

    <div class="form-group row">
         
    </div>                              
                        
  <div class="form-group row"> 
        <div class="col-xs-12 col-sm-6" >
            <label for="name">Product Name<span class="text-danger">*</span></label>
            <input type="text" name="txtproductname" value="<?php echo $productname ;?>"  class="form-control" required>
        </div>
        <div class="col-xs-12 col-sm-3" >
            <label for="name">SKU Code</label>
            <input type="text" name="txtskucode" value="<?php echo $skucode ;?>"  class="form-control"  >
        </div>
        <div class="col-xs-12 col-sm-3" >
            <label for="name">Color<span class="text-danger">*</span></label>
            <select name="selcolor" class="form-control" required="">
                <option value="">Select Color</option>
                <?php $sqlc=mysqli_query($conn,"select * from tbl_color where status='1' order by name")or die(mysqli_error($conn));
                while($rowc=mysqli_fetch_assoc($sqlc))
                {?>
                <option <?php if($color==$rowc['id']){ echo 'selected';}?> value="<?php echo $rowc['id'];?>"><?php echo $rowc['name']; ?></option>
            <?php }?>
            </select>
        </div>     
    </div>

<hr>
    <div class="form-group row">
     <label>Size or Unit / Unit / Our Price / MRP / Shipping / Stock</label>
                                <!--product price stock-->
                <div class="form-group" id="demoabc">
                     <div>
                        <?php 
            $sql2=mysqli_query($conn,"select * from tbl_product_price where productId='$productid'") or die(mysqli_error($conn));
        while($row2=mysqli_fetch_assoc($sql2))
                { ?>
                    <div class="col-sm-2">
                      <input class="form-control" type="number" step="any" name="size[]" placeholder="Size / Qty" value="<?php echo $row2['psize'];?>" >
                    </div>
                    <div class="col-sm-2">
                      <select class="form-control" value="<?php echo $row2['punit'];?>" name="unit[]">
                                    <option value="<?php echo $row2['punit'];?>"><?php echo $row2['punit'];?></option>
                                    <option value='Everyone'>Everyone</option>
                                    <option value='4 to 7 years'>4 to 7 years</option>
                                    <option value='5 to 8 years'>5 to 8 years</option>
                                    <option value='5 to 9 years'>5 to 9 years</option>
                                    <option value='5 to 10 years'>5 to 10 years</option>
                                    <option value='6 to 10 years'>6 to 10 years</option>
                                    <option value='Extra Wide'>Extra Wide</option>
                                    <option value='Narrow'>Extra Narrow</option>
                                    <option value='Medium'>Medium</option>
                                    <option value='Narrow'>Narrow</option>
                                    <option value='Wide'>Wide</option>
                      </select>
                    </div>
                    <div class="col-sm-2">
                      <input class="form-control" type="number" step="any" name="price[]" placeholder="Our Price" value="<?php echo $row2['pprice'];?>" >
                    </div>
                    <div class="col-sm-2">
                      <input class="form-control" type="number" step="any" name="listprice[]" placeholder="MRP" value="<?php echo $row2['pmrp'];?>" >
                    </div>
                   
                    <div class="col-sm-2">
                      <input class="form-control" type="number" step="any" name="stock[]" placeholder="Stock" value="<?php echo $row2['pqty'];?>">
                    </div>
                    
                    <div class="col-sm-1" style="margin-bottom: 4px;">
                      <input type="button" class="btn btn-success" id="add" value="+" style="height:35px;">
                    </div>
               <?php } ?>
                   
                    </div>
                </div>

                           <!--product price stock close-->
    </div>
    <hr>
    
              
     <div class="form-group">
        <label for="name">Description</label>
        <textarea  name="txtshortdescription"  
          placeholder="enter the item description" ><?php echo $short_description;?></textarea>
     </div>
   
    
                        
                            <p>&nbsp;</p>
                                   
                <p>&nbsp;</p>
                                        <!--image section-->
                               
                            
                            <div class="form-group row">
                              
                              <div class="col-xs-3 control-label" for="name"  style="width:19%">
                                    <div id="brandimageprv1" class="img-content-size-1 common-fram ">
                                        <?php if($thumb1!=""){?>
                                        <img src="../media/product/thumb/<?php echo $thumb1?>"/>
                                        <?php }?>
                                        
                                    </div>
                                    <input class="textbox brand-img1" type="file" name="image1fleimage" id="image1id" ><br>
                                    
                                    <?php if($image1!="")
                                    { ?>
                                     <button type="button" class="btn-danger removeimage1" imageid="<?php echo $id;?>" imagename="<?php echo $image1;?>" >Delete</button>
                                <?php }
                                    else
                                    { ?>
                                        <button type="button" class="btn-danger" id="image111">Remove</button>
                                    <?php } ?>
                                    
                                    
                                   
                                </div>  

                                  <div class="col-xs-6"  style="width:39%; float: right;">
                                     <p class="text-left"><strong>Image Guidelines</strong></p>
                                        <ul>
                                            <li>Recomended image size 1400 x 470 px </li>
                                            <li>Image format must be jpg or jpeg</li>
                                            
                                        </ul>
                                  </div>
                                
                                
                            </div>
                                    <!--image section end-->
                                    <p>&nbsp;</p>
                                   <hr>
                                <p>&nbsp;</p>
                                   <!--image section-->
                               
                            
                            <div class="form-group row">

                                <div class="col-xs-3 control-label" for="name"  style="width:19%">
                                    <div id="brandimageprv2" class="img-content-size-1 common-fram ">
                                        <?php if($thumb2!=""){?>
                                        <img src="../media/product/thumb/<?php echo $thumb2?>"/>
                                        <?php }?>
                                        
                                    </div>
                                    <input class="textbox brand-img2" type="file" name="image2fleimage" id="image2id" > <br>
                                    
                                     <?php if($image2!="")
                                    { ?>
                                     <button type="button" class="btn-danger removeimage2" imageid="<?php echo $id;?>" imagename="<?php echo $image2;?>" >Delete</button>
                                <?php }
                                    else
                                    { ?>
                                        <button type="button" class="btn-danger" id="image222">Remove</button>
                                    <?php } ?>
                                     
                                </div> 

                                 <div class="col-xs-3 control-label" for="name"  style="width:19%">
                                    <div id="brandimageprv3" class="img-content-size-1 common-fram ">
                                        <?php if($thumb3!=""){?>
                                        <img src="../media/product/thumb/<?php echo $thumb3?>"/>
                                        <?php }?>
                                        
                                    </div>
                                    <input class="textbox brand-img3" type="file" name="image3fleimage" id="image3id" > <br>
                                     <?php if($image3!="")
                                    { ?>
                                     <button type="button" class="btn-danger removeimage3" imageid="<?php echo $id;?>" imagename="<?php echo $image3;?>" >Delete</button>
                                <?php }
                                    else
                                    { ?>
                                        <button type="button" class="btn-danger" id="image333">Remove</button>
                                    <?php } ?>
                                </div>  
                                
                                <div class="col-xs-3 control-label" for="name"  style="width:19%">
                                    <div id="brandimageprv4" class="img-content-size-1 common-fram ">
                                        <?php if($thumb4!=""){?>
                                        <img src="../media/product/thumb/<?php echo $thumb4?>"/>
                                        <?php }?>
                                        
                                    </div>
                                    <input class="textbox brand-img4" type="file" name="image4fleimage" id="image4id" ><br>
                                     <?php if($image4!="")
                                    { ?>
                                     <button type="button" class="btn-danger removeimage4" imageid="<?php echo $id;?>" imagename="<?php echo $image4;?>" >Delete</button>
                                <?php }
                                    else
                                    { ?>
                                        <button type="button" class="btn-danger" id="image444">Remove</button>
                                    <?php } ?>
                                </div>  

                                 <div class="col-xs-3 control-label" for="name"  style="width:19%">
                                    <div id="brandimageprv5" class="img-content-size-1 common-fram ">
                                        <?php if($thumb5!=""){?>
                                        <img src="../media/product/thumb/<?php echo $thumb5?>"/>
                                        <?php }?>
                                        
                                    </div>
                                    <input class="textbox brand-img5" type="file" name="image5fleimage" id="image5id"><br>
                                     <?php if($image5!="")
                                    { ?>
                                     <button type="button" class="btn-danger removeimage5" imageid="<?php echo $id;?>" imagename="<?php echo $image5;?>" >Delete</button>
                                <?php }
                                    else
                                    { ?>
                                        <button type="button" class="btn-danger" id="image555">Remove</button>
                                    <?php } ?>
                                </div> 

                                 <div class="col-xs-3 control-label" for="name"  style="width:19%">
                                    <div id="brandimageprv6" class="img-content-size-1 common-fram ">
                                        <?php if($thumb6!=""){?>
                                        <img src="../media/product/thumb/<?php echo $thumb6?>"/>
                                        <?php }?>
                                        
                                    </div>
                                    <input class="textbox brand-img6" type="file" name="image6fleimage" id="image6id" ><br>
                                     <?php if($image6!="")
                                    { ?>
                                     <button type="button" class="btn-danger removeimage6" imageid="<?php echo $id;?>" imagename="<?php echo $image6;?>" >Delete</button>
                                <?php }
                                    else
                                    { ?>
                                        <button type="button" class="btn-danger" id="image666">Remove</button>
                                    <?php } ?>
                                </div> 
            
                            </div>
                                    <!--image section end-->       
                                   <hr>
                                    <div>
                                        <button class="btn btn-sm btn-primary m-t-n-xs" type="submit"><strong><?php echo $btnname;?></strong></button>
                                    </div>
                                </form>

                            </div><!--panel body end-->
                            
                            
                        </div><!--hpanel end-->
                    </div><!--col-10 end-->
                   
                </div>
            </div>
            <!-- Footer-->
            <?php include'include/footer-file.php';?>
<!--select feild css-->                    
<script src="vendor/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="vendor/summernote/dist/summernote.min.js"></script>            
             <script>

    $(function () {

        // Initialize summernote plugin
        $('.summernote').summernote();

        $('.summernote1').summernote({
            toolbar: [
                ['headline', ['style']],
                ['style', ['bold', 'italic', 'underline', 'superscript', 'subscript', 'strikethrough', 'clear']],
                ['textsize', ['fontsize']],
                ['alignment', ['ul', 'ol', 'paragraph', 'lineheight']],
            ]
        });

        $('.summernote2').summernote({
            airMode: true,
        });

    });

</script>

<script src="vendor/bootstrap-touchspin/dist/jquery.bootstrap-touchspin.min.js"></script>
<script src="vendor/select2-3.5.2/select2.min.js"></script>
     <?php include'message.php';?>
 <script type="text/javascript">
        
 $(document).ready(function(){  
      var i=1;  
       
      $('#add').click(function(){  
           i++;  
    $('#demoabc').append('<div id="'+i+'"><div class="col-sm-2"><input class="form-control" type="number" step="any" name="size[]" placeholder="Size / Qty" ></div><div class="col-sm-2"><select class="form-control" name="unit[]"><option value=""> Unit</option><option value="Everyone">Everyone</option><option value="Extra Wide">Extra Wide</option><option value="Medium">Medium</option><option value="Narrow">Narrow</option><option value="Wide">Wide</option></select></div><div class="col-sm-2"><input class="form-control" type="number" step="any" name="price[]" placeholder="Our Price" ></div><div class="col-sm-2"><input class="form-control" type="number" step="any" name="listprice[]" placeholder="MRP" ></div><div class="col-sm-2"><input class="form-control" type="number" step="any" name="stock[]" placeholder="Stock"></div><div class="col-sm-1" style="margin-bottom: 4px;"><input type="button" name="remove" id="'+i+'" class="btn btn-danger btn_remove" value="-" style="height:35px;"></div></div>');   
       $('#abc').val(i); 
      });  
      $(document).on('click', '.btn_remove', function(){  
           var button_id = $(this).attr("id");   
           $('#'+button_id+'').remove();  
      });  
      
 });  
</script>


    <script>  

        $("#form_2").validate({
            rules: {
                name: {
                    required: true,
                    minlength: 3
                },
                username: {
                    required: true,
                    minlength: 5
                },
                url: {
                    required: true,
                    url: true
                },
                number: {
                    required: true,
                    number: true
                },
                last_name: {
                    required: true,
                    minlength: 6
                }
            },
            messages: {
                number: {
                    required: "(Please enter your phone number)",
                    number: "(Please enter valid phone number)"
                },
                last_name: {
                    required: "This is custom message for required",
                    minlength: "This is custom message for min length"
                }
            },
            submitHandler: function(form) {
                form.submit();
            },
            errorPlacement: function(error, element) {
                $( element )
                        .closest( "form" )
                        .find( "label[for='" + element.attr( "id" ) + "']" )
                        .append( error );
            },
            errorElement: "span",
        });


    });
</script>

    </body>
</html>

<script src="js/custum.js"></script>

MMCT - 2023