Oslo Posted June 20, 2004 Posted June 20, 2004 Hi there i am creating a wine site and the customer must order by the dozen or they can mix and match but it must equal a dozen how do i do this so that if it is less than 12 it will come up with a warning "must be a dozen" Your help would be much appreciated. Cheers Enrico Quote
John Doswell Posted June 21, 2004 Posted June 21, 2004 i am not an expert but looking at the min order amount constributions By Dave Latham This contribution is my very first. I think im getting the hang of it now. The idea here is that you may wish to specify a minimum order ammount per product. My osCommerce site will be selling fabrics. The minimum order length for us is 5meters. This little snippet here will check to see if the value of "quantity" for each product in the cart is less than 5. If this is the case a javascript alert will inform the customer of the min order length and the quantity will be changed before displaying the cart. To install all you need to do is insert this block of code at around in file Catalog/shopping_cart.php line 144 ********LOOK FOR THE FOLLOWING while (list($option, $value) = each($products[$i]['attributes'])) { $products_name .= '<br><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>'; } } $products_name .= ' </td>' . ' </tr>' . '</table>'; *********INSERT THE FOLLOWING AFTER THE ABOVE /*----------------MAKE SURE QUANTITY IS NEVER LESS THAN 5------------------*/ if ($products[$i]['quantity'] < 5 ) { $products[$i]['quantity']=5; echo '<script language="javascript">alert ("Minimum order length is 5m.\nYour cart has been updated to reflect this.");</script>'; } /*-----------------MIN QUANTITY EOF--------------------------*/ i would try to change /*----------------MAKE SURE QUANTITY IS NEVER LESS THAN 5------------------*/ if ($products[$i]['quantity'] < 5 ) { $products[$i]['quantity']=5; echo '<script language="javascript">alert ("Minimum order length is 5m.\nYour cart has been updated to reflect this.");</script>'; } } /*-----------------MIN QUANTITY EOF--------------------------*/ so something like /*----------------MAKE SURE QUANTITY IS NEVER LESS THAN 5------------------*/ for ($i=0, $n=sizeof($products); $i<$n; $i++) { if ($products[$i]['quantity'] < 12 ) { $products[$i]['quantity']=12; echo '<script language="javascript">alert ("Minimum order length is 12 in a box.\nYour cart has been updated to reflect this.");</script>'; } } /*-----------------MIN QUANTITY EOF--------------------------*/ i am no expert and its not tested, also the other file would need changing. john Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.