jonah Posted January 27, 2003 Share Posted January 27, 2003 I am in the process of setting up my store and I have a few items that can only be purchased in minimum quantities. Does anyone know of a way that I can accomplish this? A contribution? For example: 6 Pcs Carpenters Pencils has a minimum quantity of 6units. I know that I could just change the description to read 36pcs, but what if someone wanted to order 42? Hope this makes sense. Thanks in advance for any help. Link to comment Share on other sites More sharing options...
mugitty Posted January 27, 2003 Share Posted January 27, 2003 Is minimum of 6 units or multiples of 6? If it's multiples of 6, just create your description so it reads that way and set your pricing to the value for 6 pencils, treated as '1' selling unit. ... if you want to REALLY see something that doesn't set up right out of the box without some tweaking, try being a Foster Parent! Link to comment Share on other sites More sharing options...
jonah Posted January 27, 2003 Author Share Posted January 27, 2003 I didn't think I was very clear in my description. Let me try again. 1 unit would be 6 pencils. Minimum quantity would be 6 units (36 pencils). what I need to do is to be able to set a minimum of 6, but from there be able to go up in increments of one. For Example: 1 Unit not allowed (6 Pencils) 2 Units not allowed (12 Pencils) 3 Units not allowed (18 Pencils) 4 Units not allowed (24 Pencils) 5 Units not allowed (30 Pencils) 6 Units (36 Pencils) 7 Units (42 Pencils) 8 Units (48 Pencils) etc................. Hope this makes more sense. Link to comment Share on other sites More sharing options...
mugitty Posted January 27, 2003 Share Posted January 27, 2003 This might be an awkward way to handle it, but you could set the item up as your minimum (6x6pieces) and then add attributes to it for additional units of 6 pieces: Item #123 36 Carpenter pencils $18.00 (6 packages of 6) attributes: +1 package of six +$3.00 +2 packages of 6 +6.00 etc... Other than that, the only other minimum that comes to mind would be site wide, so you probably don't want that. ... if you want to REALLY see something that doesn't set up right out of the box without some tweaking, try being a Foster Parent! Link to comment Share on other sites More sharing options...
Guest Posted October 14, 2003 Share Posted October 14, 2003 B) I think I have just accomplished what lots of people have been after if anyone would like the code? I'm selling software and want to sell multi-licence packages (51-100 users, 101-200 users, etc, etc). I decided the best way was for me to sell 1-50 versions, 51-100 versions, 101-200 versions as seperate products. Some may argue that this is perhaps not the best way but that's not the issue. This is... The obvious problem I had was that there was nothing to stop a user buying 3 of the 51-100 user product, so I devised a way to error check this on the product_info.php page before it's even allowed to be added to the cart. Now I'm not a programmer (in fact I'm a bit of a novice), but this is what I did step by step: 1) I created 2 new fields in the product database (quantity_high, quantity_low) 2) Then I modified categories.php in the admin section to input these 2 new fields to the database. 3) Once I was sure that was working I simply echoed these variables to the product_info page to make sure it was bringing the correct values in. <?php echo $product_info_values['quantity_high']; ?> <?php echo $product_info_values['quantity_low']; ?> 4) For the next step I modified my quantity box to have the minimum quantity as it's initial value: <input type="text" name="cart_quantity" value="<?php echo $product_info_values['quantity_low']; ?>" onFocus="this.value='<?php echo $product_info_values['cart_quantity']; ?>'" maxlength="4" size="4"> This looks good as when the user views a 51-100 user product they see 51 already in the box. 5) Next I found basic javascript validation script and modified it to my needs. This validation runs on the submit of the form. The script must be placed WITHIN the <form> tag of cart_quantity and AFTER the select statement where all the values of the individual product are read from the database, otherwise the variables have no value. The script is as follows: <script language="JavaScript" type="text/javascript"> function validateFields() { if (document.cart_quantity.cart_quantity.value > <?php echo $product_info_values['quantity_high']; ?> ) { alert('That quantity is too high for this product'); return false; } if (document.cart_quantity.cart_quantity.value < <?php echo $product_info_values['quantity_low']; ?>) { alert('That quantity is too low for this product'); return false; } if (document.cart_quantity.cart_quantity.value == "") { alert('Please enter an amount'); return false; } return true; } </script> This checks if the amount is too high, too low, or is nothing at all. 6) Finally, to execute this script you must place this little bit of code on the opening <form> tag line: onsubmit="return validateFields();" So my line reads: <form name="cart_quantity" method="post" action="<?php echo tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product', 'NONSSL'); ?>" onsubmit="return validateFields();"> That's it! Works like a dream for me. If it doesn't for you then I'm sorry, I'm not expert enough to perhaps know why. I'm using 2.2 MS1 Let me know how you get on! Cheers Neil Link to comment Share on other sites More sharing options...
kagg Posted October 15, 2003 Share Posted October 15, 2003 There is a quantity price break per product contribution: http://www.oscommerce.com/community/contributions,1242 It allows: 1) Quantity pricing per product (currently 4 price break levels) 2) Ability to force products to be sold in lots of # quantity. (The shopping cart will enforce this). Link to comment Share on other sites More sharing options...
themutantchair Posted December 27, 2003 Share Posted December 27, 2003 Well, it took me around 6-8 hours to set up with my meagre programming skills, but I've got it! I also made an addition so that if they already have, say 4 items in their cart when the minimum is 4, they can still add one or 2 more. I'm very happy. Thanks :D Link to comment Share on other sites More sharing options...
NetBeing Posted January 29, 2004 Share Posted January 29, 2004 B) I think I have just accomplished what lots of people have been after if anyone would like the code? I'm selling software and want to sell multi-licence packages (51-100 users, 101-200 users, etc, etc). I decided the best way was for me to sell 1-50 versions, 51-100 versions, 101-200 versions as seperate products. Some may argue that this is perhaps not the best way but that's not the issue. This is... The obvious problem I had was that there was nothing to stop a user buying 3 of the 51-100 user product, so I devised a way to error check this on the product_info.php page before it's even allowed to be added to the cart. Now I'm not a programmer (in fact I'm a bit of a novice), but this is what I did step by step: 1) I created 2 new fields in the product database (quantity_high, quantity_low) 2) Then I modified categories.php in the admin section to input these 2 new fields to the database. 3) Once I was sure that was working I simply echoed these variables to the product_info page to make sure it was bringing the correct values in. <?php echo $product_info_values['quantity_high']; ?> <?php echo $product_info_values['quantity_low']; ?> 4) For the next step I modified my quantity box to have the minimum quantity as it's initial value: <input type="text" name="cart_quantity" value="<?php echo $product_info_values['quantity_low']; ?>" onFocus="this.value='<?php echo $product_info_values['cart_quantity']; ?>'" maxlength="4" size="4"> This looks good as when the user views a 51-100 user product they see 51 already in the box. 5) Next I found basic javascript validation script and modified it to my needs. This validation runs on the submit of the form. The script must be placed WITHIN the <form> tag of cart_quantity and AFTER the select statement where all the values of the individual product are read from the database, otherwise the variables have no value. The script is as follows: <script language="JavaScript" type="text/javascript"> function validateFields() { if (document.cart_quantity.cart_quantity.value > <?php echo $product_info_values['quantity_high']; ?> ) { alert('That quantity is too high for this product'); return false; } if (document.cart_quantity.cart_quantity.value < <?php echo $product_info_values['quantity_low']; ?>) { alert('That quantity is too low for this product'); return false; } if (document.cart_quantity.cart_quantity.value == "") { alert('Please enter an amount'); return false; } return true; } </script> This checks if the amount is too high, too low, or is nothing at all. 6) Finally, to execute this script you must place this little bit of code on the opening <form> tag line: onsubmit="return validateFields();" So my line reads: <form name="cart_quantity" method="post" action="<?php echo tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product', 'NONSSL'); ?>" onsubmit="return validateFields();"> That's it! Works like a dream for me. If it doesn't for you then I'm sorry, I'm not expert enough to perhaps know why. I'm using 2.2 MS1 Let me know how you get on! Cheers Neil I found this is a very important piece of information for an wholesale environment site. But I have no clue how to apply this MINIMUM QTY per item to a MS2 with STS loaded? Anybody who can help? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.