Leo Clark Posted January 9, 2016 Share Posted January 9, 2016 Hello there,Is there an easy way to have the product quantity field filled with minimum quantity?I have attached an image to make it clear.The field would come with a 10 instead of 1 in this example.Thanks. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted January 9, 2016 Share Posted January 9, 2016 It's not something I've ever used, but there is a check box on the Pricing tab of each product listing where you can mark a minimum quantity. Are you saying you marked that, and it does not work? Quote Link to comment Share on other sites More sharing options...
Leo Clark Posted January 9, 2016 Author Share Posted January 9, 2016 Hi @Dirty Butter ! Yes, it works fine. I just thought it would be a good thing to have the field pre-filled with the minimum quantity instead of "1". Does that make sense? Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted January 9, 2016 Share Posted January 9, 2016 I agree with you, @Leo Clark. If that is marked as the minimum of 10, it seems that should be what shows to the customer, without having to get the error message reminder. Quote Link to comment Share on other sites More sharing options...
bsmither Posted January 9, 2016 Share Posted January 9, 2016 Please try this:In content.product.php (Foundation), find: {if $PRODUCT.available lte 0} <div class="small-12 columns"> <input type="submit" value="{$LANG.common.unavailable}" class="button small disabled expand marg-top" disabled> </div> {else} <div class="medium-2 columns show-for-medium-up"> <input type="text" name="quantity" value="1" class="quantity required text-center"> <input type="hidden" name="add" value="{$PRODUCT.product_id}"> </div> <div class="small-12 medium-10 columns"> <button type="submit" value="{$LANG.catalogue.add_to_basket}" class="button postfix">{$LANG.catalogue.add_to_basket}</button> </div> {/if} This statement: <input type="text" name="quantity" value="1" class="quantity required text-center"> Change to: <input type="number" name="quantity" value="{if !$PRODUCT.minimum_quantity}1{else}{$PRODUCT.minimum_quantity}{/if}" min="{if !$PRODUCT.minimum_quantity}1{else}{$PRODUCT.minimum_quantity}{/if}" class="quantity required text-center">This uses an HTML5 form element type of "number" (not available in IE9 and earlier). So, if the product's minimum quantity is not set or defaulted to zero, then use '1'. Otherwise, preload the number element with the minimum quantity and do not allow the spinner to let the number go below that (or '1').I have not make extensive tests. It could be that the form validations may have a problem because this form element is no longer a textbox. But manually entering, for example, '-3', I get a red validation error. I do not know where it comes from, however.And this only covers the View Product page. More work would need to be done wherever else there is the opportunity to add the product to the shopping basket or change the quantity - during checkout, for example. The minimum quantity parameter of a product is relatively new. I have not yet discovered what happens if minimum quantity is higher than available stock. Quote Link to comment Share on other sites More sharing options...
Leo Clark Posted January 10, 2016 Author Share Posted January 10, 2016 Hey @Dirty Butter , I originally put the min. qty on the item's name, but then on checkout it got weird with 10 X ITEM X 10.Now I will go with the product description plus Brian's code.Thanks @bsmither !And there goes my last chance to keep my latest store code untouched I will get back with news. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted January 10, 2016 Share Posted January 10, 2016 One way around skin code changes is to copy the stock Foundation code over to a newly named skin folder (mine). Change YOUR skin version's config.xml file so that the CDATA lines look something like this:<name><![CDATA[mine]]></name> <display><![CDATA[My Name]]></display> <version>1.0</version>Upgrades will not touch your renamed version. Using file difference software like BeyondCompare makes it easy to see if there are any skin code changes in an upgrade. Only those few changes would then need to be incorporated into your skin. Quote Link to comment Share on other sites More sharing options...
Leo Clark Posted January 11, 2016 Author Share Posted January 11, 2016 Thanks @Dirty Butter. I will mess around and see what I will do.It worked @bsmither ! It has a little scroll button which is nice, the message looks funny and cropped but at least is closer to what matters, the field itself (Screenshot attached).I believe I have to do the same thing to categories view and latest products. Quote Link to comment Share on other sites More sharing options...
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.