Magento is a Falkon favourite; learn how to make use of its powerful features to boost sales by defining related...
For anyone that has used the Magento ecommerce platform, you will know that it is a fantastic system to use for your online shop. As well as being a very comprehensive system, it also has added SEO benefits and much more. However, from a developers perspective, there have been a few complaints, and this is mainly due to the combination of the fact that it very complex, and there is still currently a lack of supporting materials. For example, one of the main questions I hear from developers using the system for the first time, is “how do you add products to the homepage of a Magento site“? That’s quite a fundamental issue…
Setting the default quantity of a Magento Product
Another question I hear a lot is “can you set the default quantity of a product in Magento”? When trying to purchase items, Magento insists that you, first of all, enter an integer in the quantity box. This isn’t a massive issue, but it creates another barrier / additional step for a customer trying to buy one of your products. Well, after a bit of digging I have found a solution! The source of this solution is Sam Davies of blastedthing.com who provides a quick and easy solution by inserting the default quantity as your minimal quantity (as defined in your site configuration), so the user only has to click once. The solution he provides is a little out of date in terms of the Magento directory structure (his original post was November 2008), and his code isn’t formatted correctly due to HTML issues, so we have provided an update:
First locate the file addtocart.phtml, which can be found in the following directory (replace “yourdesign” with the name of the template design you have created for your shop):
Open the file in your normal web / text editor and you find this code (around line 35):
<input name=”qty” type=”text” id=”qty” maxlength=”12″ value=”<?php echo $this->getMinimalQty($_product) ?>” /></span>
Now replace it with this code:
<input name=”qty” type=”text” id=”qty” maxlength=”12″ value=”<?php echo $this->getMinimalQty($_product)== null?1:$this->getMinimalQty($_product) ?>” /></span>
Upload the updated file via your normal FTP software and voila! You should now have a minimal amount in the quantity box, and one less obstacle for your customers!