2017-02-10 60 views
-2

如何在定製電子商務中的數量交叉15後在基準價格中應用5%的折扣。購物車價按數量折扣

代碼:

$price = $_POST['price']; 
$quantity = $_POST['quantity']; 
$discount = $_POST['discount']; 
$tax = $_POST['tax']; 
$shipping = $_POST['shipping']; 
$payments = $_POST['payments']; 

$total = (($price * $quantity) + $shipping) - $discount; 
+0

我們看一些代碼.. – JustBaron

+0

我可以與大家分享這個文件,你會請提供我您的電子郵件ID –

+1

不,你沒事的感謝。只需在您的問題中發佈一些示例代碼,並使用您已經嘗試的代碼。 – JustBaron

回答

-2
$price = mysqli_real_escape_string($conn , $_POST['price']); 
    $quantity =mysqli_real_escape_string($conn , $_POST['quantity']); 

    if ($quantity > 15) 
    { 
     $discount = ($price/100)*5; 
     $price = $price - $discount; 
    } 

    else 
    { 
     $price = $price; 
    } 
+0

謝謝你很多人 –

+0

@RajatKumar請選擇這個答案作爲答案。 –