function cate_parent($data, $parent = 0, $str = "--", $select = 0) { foreach ($data as $val) { $id = $val["id"]; $name = $val["name"]; if ($val["prarent_id"] == $parent) { if ($select != 0 && $id == $select) { echo "<option value='{$id}' selected='selected'>{$str} {$name}</option>"; } else { echo "<option value='{$id}'>{$str} {$name}</option>"; } cate_parent($data, $id, $str . "--", $select); } } }
function cate_parent($data, $parent = 0, $str = "", $select = 0) { foreach ($data as $key => $value) { $id = $value['id']; $name = $value["name"]; if ($value["department_id"] == $parent) { if ($select != 0 && $id == $select) { echo "<option value='{$id}' selected='selected'>{$str} {$name}</option>"; } else { echo "<option value='{$id}'>{$str} {$name}</option>"; } cate_parent($data, $id, $str . " --"); } } }
function cate_parent($data, $parent = 0, $str = '--', $select = 0) { foreach ($data as $key => $val) { $id = $val['id']; $name = $val['name']; if ($val['parent_id'] == $parent) { if ($select != 0 && $id == $select) { echo "<option value='{$id}' selected>{$str} {$name}</option>"; } else { echo "<option value='{$id}'>{$str} {$name}</option>"; } cate_parent($data, $id, $str . '--', $select); } } }
function cate_parent($data, $parent = 0, $str = "--", $select = 0) { foreach ($data as $category) { //echo "<option class='' value=".$category['id'].">".$category['cate_name']."</option>"; $id = $category['id']; $cate_name = $category['cate_name']; if ($category['parent_id'] == $parent) { if ($select != 0 && $id == $select) { echo "<option class='' value='{$id}' selected='selected'>{$str} {$cate_name}</option>"; } else { echo "<option class='' value='{$id}'>{$str} {$cate_name}</option>"; } cate_parent($data, $id, $str . "--"); } } }
<legend>Add New Cate Now</legend> <div class="form-group"> <select class="form-control" name="txtCatetype"> @foreach($catetype as $type) <option value="{!! $type['id'] !!}">{!! $type['name'] !!}</option> @endforeach </select> </div> <div class="form-group"> <select class="form-control" name="txtParent"> <option value="0">Please Choose Category</option> <?php cate_parent($parent); ?> </select> </div> <div class="form-group"> <label for="">Cate Name</label> <input type="text" class="form-control" id="" placeholder="Input Name" name="txtName"> </div> <div class="form-group"> <label for="">Order</label> <input type="text" class="form-control" id="" placeholder="Input Order" name="txtOrder"> </div> <div class="form-group"> <label for="">keywords</label> <input type="text" class="form-control" id="" placeholder="Input Keyword" name="txtKeywords"> </div>
<h1 class="page-header">Product <small>Edit</small> </h1> </div> @include('admin.block.error') <!-- /.col-lg-12 --> <form action="" method="POST" name="frmEditProduct" enctype="multipart/form-data"> <div class="col-lg-7" style="padding-bottom:120px"> <input type="hidden" name="_token" value="{!! csrf_token()!!}"> <div class="form-group"> <label>Category</label> <select class="form-control" name="sltParent"> <option value="">Please Choose Category</option> <?php cate_parent($cate, 0, "", $product['cate_id']); ?> </select> </div> <div class="form-group"> <label>Name</label> <input class="form-control" name="txtName" placeholder="Please Enter Product's Name" value="{!! old('txtName',isset($product)? $product['name'] :null)!!}" /> </div> <div class="form-group"> <label>Alias</label> <input class="form-control" name="txtAlias" placeholder="Please Enter Alias" value="{!! old('txtAlias',isset($product)? $product['alias'] :null)!!}"/> </div> <div class="form-group"> <label>Price</label> <input class="form-control" name="txtPrice" placeholder="" value="{!! old('txtPrice',isset($product)? $product['price'] :null)!!}"/> </div>
<!-- left column --> <div class="col-md-12"> @include ('backend.blocks.error') <!-- general form elements --> <div class="box box-primary"> <!-- form start --> <form role="form" class="form-horizontal" method="post" action="" enctype="multipart/form-data"> <input type="hidden" name="_token" value="{!! csrf_token() !!}" /> <div class="box-body"> <div class="form-group"> <label for="exampleInputEmail1" class="col-md-2">Danh mục</label> <div class="col-md-10"> <select class="form-control" name="parentid"> <option>Mời bạn chọn</option> <?php cate_parent($cate); ?> </select> </div> </div> <div class="form-group"> <label for="txtten" class="col-md-2">Tên sản phẩm</label> <div class="col-md-10"> <input type="text" class="form-control" name="txtten" placeholder="Tên sản phẩm..." value="{!! old('txtten') !!}"> </div> </div> <div class="form-group"> <label for="txtgia" class="col-md-2">Giá</label> <div class="col-md-10"> <input type="text" class="form-control" name="txtgia" placeholder="Giá sản phẩm..." value="{!! old('txtgia') !!}"> </div>
<!-- left column --> <div class="col-md-12"> @include ('backend.blocks.error') <!-- general form elements --> <div class="box box-primary"> <!-- form start --> <form role="form" class="form-horizontal" method="post" action=""> <input type="hidden" name="_token" value="{!! csrf_token() !!}" /> <div class="box-body"> <div class="form-group"> <label for="exampleInputEmail1" class="col-md-2">Danh mục</label> <div class="col-md-8"> <select class="form-control" name="parentId"> <option value="0">Mời bạn chọn</option> <?php cate_parent($parent, 0, "--", $data["prarent_id"]); ?> </select> </div> </div> <div class="form-group"> <label for="exampleInputEmail1" class="col-md-2">Tiêu đề</label> <div class="col-md-8"> <input type="text" class="form-control" name="txtTieude" placeholder="Tiêu đề..." value="{!! old ('txtTieude',isset($data)?$data["name"]:"") !!}"> </div> </div> <div class="form-group"> <label for="exampleInputEmail1" class="col-md-2">Thứ tự</label> <div class="col-md-8"> <input type="text" class="form-control" name="txtThutu" placeholder="Thứ tự..." value="{!! old ('txtThutu',isset($data)?$data["order"]:"") !!}"> </div>
value="{!! old('cate_name',isset($data) ? $data['cate_name'] : null) !!}"> </div> <div class="form-group"> <label for="cate_name">Slug</label> <input type="text" class="form-control" id="slug" name="slug" placeholder="Please enter category name." value="{!! old('slug',isset($data) ? $data['slug'] : null) !!}"> </div> <div class="form-group"> <div class=" form-group"> <label for="parent" class=" control-label">Parent ID</label> {{--<div class="col-sm-10">--}} <select class=" col-sm-6 form-control " id="parent" name="parent_id"> <option value="0">Please choose category</option> <?php cate_parent($categories, 0, "--", $data['parent_id']); ?> </select> {{--</div>--}} </div> </div> <div class="form-group"> <lable for="oder">Oder</lable> <input type="number" id="oder" name="oder" placeholder="Please choose oder." value="{!! old('oder',isset($data) ? $data['oder'] : null) !!}"> </div> <div class="form-group"> <button type="submit" class="btn btn-default">Save</button> </div> {!! Form::close() !!}
<label for="cate_name">Category Name</label> <input type="text" class="form-control" id="name" name="cate_name" placeholder="Please enter category name." onkeyup="ChangeToSlug();"> </div> <div class="form-group"> <label for="cate_name">Slug</label> <input type="text" class="form-control" id="slug" name="slug" placeholder="Please enter category name."> </div> <div class="form-group"> <div class=" form-group"> <label for="parent" class=" control-label">Parent ID</label> {{--<div class="col-sm-10">--}} <select class=" col-sm-6 form-control " id="parent" name="parent_id"> <option value="0">Please choose category</option> <?php cate_parent($categories); ?> </select> {{--</div>--}} </div> </div> <div class="form-group"> <lable for="oder">Oder</lable> <input type="number" id="oder" name="oder" placeholder="Please choose oder."> </div> <div class="form-group"> <button type="submit" class="btn btn-default">Save</button> </div> {!! Form::close() !!}
<div class="row"> <!-- left column --> <div class="col-md-12"> @include ('backend.blocks.error') <!-- general form elements --> <div class="box box-primary"> <!-- form start --> <input type="hidden" name="_token" value="{!! csrf_token() !!}" /> <div class="box-body"> <div class="form-group"> <label for="exampleInputEmail1" class="col-md-2">Danh mục</label> <div class="col-md-10"> <select class="form-control" name="parentid"> <option>Mời bạn chọn</option> <?php cate_parent($category, 0, "--", $product["cate_id"]); ?> </select> </div> </div> <div class="form-group"> <label for="txtten" class="col-md-2">Tên sản phẩm</label> <div class="col-md-10"> <input type="text" class="form-control" name="txtten" placeholder="Tên sản phẩm..." value="{!! old ('txtten',isset($product)?$product["name"]:"") !!}"> </div> </div> <div class="form-group"> <label for="txtgia" class="col-md-2">Giá</label> <div class="col-md-10"> <input type="text" class="form-control" name="txtgia" placeholder="Giá sản phẩm..." value="{!! old('txtgia',isset($product)?$product["price"]:"") !!}"> </div>
<div class="col-lg-12"> <h1 class="page-header">Category <small>Edit</small> </h1> </div> <!-- /.col-lg-12 --> <div class="col-lg-7" style="padding-bottom:120px"> @include('admin.block.error') <form action="" method="POST"> <input type="hidden" name="_token" value="{!! csrf_token()!!}" /> <div class="form-group"> <label>Category Parent</label> <select class="form-control" name="sltParent"> <option value="0">Please Choose Category</option> <?php cate_parent($parent, 0, "", $data['parent_id']); ?> </select> </div> <div class="form-group"> <label>Category Name</label> <input class="form-control" name="txtCateName" placeholder="Please Enter Category Name" value="{!! old('txtCateName',isset($data)? $data['name'] :null)!!}" /> </div> <div class="form-group"> <label>Category Order</label> <input class="form-control" name="txtOrder" placeholder="Please Enter Category Order" value="{!! old('txtOrder',isset($data)? $data['order'] :null)!!}" /> </div> <div class="form-group"> <label>Category Keywords</label> <input class="form-control" name="txtKeywords" placeholder="Please Enter Category Keywords" value="{!! old('txtKeywords',isset($data)? $data['keywords'] :null)!!}"/> </div>
<!-- general form elements --> <div class="box box-primary"> <div class="box-header with-border"> <h3 class="box-title">Quick Example</h3> </div><!-- /.box-header --> <!-- form start --> <form role="form" class="form-horizontal" method="post" action="{!! route('admin.category.getAdd')!!}"> <input type="hidden" name="_token" value="{!! csrf_token() !!}" /> <div class="box-body"> <div class="form-group"> <label for="exampleInputEmail1" class="col-md-2">Danh mục</label> <div class="col-md-8"> <select class="form-control" name="parentId"> <option value="0">Mời bạn chọn</option> <?php cate_parent($data); ?> </select> </div> </div> <div class="form-group"> <label for="exampleInputEmail1" class="col-md-2">Tiêu đề</label> <div class="col-md-8"> <input type="text" class="form-control" name="txtTieude" placeholder="Tiêu đề..." value="{!! old('txtTieude') !!}"> </div> </div> <div class="form-group"> <label for="exampleInputEmail1" class="col-md-2">Thứ tự</label> <div class="col-md-8"> <input type="text" class="form-control" name="txtThutu" placeholder="Thứ tự..." value="{!! old('txtThutu') !!}"> </div>