Esempio n. 1
0
 private function mainCategorySeeder()
 {
     $mainCategory = [["name" => "ข้อมูลทั่วไปกว๊านพะเยา"], ["name" => "นิเวศวิทยาและสิ่งแวดล้อม"], ["name" => "เศรษฐกิจและการท่องเที่ยว"], ["name" => "การจัดการทรัพยากรธรรมชาติ"], ["name" => "ประวัติศาสตร์และวัฒนธรรม"]];
     $mainCategoryArray = [];
     foreach ($mainCategory as $m) {
         $mc = new MainCategory();
         $mc->fill($m);
         $mc->save();
         array_push($mainCategoryArray, $mc);
     }
     $this->mainCategories = $mainCategoryArray;
 }
 public function updateOrder(array $input)
 {
     foreach ($input as $c) {
         $id = $c['id'];
         $order = $c['order'];
         /* @var $category MainCategory */
         $category = MainCategory::find($id);
         $category->order = $order;
         $category->save();
     }
     return [true];
 }
Esempio n. 3
0
 public function delete(array $input)
 {
     /* @var $category Category */
     $category = Category::find($input['id']);
     $mid = $category->parent()->first();
     if ($mid != null) {
         $mmid = $mid->id;
         $mainCat = MainCategory::find($mmid);
         $mainCat->categories()->detach($category->id);
     }
     $category->delete();
     return $category;
 }
Esempio n. 4
0
 function __construct($id = -1)
 {
     if (self::$conn == Null) {
         self::$conn = mysqli_connect('localhost', 'root', 'iti', 'clothes_shop');
     }
     if ($id != -1) {
         $query = "select * from category where id={$id} limit 1";
         $result = mysqli_query(self::$conn, $query);
         $mainCategory = mysqli_fetch_assoc($result);
         $this->id = $mainCategory['id'];
         $this->type = $mainCategory['type'];
     }
 }
Esempio n. 5
0
     echo json_encode($data);
     break;
 case 'listSubCat':
     # code...
     $mainCategory = new MainCategory();
     $mainCategory->type = $_POST['type'];
     $result = $mainCategory->getIdCategory();
     $cat_id = $result['id'];
     $subCategory = new SubCategory();
     $subCategory->category_id = $cat_id;
     $data = $subCategory->getSubCatByMainCat();
     echo json_encode($data);
     break;
 case 'addProduct':
     # code...
     $mainCategory = new MainCategory();
     $mainCategory->type = $_POST['typeMain'];
     $result = $mainCategory->getIdCategory();
     $cat_id = $result['id'];
     $subCategory = new SubCategory();
     $subCategory->category_id = $cat_id;
     $subCategory->type = $_POST['typeSub'];
     $res = $subCategory->getSubCatId();
     $idSub = $res['id'];
     $product = new Product();
     $product->sub_id = $idSub;
     $product->material = $_POST['material'];
     $product->qty = $_POST['qty'];
     $product->price = $_POST['price'];
     $product->color = $_POST['color'];
     $product->size = $_POST['size'];
 public function postCreateCategory($id)
 {
     $input = Input::all();
     $input['parent'] = MainCategory::find($id)->toArray();
     $this->categoryService->save($input);
 }
Esempio n. 7
0
<?php

session_start();
include 'mainCategory.php';
$Category = new MainCategory();
include 'order.php';
$order = new Order();
include 'user.php';
$user = new User();
?>
<!DOCTYPE html>
<html>
<head>
<title>New Store A Ecommerce Category | Home</title>
<link href="css/bootstrap.css" rel="stylesheet" type="text/css" media="all" />
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/register_validation.js"></script>
<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
<link rel="stylesheet" type="text/css" href="css/P.css">	
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="New Store Responsive web template, Bootstrap Web Templates, Flat Web Templates, Andriod Compatible web template, 
Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyErricsson, Motorola web design" />
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
<link href="css/memenu.css" rel="stylesheet" type="text/css" media="all" />
<link href="css/admin.css" rel="stylesheet" type="text/css" media="all" />
<script type="text/javascript" src="js/memenu.js"></script>
<script type="text/javascript" src="js/myquery.js"></script>
<script>$(document).ready(function(){$(".memenu").memenu();});</script>
 <!--<script src="js/simpleCart.min.js"> </script>-->