PDA

View Full Version : Minimum order.


belick1
October 30th, 2003, 09:48 PM
I would like to know if there is a way to make a minimum order.

Thanks

Jamie
October 30th, 2003, 11:39 PM
There is no built in way to do this. Try this:

Replace the contents of your "squirrelcart/address_info.php" file with the following:


<?
$min_order_amt = 50.00;
$min_order_amt = number_format($min_order_amt,2);
$currency_sym = $SESSION['currency'];
if ($shipping_info && $SESSION['order']['number_of_items']) {

if ($SESSION['order']['product_total'] < $min_order_amt) {
print "<div class=\"action_msg\"><br><br>I'm sorry, but we have a minimum order amount of $currency_sym$min_order_amt, and your order total is currently $currency_sym".$SESSION['order']['product_total']."<br><br><br></div>";
} else {
$force_user_creation = get_field_val("Store_Information","Force_User_Creation","record_number=1");
if ($force_user_creation && !$SESSION['user']) {
$return = "show_cart";
add_user();
} else {
address_info();
}
}
}
?>


Change the amount in the first line to reflect your minimum order amount.

Thanks,
Jamie

belick1
November 3rd, 2003, 01:00 PM
this file is not there, the only file I have is squirrelcart/functions/address_info.func.

Jamie
November 3rd, 2003, 04:04 PM
It sounds like you are running v1.1.0. That file was "squirrelcart/shipping_info.php" in that version. If you have that file, replace it with this instead:

<?
$min_order_amt = 50.00;
$min_order_amt = number_format($min_order_amt,2);
$currency_sym = $SESSION['currency'];
if ($shipping_info && $SESSION['order']['number_of_items']) {
if ($SESSION['order']['product_total'] < $min_order_amt) {
print "<div class=\"action_msg\"><br><br>I'm sorry, but we have a minimum order amount of $currency_sym$min_order_amt, and your order total is currently $currency_sym".$SESSION['order']['product_total']."<br><br><br></div>";
} else {
$force_user_creation = get_field_val("Store_Information","Force_User_Creation","record_number=1");
if ($force_user_creation && !$SESSION['user']) {
$return = "show_cart";
add_user();
} else {
shipping_info();
}
}
}
?>

-Jamie