Beispiel #1
0
     break;
 case 'listCat':
     # code...
     $mainCategory = new MainCategory();
     $data = $mainCategory->getMainCategory();
     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;