Example #1
0
include 'mainCategory.php';
include 'subCategory.php';
include 'product.php';
include 'user.php';
switch ($_GET['action']) {
    case 'listproducts':
        $product = new Product();
        $result = $product->products();
        echo json_encode($result);
        break;
    case 'editPrice':
        $product = new Product();
        $id = $_POST['id'];
        $price = $_POST['eprice'];
        $result = $product->editProductByPrice($price, $id);
        echo $result;
        break;
    case 'editQty':
        $product = new Product();
        $id = $_POST['id'];
        $qty = $_POST['qty'];
        $result = $product->editProductByQty($qty, $id);
        echo $result;
        break;
    case 'editDiscount':
        $product = new Product();
        $id = $_POST['id'];
        $discount = $_POST['ediscount'];
        $result = $product->editProductByDiscount($discount, $id);
        echo $result;