sickshot Posted May 26, 2015 Share Posted May 26, 2015 I need to show Quantity wanted on product page as dropdown with pre defined values. any clue on how to do it? ps 1.6.0.9 Link to comment Share on other sites More sharing options...
PascalVG Posted May 28, 2015 Share Posted May 28, 2015 Edit file themes/<your theme folder>/product.tpl (Make backup!!) Find code below (almost halfway the file, search for quantity wanted) and add red code: (Sample code from PS 1.6.0.14) <!-- quantity wanted --> {if !$PS_CATALOG_MODE} <p id="quantity_wanted_p"{if (!$allow_oosp && $product->quantity <= 0) || !$product->available_for_order || $PS_CATALOG_MODE} style="display: none;"{/if}> <label>{l s='Quantity'}</label> <select name="qty" id="quantity_wanted"> <option value="1">1</option> <option value="2">2</option> <option value="4">4</option> <option value="8">8</option> </select> {* <-- to comment out the original quantity input method <input type="text" name="qty" id="quantity_wanted" class="text" value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}{if $product->minimal_quantity > 1}{$product->minimal_quantity}{else}1{/if}{/if}" /> <a href="#" data-field-qty="qty" class="btn btn-default button-minus product_quantity_down"> <span><i class="icon-minus"></i></span> </a> <a href="#" data-field-qty="qty" class="btn btn-default button-plus product_quantity_up"> <span><i class="icon-plus"></i></span> </a> *} <-- to comment out the original quantity input method <span class="clearfix"></span> </p> {/if} <!-- minimal quantity wanted --> Result: N.B. Change the drop down item values as needed in the code above: <option value="1">1</option> Hope this helps, pascal Link to comment Share on other sites More sharing options...
ARQU Posted June 18, 2015 Share Posted June 18, 2015 (edited) If you want to use multiples of a defined value, you can insert the value in the "UPC barcode" field and use this code: {if $product->upc == ''} <input type="text" name="qty" id="quantity_wanted" class="text" value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}{if $product->minimal_quantity > 1}{$product->minimal_quantity}{else}1{/if}{/if}" /> <a href="#" data-field-qty="qty" class="btn btn-default button-minus product_quantity_down"> <span><i class="icon-minus"></i></span> </a> <a href="#" data-field-qty="qty" class="btn btn-default button-plus product_quantity_up"> <span><i class="icon-plus"></i></span> </a> {else} <select name="qty" id="quantity_wanted"> {section name=foo start=$product->upc loop=10000 step=$product->upc max=12} <option value="{$smarty.section.foo.index}">{$smarty.section.foo.index}</option> {$smarty.section.foo.index} {/section} </select> {/if} Edited June 18, 2015 by Javixixina (see edit history) Link to comment Share on other sites More sharing options...
Jayant Bulbule Posted September 19, 2016 Share Posted September 19, 2016 Great! What if I wish to take the fixed values for each product from say using a child table to products table. For example: Product-1 has quantity options as 1,2,3 & 4 and product-2 has quantity options as 2,4,6,8 & 10. In short, I wish to not take them as multiples of some number but those as defined in the child table. Actually, I am trying to make Prestashop to accept the quantities in decimal fractions as 0.25, 0.5, 0.75 & 1.0 or 0.2 & 0.4. PS 1.6.0.9. Sorry for reopening this thread after a long time again and Thanks in advance for all help in this regards. Link to comment Share on other sites More sharing options...
Leosss Posted October 21, 2016 Share Posted October 21, 2016 Edit file themes/<your theme folder>/product.tpl (Make backup!!) Find code below (almost halfway the file, search for quantity wanted) and add red code: (Sample code from PS 1.6.0.14) <!-- quantity wanted --> {if !$PS_CATALOG_MODE} <p id="quantity_wanted_p"{if (!$allow_oosp && $product->quantity <= 0) || !$product->available_for_order || $PS_CATALOG_MODE} style="display: none;"{/if}> <label>{l s='Quantity'}</label> <select name="qty" id="quantity_wanted"> <option value="1">1</option> <option value="2">2</option> <option value="4">4</option> <option value="8">8</option> </select> {* <-- to comment out the original quantity input method <input type="text" name="qty" id="quantity_wanted" class="text" value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}{if $product->minimal_quantity > 1}{$product->minimal_quantity}{else}1{/if}{/if}" /> <a href="#" data-field-qty="qty" class="btn btn-default button-minus product_quantity_down"> <span><i class="icon-minus"></i></span> </a> <a href="#" data-field-qty="qty" class="btn btn-default button-plus product_quantity_up"> <span><i class="icon-plus"></i></span> </a> *} <-- to comment out the original quantity input method <span class="clearfix"></span> </p> {/if} <!-- minimal quantity wanted --> Result: quantity dropdown.png quantity dropdown opened.png N.B. Change the drop down item values as needed in the code above: <option value="1">1</option> Hope this helps, pascal It works in 1.6.1.4 version? I tried but not working for me... Link to comment Share on other sites More sharing options...
Naldinho Posted October 25, 2016 Share Posted October 25, 2016 My solution to this was to make Quantity an attribute and then remove the original quantity from appearing anywhere where the customer can see or change it -- so all orders are for quantity 1 as far as PrestaShop is concerned and then attribute Quantity sets the actual order quantity. The main reason for doing it this way is that it allows different defined quantities for different products. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now