0

我需要将购物车的最低金额设置为 20 美元才能继续结帐。这是我的代码请帮忙

$cartOutput = "";<br />
$cartTotal = "";<br />
$minim = "20";<br />
$pp_checkout_btn = '';<br />
$product_id_array = '';<br />

setlocale(LC_MONETARY, "en_US");<br />
$cartTotal = money_format("%10.2n", $cartTotal);<br />
$minim = money_format("%10.2n", $minim);<br />


// Finish the  Checkout Btn

if ($cartTotal > $minim )<br />{<br />
     $pp_checkout_btn .=<br />'<form>
    <input type="hidden" name="custom" value="' . $product_id_array . '" accept-charset="UTF-8">
    <input type="hidden" name="notify_url" value="https://www.com//.php">
    <input type="hidden" name="return" value="https://www.gogrocerycart.com/checkout_complete.php">
    <input type="hidden" name="rm" value="2">
    <input type="hidden" name="cbt" value="Return to The Store">
    <input type="hidden" name="cancel_return" value="https://www.gogrocerycart.com/paypal_cancel.php">
    <input type="hidden" name="lc" value="US" accept-charset="UTF-8">
    <input type="hidden" name="currency_code" value="USD">
    <input type="image" align="right" src="http://www.com/en_US/i/btn/x-click-but01.gif" name="submit" alt="Make payments with  - its fast, free and secure!">
    </form>';
}else{<br />
     $pp_checkout_btn .= "A minimum of ". $minim ." is required ";
}
}
4

2 回答 2

0

对我来说有点专业。我只是用 zencart 打开我的网站http://www.hvgbuilding.com/

于 2013-07-18T02:46:39.373 回答
0

您正在比较两个字符串。您需要在money_format检查$cartTotal > $minimum或声明另外两个字符串(“格式化”值)之后转换字符串()

$cartOutput = "";
$cartTotal = 0;
$minim = 20.00;
$pp_checkout_btn = '';
$product_id_array = '';

setlocale(LC_MONETARY, "en_US");
$cartTotalFormatted = money_format("%10.2n", $cartTotal);
$minimFormatted = money_format("%10.2n", $minim);

// Finish the Checkout Btn
if ($cartTotal > $minim )
{
  $pp_checkout_btn .= ' ';
} else {
  $pp_checkout_btn .= "A minimum of ". $minimFormatted ." is required "; 
}
于 2013-07-01T19:36:54.237 回答