The minimum order module download that Sunabac posted seems to be working for me, but it's true that this mod is based on the total order price, rather than quantity.
That said, if you download and have a look at its code, it's a really simple mod. So if you don't mind hard-coding your minimum quantity, don't even install the mod, just have a look at the file here:
includes/templates/yourtemplate/templates/tpl_shopping_cart_default.php
Diff'ing his version to the standard version, I figured out I needed to add this section at line 51 (right after <?php } //endif flagAnyOutOfStock ?>):
Then, lower in the same file, starting at line 132 (right after <!--bof shopping cart buttons-->), replace this section of code:Code:<?php // BOF MIN ORDER AMOUNT if ($_SESSION['cart']->count_contents() < 12) {?> <div class="messageStackError"><?php echo sprintf('You must have at least 12 items in your cart to checkout.'); ?></div> <?php }// EOF MIN ORDER AMOUNT ?>
With a wrapped version that also checks for the cart's quantity:Code:<div class="buttonRow forward"><?php echo '<a href="' . zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . zen_image_button(BUTTON_IMAGE_CHECKOUT, BUTTON_CHECKOUT_ALT) . '</a>'; ?></div>
Obviously change the error message and number 12 to whatever your minimum quantity really is.Code:<?php // BOF MIN ORDER AMOUNT if ($_SESSION['cart']->count_contents() >= 12) {?> <div class="buttonRow forward"><?php echo '<a href="' . zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . zen_image_button(BUTTON_IMAGE_CHECKOUT, BUTTON_CHECKOUT_ALT) . '</a>'; ?></div> <?php }// EOF MIN ORDER AMOUNT ?>
This is my first foray into ZenCart hacking, but if I'm feeling really ambitious maybe I'll repackage this mod into one that does this quantity check automagically.
BTW, very nicely customized wine shop cosmicomic, you wouldn't know it's ZC...
Also, thanks to Ajeh and the ZC team, this is really impressive stuff. While I hope the admin section gets a usability overhaul sooner rather than later, you can't beat the ability to customize!



