1and1 Help Centre Categories

print article

What is the rule to allow only certain quantities to be ordered?

You can determine the quantity of items that can be ordered. For eg., items can be
ordered in the multiples of 4. (4, 8, 12 etc)

You need to write the following rule. (Items -> New/Edit -> Next -> Rule (valid PHP-
Scriptcode, double quotes are not permitted!) for this item. Check FAQ Where to enter Item Rules?

$units = 4;
if(article_get_field('count') % $units != 0) {
article_set_field('HIDE_ORDERBUTTON', TRUE);
article_set_field('hint','Please choose a multiple of '.$units.' as the quantity');
} else {
article_set_field('HIDE_ORDERBUTTON', FALSE);

Please note:
A customer can only order items in multiples of 4. The order button during the final checkout (along with other items in the basket) will disappear if the quantity is not in the multiples of 4 and a message is displayed.