RuiBanha Posted May 28, 2013 Share Posted May 28, 2013 Hello, How can you configure Prestashop to use step quantities in a specific product. on step quantities i mean that a specific product only can be sold in pack of 10 units, so the client will only have the ability to select 10, 20, 30, 40, ..... even when you press the "+" button, the quantity will increase whatever is defined in product specifications. in this case 10. Thanks in advance Rui Banha Link to comment Share on other sites More sharing options...
sadlyblue Posted May 28, 2013 Share Posted May 28, 2013 Why don't instead of creating a product with 1 item, you don't specify that its a pack of 10? A qty of 1 would correspond to 10 itens (and the price would be of the 10 itens, of course). The name could be product x (pack 10)... 1 Link to comment Share on other sites More sharing options...
RuiBanha Posted May 28, 2013 Author Share Posted May 28, 2013 Sorry about my knowledge, but where in prestashop you define that an product is 10 quantities? i really need that the 10 quantities would be normally visible in the final order Link to comment Share on other sites More sharing options...
sadlyblue Posted May 28, 2013 Share Posted May 28, 2013 As far as i know there isn't. What i was trying to say is when you create/update a product you can call it comething like "Product A (10 Pack)". If you have 100 to sell, you place only 10 in the quantity field. Everytime someone buys 1, it will get 10 of product a. There's a minimal quantity (in the product edit page). But if you set at 10, someone can buy 11. Another way would be to create a pack (in the product edit page you get 3 options Product, Pack or Virtual Product). And you can set a pack to have 10 of an existing product. But you still would require the unit product to be available. Link to comment Share on other sites More sharing options...
NemoPS Posted May 29, 2013 Share Posted May 29, 2013 Use input type number. It's an html5 tag, simply write <input type="number" name="quantity" min="0" max="15" step="5"> of course, you need a proper html doctype declaration Link to comment Share on other sites More sharing options...
Keron83 Posted January 21, 2015 Share Posted January 21, 2015 I needed also this feature, but solved it using the customization fields from Prestashop (1.6) Not the best solution, but the customization fields are not being used in my shop, so it's fine for me. Link to comment Share on other sites More sharing options...
fliagotz Posted March 18, 2015 Share Posted March 18, 2015 Use input type number. It's an html5 tag, simply write <input type="number" name="quantity" min="0" max="15" step="5"> of course, you need a proper html doctype declaration Hi Nemo: Can you explain a little more. Where do you write that? Thanks Link to comment Share on other sites More sharing options...
NemoPS Posted March 20, 2015 Share Posted March 20, 2015 product.tpl, just find the input with name="quantity" and replace it with that Link to comment Share on other sites More sharing options...
florin.dediu Posted March 29, 2015 Share Posted March 29, 2015 Nice tip! Do you know how to make another Add to cart button but with 2 quantity value? I want to highlight the offer (more then 2 products = discount 10%). Link to comment Share on other sites More sharing options...
NemoPS Posted March 30, 2015 Share Posted March 30, 2015 2 quantity values? What do you mean exactly? Having it pre-loaded with quantity=2 ? Link to comment Share on other sites More sharing options...
florin.dediu Posted March 30, 2015 Share Posted March 30, 2015 Example: Link to comment Share on other sites More sharing options...
NemoPS Posted April 1, 2015 Share Posted April 1, 2015 Ah, yes, on the links, just use '&qty=2' or 3. If you use the ajax cart, you will have to modify ajax-cart.js though, following the steps described herehttp://nemops.com/prestashop-cart-multiple-products-quantities/#.VRum3vnQqr0 Link to comment Share on other sites More sharing options...
florin.dediu Posted April 1, 2015 Share Posted April 1, 2015 (edited) Ah, yes, on the links, just use '&qty=2' or 3. If you use the ajax cart, you will have to modify ajax-cart.js though, following the steps described here http://nemops.com/prestashop-cart-multiple-products-quantities/#.VRum3vnQqr0 I'm using PS 1.6.0.1.4 I've made a childish modification, in my own way Take a look to the code <div id="quantity_wanted_p"{if (!$allow_oosp && $product->quantity <= 0) || !$product->available_for_order || $PS_CATALOG_MODE} style="display: none;"{/if}> <label class="qty-label">{l s='Quantity'}:</label> <div class="quantity-input-wrapper"> <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="transition-300 product_quantity_down"> <span><i class="icon-caret-down"></i></span> </a> <a href="#" data-field-qty="qty" class="transition-300 product_quantity_up "> <span><i class="icon-caret-up"></i></span> </a> </div> <!-- Butoane reducere --> {if !$content_only} {if (isset($quantity_discounts) && count($quantity_discounts) > 0)} <br><br><button type="submit" name="qty" id="quantity_wanted2 add_to_cart2" class="exclusive2 buttons_bottom_block no-print" value="2"> <span>Adauga 2 produse <br><b>si ai reducere 10%</b></span> </button> {/if} {/if} <!-- end butoane --> <span class="clearfix"></span> </div> To my surprise, IT WORK. But it's just a problem When i add with this button i'm redirected on /index.php?controller=order-opc I dont know how to make to stay on the same page, like a normal Add to cart action. Edited April 1, 2015 by florin.dediu (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted April 3, 2015 Share Posted April 3, 2015 Well it's a submit, so unless you use some javascript to prevent it from post, no Link to comment Share on other sites More sharing options...
jonas Posted September 1, 2016 Share Posted September 1, 2016 I am halfway there. Using the minimum qty as step. <input type="number" min="0" 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}" step="{if isset($quantityBackup)}{$quantityBackup|intval}{else}{if $product->minimal_quantity > 1}{$product->minimal_quantity}{else}1{/if}{/if}" max="1000" /> Now it is the + and - buttons thats needs to be fixed. Link to comment Share on other sites More sharing options...
NemoPS Posted September 5, 2016 Share Posted September 5, 2016 product.js, around line 365 of the default template: $(document).on('click', '.product_quantity_up', function(e){ e.preventDefault(); ... Link to comment Share on other sites More sharing options...
stdeykun Posted April 26, 2018 Share Posted April 26, 2018 (edited) I did this in Prestashop 1.7 classic theme by replacing default quantity touchSpin in: /checkout/_partials/cart-detailed-product-line.tpl /catalog/_partials/product-add-to-cart.tpl - this one is used in quick view too so be aware of that Input number paramaters are: min="{$product.minimal_quantity}" step="{$product.minimal_quantity}" In cart-detailed-product-line.tpl touchSpin selector is on input[name] (product-quantity-spin) so you should change selector (e.x. add extra class) in \themes\classic\_dev\js\cart.js var spinnerSelector = 'input[name="product-quantity-spin"]'; I tried to use $().touchSpin() step property, but in cart butons +, - trigger different events. You can hide default input[number] arrows with: .input-number { -moz-appearance:textfield; } .input-number::-webkit-inner-spin-button, .input-number::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; } If someone change input value by typing and value is between steps you can correct this using function below: function roundStep(number, step, min) { return Math.round((number - min) / step ) * step + min; } Edited July 18, 2018 by stdeykun (see edit history) Link to comment Share on other sites More sharing options...
Zions1 Posted December 26, 2019 Share Posted December 26, 2019 Hi, @stdeykun Can you give me a code with the change? I cannot solve it myself in presta 1.7. How did you use step property? Link to comment Share on other sites More sharing options...
[email protected] Posted November 15, 2022 Share Posted November 15, 2022 I have figured this out and because this is the first result when i googled "prestashop order quantity step", i thought ill leave my solution here. My Presta version: 1784 The file i have modified: In /public_html/themes/classic/templates/catalog/_partials/product-add-to-cart.tpl or search for the file that contents #quantity_wanted input Add this data tag data-step="10" for a fixed amount or data-step="{$product.minimal_quantity}" because im using the minimal_quantity in BO as the step amount Link to comment Share on other sites More sharing options...
neilrodriguez Posted October 16 Share Posted October 16 On 11/14/2022 at 9:22 PM, [email protected] said: I have figured this out and because this is the first result when i googled "prestashop order quantity step", i thought ill leave my solution here. My Presta version: 1784 The file i have modified: In /public_html/themes/classic/templates/catalog/_partials/product-add-to-cart.tpl or search for the file that contents #quantity_wanted input Add this data tag data-step="10" for a fixed amount or data-step="{$product.minimal_quantity}" because im using the minimal_quantity in BO as the step amount Gracias por el aporte! lo estaba buscando! Link to comment Share on other sites More sharing options...
[email protected] Posted October 16 Share Posted October 16 9 hours ago, neilrodriguez said: Gracias por el aporte! lo estaba buscando! De nada compañero. Me alegro de poder ayudar You are welcome mate. Glad i can help 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