コード例 #1
0
ファイル: controller.php プロジェクト: salmgazer/Agrashop
function addSale()
{
    include_once "../model/Sale.php";
    $product_id = $_REQUEST['product_id'];
    $product_price = $_REQUEST['product_price'];
    $quantity_sold = $_REQUEST['quantity_sold'];
    $total_cost = $_REQUEST['total_cost'];
    $buyer_phone = $_REQUEST['buyer_phone'];
    $seller_username = $_SESSION['username'];
    $mysale = new Sale();
    if (!$mysale->addSale($product_id, $product_price, $quantity_sold, $total_cost, $buyer_phone, $seller_username)) {
        echo '{"result": 0, "message": "Could not add sale"}';
        return;
    }
    echo '{"result": 1, "message": "Sale has been recorded"}';
    return;
}