ramar Posted September 15, 2009 Share Posted September 15, 2009 Hi, i would be gratefull for some help if anyone has done this before.I want to add a quantity box to the product listing pages (similar to on the full view product page.I have copied the following code from product.tpl to product-list.tpl, and have managed to get the quantity box to show up, but no matter what value i put in the quantity box, when i add to cart, it only add one item.In product-list.tpl i have added the following: <!-- add to cart form--> <form id="buy_block" action="{$base_dir}cart.php" method="post"> <!-- quantity wanted --> quantity == 0) || $virtual} style="display:none;"{/if}> {l s='Quantity :'} <input type="text" name="qty" id="quantity_wanted" class="text" value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}1{/if}" size="2" maxlength="3" /> </form> and then edited the follwing: {l s='Add to cart'} If anyone has any idea how to do this i would really appreciate it. Im sure it cant be that difficult. Link to comment Share on other sites More sharing options...
lauriou Posted September 30, 2009 Share Posted September 30, 2009 HiDid you get it working?as I am try to do the same thingCheersSerge Link to comment Share on other sites More sharing options...
ningu Posted September 30, 2009 Share Posted September 30, 2009 A way to do this, with 2 modifications.This works only when Ajax is activated in BlockCart module configuration.In the theme directory, file product-list.tpl, replace : {if ($product.allow_oosp OR $product.quantity > 0) && $product.customizable != 2} {l s='Add to cart'} {else} BY (2 lines inserted) {if ($product.allow_oosp OR $product.quantity > 0) && $product.customizable != 2} {l s='Quantity :'} <input type="text" name="ajax_qty_to_add_to_cart[{$product.id_product|intval}]" id="quantity_wanted_{$product.id_product|intval}" class="text" value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}1{/if}" size="2" maxlength="3" /> {l s='Add to cart'} {else} In the module blockcart, file ajax-cart.js, in the first block " for every 'add' buttons.", replace : ajaxCart.add(idProduct, null, false, this); BY ajaxCart.add(idProduct, null, false, this, $('#quantity_wanted_'+idProduct)); 1 Link to comment Share on other sites More sharing options...
lauriou Posted October 1, 2009 Share Posted October 1, 2009 HiI can't get it to work.I can't see how the value from the <input> text for the quantity can be grabed without to submit the form?Still thinking!Serge Link to comment Share on other sites More sharing options...
ningu Posted October 1, 2009 Share Posted October 1, 2009 This is javascript that gets the value from the text and set it into the form request.Is your site online so that I can check ? send me in PM Link to comment Share on other sites More sharing options...
ixotype Posted October 1, 2009 Share Posted October 1, 2009 Thanks ningu. It works great.At the first time I can't get it to work but i made a change in your code.Where you put:ajaxCart.add(idProduct, null, false, this, $('#quantity_wanted_'+idProduct));I changed:ajaxCart.add(idProduct, null, false, this, $('#quantity_wanted_'+idProduct).val());Thanks a lot Link to comment Share on other sites More sharing options...
lauriou Posted October 1, 2009 Share Posted October 1, 2009 got it to work. .val() is needed!Thanks a lot guysSerge Link to comment Share on other sites More sharing options...
Axari Posted October 24, 2009 Share Posted October 24, 2009 Just wanted to say thank you. Been trying to do this for a month or more now. Appreciate everyone taking the time to share! Link to comment Share on other sites More sharing options...
teoze Posted December 12, 2009 Share Posted December 12, 2009 modul theme ?In product-list.tpl i have added the following:------------------------------------------------------------------------------------------ {if ($product.allow_oosp OR $product.quantity > 0) && $product.customizable != 2} {l s='Add to cart'} {else} reaple {if ($product.allow_oosp OR $product.quantity > 0) && $product.customizable != 2} {l s='Quantity :'} <input type="text" name="ajax_qty_to_add_to_cart[{$product.id_product|intval}]" id="quantity_wanted_{$product.id_product|intval}" class="text" value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}1{/if}" size="2" maxlength="3" /> {l s='Add to cart'} {else} ------------------------------------------------------------------------------------------------------------------------------------------------------------------in the module blockcart, file ajax-cart.js ajaxCart.add(idProduct, null, false, this); reaple ajaxCart.add(idProduct, null, false, this, $('#quantity_wanted_'+idProduct)); ------------------------------------------------------------------------------------------------------------------------------------------------------------------esoes help me pls Link to comment Share on other sites More sharing options...
saifur Posted January 26, 2010 Share Posted January 26, 2010 change product-list.tp according to the previous reply andin the module blockcart, file ajax-cart.js ajaxCart.add(idProduct, null, false, this); Replace with ajaxCart.add(idProduct, null, false, this, $('#quantity_wanted_'+idProduct).val()); It is working Link to comment Share on other sites More sharing options...
Abh Posted January 28, 2010 Share Posted January 28, 2010 GOD! I thought i'd never be able to to this, thank you guys! Link to comment Share on other sites More sharing options...
Ciscowrig Posted January 28, 2010 Share Posted January 28, 2010 EDIT: I found that this is a bug with the wishlist block. Unrelated to the code posted here.The items are not getting added to the order detail on order.php.What do I need to add there? They are coming through in the final order though. Link to comment Share on other sites More sharing options...
luca.lb Posted February 22, 2010 Share Posted February 22, 2010 I've add a field in database with granularity quanitity:exempleDVD-R Verbatim in spindle 25pk. I've the price for single DVDs, 0.20€ but the customers need to add block of 25pz. The granularity is 25I want that if the user does not put 25pz or multiple (50,27,100,125 etc.) comes out an alert with an error message.how do I do? Link to comment Share on other sites More sharing options...
fernando fischer Posted June 29, 2010 Share Posted June 29, 2010 hi guys i due this but do not work on my server any idea what i could be doing wrongthank you Link to comment Share on other sites More sharing options...
fernando fischer Posted June 29, 2010 Share Posted June 29, 2010 hi every one .... i got it , the code works for me , i believe that i was doing someting wrong at the first thank you IT WORKS !!!!!!!!!! Link to comment Share on other sites More sharing options...
Rod Posted July 16, 2010 Share Posted July 16, 2010 it works.Great. Then how can I add combinations on product list??? Link to comment Share on other sites More sharing options...
Rod Posted July 16, 2010 Share Posted July 16, 2010 change product-list.tp according to the previous reply andin the module blockcart, file ajax-cart.jsajaxCart.add(idProduct, null, false, this); Replace with ajaxCart.add(idProduct, null, false, this, $('#quantity_wanted_'+idProduct).val()); It is working Do this again. Link to comment Share on other sites More sharing options...
Start Online Design Posted July 17, 2010 Share Posted July 17, 2010 yeah it works really great. Thanks a lot! Link to comment Share on other sites More sharing options...
Kex Posted August 18, 2010 Share Posted August 18, 2010 Aloha. it's very simple but very usable...except one thing - in the box i writing for example 10 pcs, clicking add to cart and ajax adding only1 pcs. What the hell??? Installed and checked already 20 times and i need you help wisemen ! I'm using prestashop 1.3.1. Link to comment Share on other sites More sharing options...
Kex Posted August 18, 2010 Share Posted August 18, 2010 Aloha. it's very simple but very usable...except one thing - in the box i writing for example 10 pcs, clicking add to cart and ajax adding only1 pcs. What the hell??? Installed and checked already 20 times and i need you help wisemen ! I'm using prestashop 1.3.1. after this reply, my damn cart now working pretty well...something mistic, but cart working...yessssss Link to comment Share on other sites More sharing options...
netman Posted September 11, 2010 Share Posted September 11, 2010 Does anybody know how to display available quantity in the product list page similar to the product detail page?Thanks Link to comment Share on other sites More sharing options...
rocky Posted September 12, 2010 Share Posted September 12, 2010 Try adding the following inside the of product-list.tpl: {$product.quantity} {if $product.quantity == 1}{l s='item'}{else}{l s='items'}{/if} {l s='in stock'} Link to comment Share on other sites More sharing options...
netman Posted September 12, 2010 Share Posted September 12, 2010 Thanks Rocky. You have fixed it. You are one of the most respected guys here. Link to comment Share on other sites More sharing options...
YaKs Posted October 28, 2010 Share Posted October 28, 2010 mmm... I am sorry to tell that in Firefox doesnt work. i was debugging a bit and when you type the quantity and click add cart, the default value of 1 doesnt change and always 1 item is added... plus the disable function doesnt work either...someone found a fix for this?thanks!jose Link to comment Share on other sites More sharing options...
cilo Posted November 7, 2010 Share Posted November 7, 2010 Works for me like YaKs said. I am running 1.3.2.thanks for help!marian Link to comment Share on other sites More sharing options...
YaKs Posted November 11, 2010 Share Posted November 11, 2010 Hi again, I didnt solve the firefox issue but I achieved to show images and attributes in the category page for each product.http://v2.muertosdearte.com/categoryFull.php?id_category=8let me know if someone is interested in this hack..cheersjose Link to comment Share on other sites More sharing options...
MrMcQ Posted November 30, 2010 Share Posted November 30, 2010 This is a great functionality to add to the store, however, if products have different combinations/attributes, this will not work to include those instances. On products with just one size/type/color/etc., sure, but anything else is lost Link to comment Share on other sites More sharing options...
tomerg3 Posted November 30, 2010 Share Posted November 30, 2010 I have recently released a module that allows you to choose attributes on the product list page.Check out http://www.prestashop.com/forums/viewthread/79758/ Link to comment Share on other sites More sharing options...
MrMcQ Posted November 30, 2010 Share Posted November 30, 2010 Dude, yes, I saw that! Its a great addition...does it get away from bogging down the loadtime?...or is it still the same concept? I love your site, and have purchased from it before, thanks for the great addition, and for your post Link to comment Share on other sites More sharing options...
tomerg3 Posted November 30, 2010 Share Posted November 30, 2010 It loads all the attribute info using JavaScript, it shouldn't affect load speed that much, especially if you don't have a few hundred combinatons per product.I've had. Few customers buy it, and have not received any responses about slowdown related to the module. Link to comment Share on other sites More sharing options...
MrMcQ Posted November 30, 2010 Share Posted November 30, 2010 Yeah, its just sizing (4oz, 2lbs, etc.) and there only a few at this point. Great! I will add it to my store Link to comment Share on other sites More sharing options...
ruslan Posted November 30, 2010 Share Posted November 30, 2010 please Help!!!)How can I make it so that when the import process is started, all the products get “Not available” status? or quantity for all products - 0 Link to comment Share on other sites More sharing options...
MrMcQ Posted December 1, 2010 Share Posted December 1, 2010 So, is there no way to tie this patch into your plugin? Its pretty important to be able to adjust the quantity of the items being added to the cart, but the attributes are quintessential Link to comment Share on other sites More sharing options...
tomerg3 Posted December 1, 2010 Share Posted December 1, 2010 You can patch it if you know what you're doing (one of the advantages of open source), or wait for the next version (shouldn't be too long). Link to comment Share on other sites More sharing options...
Behc98 Posted December 24, 2010 Share Posted December 24, 2010 mmm... I am sorry to tell that in Firefox doesnt work. i was debugging a bit and when you type the quantity and click add cart, the default value of 1 doesnt change and always 1 item is added... plus the disable function doesnt work either...someone found a fix for this?thanks!jose Will you give me the codes? Pls.. Link to comment Share on other sites More sharing options...
Stefand Posted April 1, 2011 Share Posted April 1, 2011 Hi, does anybody get this work with 1.4 ?I will pay for it, I need the solution ! Link to comment Share on other sites More sharing options...
Burhan BVK Posted April 1, 2011 Share Posted April 1, 2011 Hi, does anybody get this work with 1.4 ?I will pay for it, I need the solution ! http://www.bvkyazilim.com/cart/prestashop-modules/30-quantity-boxes-in-product-lists.htmlIt is compatible with 1.4. Link to comment Share on other sites More sharing options...
Stefand Posted April 1, 2011 Share Posted April 1, 2011 they demo doesn't work? Link to comment Share on other sites More sharing options...
wills1234 Posted April 15, 2011 Share Posted April 15, 2011 Hi, does anybody get this work with 1.4 ?I will pay for it, I need the solution ! Hi, I tried this in prestashop 1.4 and works fine.Best Regards Link to comment Share on other sites More sharing options...
ScubaLessonsInc Posted May 6, 2011 Share Posted May 6, 2011 It does work as I did this mod to my store at www.dieselsurplusstore.com and my once zipping along site is like molasses.. This is just a quantity box.. why is it slowing it down so much? Was fine before this change.. Also to see it in the cart sometimes I have to refresh.. any suggestions? Link to comment Share on other sites More sharing options...
ScubaLessonsInc Posted May 18, 2011 Share Posted May 18, 2011 THIS SITE WAS ONCE REALLY FAST AT GETTING RESPONSES.. NOW NEW VERSION WITH MAJOR ISSUES AND NO HELP. Can I get some help pretty please? I have several sites now on the new versions.. I know your working hard on Prestashop 2 but in the interim.. please guys.. help out the little people who have been loyal all along. The problem with this fix is that it will work if you do something to trigger the page to refresh.. otherwise you can enter the quantity and click add to cart and it does not.. but then hit checkout and it works. Why is the add to cart button not triggering the addition of the entered quantity to the cart? I need help to figure this out please. Thanks. 1 Link to comment Share on other sites More sharing options...
ScubaLessonsInc Posted May 18, 2011 Share Posted May 18, 2011 SO NOT SOLVED! Link to comment Share on other sites More sharing options...
wills1234 Posted July 4, 2011 Share Posted July 4, 2011 Hi everyone, its possible to add a quantity selector + / -, to change the quantity, clicking with the mouse.Best regards. Link to comment Share on other sites More sharing options...
vivek tripathi Posted August 27, 2011 Share Posted August 27, 2011 Hi All First of all thanks to ningu for your code I have add small peace of code to run above code in both condition ajaxcart is activate or deactivated (jquery code in product-listing.tpl file) Here is complete code below some time editor parse code so for convinece I have attached text file having complete code in theme->prodcut-list.tpl Replace {if ($product.allow_oosp OR $product.quantity > 0) && $product.customizable != 2} {l s='Add to cart'} {else} with the following code {if ($product.allow_oosp OR $product.quantity > 0) && $product.customizable != 2} {l s='Quantity :'} <input type="text" name="ajax_qty_to_add_to_cart[{$product.id_product|intval}]" id="quantity_wanted_{$product.id_product|intval}" class="text" value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}1{/if}" size="2" maxlength="3" /> {l s='Add to cart'} {else} In the module->blockcart->ajax-cart.js ajaxCart.add(idProduct, null, false, this); Replace with ajaxCart.add(idProduct, null, false, this, $('#quantity_wanted_'+idProduct).val()); In theme->product-list.tpl add following lin at the top of page {literal} <script type="text/javascript"> $(document).ready(function(){ $(".ajax_add_to_cart_button").click(function(){ var f=$(this).attr('href'); var id = f.split('&')[1].split('=')[1]; var p="#quantity_wanted_"+id; var qty=$(p).attr('value'); g=f+"&qty="+qty; window.location=''+g; return false; }); }); </script> {/literal} 1 Link to comment Share on other sites More sharing options...
swoots Posted September 22, 2011 Share Posted September 22, 2011 Hello, My problem is that when I buy at checkout I get this error Fatal error (OrderHistory -> id_order_state is empty) my version is 1.4.4 and see if you can help me that do not know if the problem is the product-list.tpl or ajax-carts.tpl. thanks. thanks. Link to comment Share on other sites More sharing options...
ScubaLessonsInc Posted September 23, 2011 Share Posted September 23, 2011 I actually had that same error on one of my stores.. easy fix: Just open unzip your 1.4.4.1 file and replace your cart.tpl and cart.php files with the original ones. The error will go away. Thanks, Tina Link to comment Share on other sites More sharing options...
pradyut Posted October 17, 2011 Share Posted October 17, 2011 I did not get sucess ...please help, have amended the below changes in Product-list.tpl Before {if ($product.allow_oosp || $product.quantity > 0)} <a class="button ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart.php')}?add&id_product={$product.id_product|intval}{if isset($static_token)}&token={$static_token}{/if}" title="{l s='Add to cart'}">{l s='Add to cart'}</a> {else} As suggested I changed with below {if ($product.allow_oosp OR $product.quantity > 0) && $product.customizable != 2} {l s='Quantity :'} <input type="text" name="ajax_qty_to_add_to_cart[{$product.id_product|intval}]" id="quantity_wanted_{$product.id_product|intval}" class="text" value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}1{/if}" size="2" maxlength="3" /> {l s='Add to cart'} {else} With the above change i got quantity box in my product list but it disable the Add to Cart button and without that Quantity button is of no use.please find the attached screenshot Please help me to resolve the issue. Link to comment Share on other sites More sharing options...
Axari Posted November 7, 2011 Share Posted November 7, 2011 Solution - http://www.prestashop.com/forums/topic/137262-solved-add-quantity-box-to-product-listing/page__hl__%2Bhow+%2Bto+%2Badd+%2Bquantity__fromsearch__1 Link to comment Share on other sites More sharing options...
Andrii Posted June 26, 2012 Share Posted June 26, 2012 It's works with quantity. How about combinations in product-list.tpl. How to add selected combination to cart. Combination i create by this way http://www.prestashop.com/forums/topic/92207-attributes-in-category-view-solved/page__p__862216 Link to comment Share on other sites More sharing options...
faDdy Posted June 26, 2012 Share Posted June 26, 2012 (edited) i have added your code and quantity box is working properly on product-list.tpl but on order page if some updates the quantity or delete the product ...it will cause problem and not updates the total amount of order... for reference please check the snapshot attached... and if anyone has solution to it Please help. Thanks Edited June 26, 2012 by faDdy (see edit history) Link to comment Share on other sites More sharing options...
bmv Posted July 25, 2012 Share Posted July 25, 2012 i have added your code and quantity box is working properly on product-list.tpl but on order page if some updates the quantity or delete the product ...it will cause problem and not updates the total amount of order... for reference please check the snapshot attached... and if anyone has solution to it Please help. Thanks Hi faDdy, I have applied solution #3, it works perfectly on products list. I have double checked the shopping cart summary, and the + - buttons are working as well, correctly updating the total amount. Which Presta version are you running? As I said, it's correctly working for me on ajax mode, Prestashop 1.4.8.2 Link to comment Share on other sites More sharing options...
faDdy Posted July 25, 2012 Share Posted July 25, 2012 yes i am sorry its working perfectly ..... Thanks for this mod Link to comment Share on other sites More sharing options...
dstanimirov Posted August 26, 2012 Share Posted August 26, 2012 (edited) It is work great for product-list And I made it for products in accessories list: Edited August 26, 2012 by dstanimirov (see edit history) Link to comment Share on other sites More sharing options...
PatriceJV Posted September 16, 2012 Share Posted September 16, 2012 Hi All First of all thanks to ningu for your code I have add small peace of code to run above code in both condition ajaxcart is activate or deactivated (jquery code in product-listing.tpl file) Here is complete code below some time editor parse code so for convinece I have attached text file having complete code in theme->prodcut-list.tpl Replace {if ($product.allow_oosp OR $product.quantity > 0) && $product.customizable != 2} {l s='Add to cart'} {else} with the following code {if ($product.allow_oosp OR $product.quantity > 0) && $product.customizable != 2} {l s='Quantity :'} {l s='Add to cart'} {else} In the module->blockcart->ajax-cart.js ajaxCart.add(idProduct, null, false, this); Replace with ajaxCart.add(idProduct, null, false, this, $('#quantity_wanted_'+idProduct).val()); In theme->product-list.tpl add following lin at the top of page {literal} {/literal} In version 1.4.8 the product-list.tpl code should be changed from {if ($product.allow_oosp || $product.quantity > 0)} <a class="button ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart.php')}?add&id_product={$product.id_product|intval}{if isset($static_token)}&token={$static_token}{/if}" title="{l s='Add to cart'}">{l s='Add to cart'}</a> to {if ($product.allow_oosp || $product.quantity > 0)} {l s='Quantity :'} <input type="text" name="ajax_qty_to_add_to_cart[{$product.id_product|intval}]" id="quantity_wanted_{$product.id_product|intval}" class="text" value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}1{/if}" size="2" maxlength="3" /> <a class="button ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart.php')}?add&id_product={$product.id_product|intval}{if isset($static_token)}&token={$static_token}{/if}" title="{l s='Add to cart'}">{l s='Add to cart'}</a> Link to comment Share on other sites More sharing options...
PatriceJV Posted October 14, 2012 Share Posted October 14, 2012 1) Copy modules\blockcart\ajax-cart.js in \themes\yourtheme\js\modules\blockcart\ajax-cart.js 2) in theme->product-list.tpl : Put after {if ($product.allow_oosp || $product.quantity > 0)} {l s='Quantity :'} <input type="text" name="ajax_qty_to_add_to_cart[{$product.id_product|intval}]" id="quantity_wanted_{$product.id_product|intval}" class="text" value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}1{/if}" size="2" maxlength="3" /> 3) In the \themes\yourtheme\js\modules\blockcart\ajax-cart.js : ajaxCart.add(idProduct, null, false, this); Replace with ajaxCart.add(idProduct, null, false, this, $('#quantity_wanted_'+idProduct).val()); 4) In theme->product-list.tpl add following lin at the top of page : {literal} <script type="text/javascript"> $(document).ready(function(){ $(".ajax_add_to_cart_button").click(function(){ var f=$(this).attr('href'); var id = f.split('&')[1].split('=')[1]; var p="#quantity_wanted_"+id; var qty=$(p).attr('value'); g=f+"&qty="+qty; window.location=''+g; return false; }); }); </script> {/literal} Enjoy... Link to comment Share on other sites More sharing options...
damienf Posted November 12, 2012 Share Posted November 12, 2012 unfortunatly, it doesn't seem to work with 1.5 Link to comment Share on other sites More sharing options...
Beluga Posted September 11, 2013 Share Posted September 11, 2013 Anyone modified this to work with 1.5? Would be cool to have as an option in the official PrestaShop. Link to comment Share on other sites More sharing options...
promod Posted November 18, 2013 Share Posted November 18, 2013 (edited) Up this topic. Anybody with a solution for 1.5.4.1 ? Edited November 18, 2013 by promod (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted November 18, 2013 Share Posted November 18, 2013 Up this topic. Anybody with a solution for 1.5.4.1 ? quantity field on product listing pages Link to comment Share on other sites More sharing options...
promod Posted November 18, 2013 Share Posted November 18, 2013 I read this topic but now it's seems working... I don't know why... But sometime when I submit a custom quantity it's the default value (1) that being sent Link to comment Share on other sites More sharing options...
vekia Posted November 18, 2013 Share Posted November 18, 2013 I read this topic but now it's seems working... I don't know why... But sometime when I submit a custom quantity it's the default value (1) that being sent can you share url to your website? i will inspect it, maybe i will find where the problem is Link to comment Share on other sites More sharing options...
pablog Posted January 22, 2014 Share Posted January 22, 2014 Hi Vekia, I followed your guide and I have the same issue as Promod (only adding 1 unit to cart). The link to my website is: http://www.linkportnet.com/Prestashop/index.php?id_category=5&controller=category I have tried for some days your instructions but with no success. Can you please check? Thanks. Link to comment Share on other sites More sharing options...
tudonghoadanang Posted January 23, 2014 Share Posted January 23, 2014 it dont work for me Link to comment Share on other sites More sharing options...
promod Posted January 23, 2014 Share Posted January 23, 2014 Sorry vekia I didn't see your response... The bug is fixed on my site but I don't know why. I redid the tutorial and it's working... Link to comment Share on other sites More sharing options...
vekia Posted January 23, 2014 Share Posted January 23, 2014 Hi Vekia, I followed your guide and I have the same issue as Promod (only adding 1 unit to cart). The link to my website is: http://www.linkportnet.com/Prestashop/index.php?id_category=5&controller=category I have tried for some days your instructions but with no success. Can you please check? Thanks. you havent got ajax cart feature turned on, this is why it doesn't work Link to comment Share on other sites More sharing options...
vekia Posted January 23, 2014 Share Posted January 23, 2014 it dont work for me share url please Link to comment Share on other sites More sharing options...
promod Posted January 23, 2014 Share Posted January 23, 2014 you havent got ajax cart feature turned on, this is why it doesn't work Where is this option ? Link to comment Share on other sites More sharing options...
vekia Posted January 23, 2014 Share Posted January 23, 2014 on cart block module configuration page after clicking on configure button you will see option to turn on / off ajax cart Link to comment Share on other sites More sharing options...
promod Posted January 23, 2014 Share Posted January 23, 2014 (edited) Ok thanks. Maybe I checked this option and then my problem was solved... Edited January 23, 2014 by promod (see edit history) Link to comment Share on other sites More sharing options...
pablog Posted January 23, 2014 Share Posted January 23, 2014 Hi Vekia, Thanks for the help. However, I see that my ajax cart feature is on. Strange. Here is my question: Which blockcart module is being activated? I mean, I see the folder "blockcart" in /modules or /themes/default or /themes/mytheme/modules I will replace the original "blockcart" folder with the one you tell me. Sorry for the noob question. Thanks. Link to comment Share on other sites More sharing options...
vekia Posted January 23, 2014 Share Posted January 23, 2014 if module has got override in theme - script will use these files Link to comment Share on other sites More sharing options...
cerovic Posted February 17, 2014 Share Posted February 17, 2014 change product-list.tp according to the previous reply and in the module blockcart, file ajax-cart.js ajaxCart.add(idProduct, null, false, this); Replace with ajaxCart.add(idProduct, null, false, this, $('#quantity_wanted_'+idProduct).val()); It is working I tried this on PS 1.5.6.2 and it works also here. Well gone gays. Of course thus works just with previous post. Link to comment Share on other sites More sharing options...
neo76 Posted March 13, 2014 Share Posted March 13, 2014 Sory! This is joke!!! Hi AllFirst of all thanks to ningu for your code I have add small peace of code to run above code in both condition ajaxcart is activate or deactivated(jquery code in product-listing.tpl file)Here is complete code below some time editor parse code so for convinece I have attached text file having complete codein theme->prodcut-list.tplReplace {if ($product.allow_oosp OR $product.quantity > 0) && $product.customizable != 2} {l s='Add to cart'} {else} with the following code {if ($product.allow_oosp OR $product.quantity > 0) && $product.customizable != 2} {l s='Quantity :'} <input type="text" name="ajax_qty_to_add_to_cart[{$product.id_product|intval}]" id="quantity_wanted_{$product.id_product|intval}" class="text" value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}1{/if}" size="2" maxlength="3" /> {l s='Add to cart'} {else} In the module->blockcart->ajax-cart.js ajaxCart.add(idProduct, null, false, this); Replace with ajaxCart.add(idProduct, null, false, this, $('#quantity_wanted_'+idProduct).val()); In theme->product-list.tpl add following lin at the top of page {literal} <script type="text/javascript"> $(document).ready(function(){ $(".ajax_add_to_cart_button").click(function(){ var f=$(this).attr('href'); var id = f.split('&')[1].split('=')[1]; var p="#quantity_wanted_"+id; var qty=$(p).attr('value'); g=f+"&qty="+qty; window.location=''+g; return false; }); }); </script> {/literal} Link to comment Share on other sites More sharing options...
vekia Posted March 13, 2014 Share Posted March 13, 2014 Sory! This is joke!!! ? Link to comment Share on other sites More sharing options...
sooroos Posted March 27, 2014 Share Posted March 27, 2014 I did the changes from your site Vekia and the cart button is not working. When add to cart, nothing happens, after page refresh, the products do appear in the cart (ajax enabled). Cleared cache, shop cache ... PrestaShop™ 1.5.6.0 Link to comment Share on other sites More sharing options...
vekia Posted March 27, 2014 Share Posted March 27, 2014 I did the changes from your site Vekia and the cart button is not working. When add to cart, nothing happens, after page refresh, the products do appear in the cart (ajax enabled). Cleared cache, shop cache ... PrestaShop™ 1.5.6.0 it just mean that you probably did something wrong please share url to your website where you use this modification - i will inspect it for potential breakpoints Link to comment Share on other sites More sharing options...
sooroos Posted March 27, 2014 Share Posted March 27, 2014 try on this fresh install here if you press add to cart button happens nothing, but if you refresh the page you see the quantity has been correctly added Link to comment Share on other sites More sharing options...
vekia Posted March 28, 2014 Share Posted March 28, 2014 check this: http://www.prestashop.com/forums/topic/302211-solvedquantity-field-in-featured-products-module-by-myprestaeu/ Link to comment Share on other sites More sharing options...
arturobelver Posted March 31, 2014 Share Posted March 31, 2014 Hi everybody! I am creating a shop (PS 1.6) in localhost and I've tried to do everything you said but does not work me. I fear that your code does not work for version 1.6, someone tested it? I need edit the producth list: resize the row height to 200px add the quantity box with -/+ in product-lisitng of categories. Somethin like this: Link to comment Share on other sites More sharing options...
arturobelver Posted March 31, 2014 Share Posted March 31, 2014 Like this better: Link to comment Share on other sites More sharing options...
vekia Posted March 31, 2014 Share Posted March 31, 2014 any chance to see it live somewhere? guide is based on 1.5 - i never tested this guide in 1.6 release, so it's great time to do it 1 Link to comment Share on other sites More sharing options...
roz Posted April 9, 2014 Share Posted April 9, 2014 has anyone tried it on 1.6? i will give it a try now. hope it works Link to comment Share on other sites More sharing options...
roz Posted April 9, 2014 Share Posted April 9, 2014 any chance to see it live somewhere? guide is based on 1.5 - i never tested this guide in 1.6 release, so it's great time to do it apparently, it's not working on 1.6 and i hope it can be done like how it's presented in product page, just a "+" & "-" button to add and reduce quantity Link to comment Share on other sites More sharing options...
arturobelver Posted April 24, 2014 Share Posted April 24, 2014 apparently, it's not working on 1.6 and i hope it can be done like how it's presented in product page, just a "+" & "-" button to add and reduce quantity up Link to comment Share on other sites More sharing options...
roz Posted April 25, 2014 Share Posted April 25, 2014 up hey arturobelver, i already got this working on my template. but not in "+" & "-" style you can check the solution on this topic http://www.prestashop.com/forums/topic/323405-solved-how-to-add-quantity-in-product-list/ Link to comment Share on other sites More sharing options...
arturobelver Posted April 25, 2014 Share Posted April 25, 2014 hey arturobelver, i already got this working on my template. but not in "+" & "-" style you can check the solution on this topic http://www.prestashop.com/forums/topic/323405-solved-how-to-add-quantity-in-product-list/ Thanks!!! Link to comment Share on other sites More sharing options...
roz Posted April 25, 2014 Share Posted April 25, 2014 Thanks!!! no problem Link to comment Share on other sites More sharing options...
vekia Posted April 25, 2014 Share Posted April 25, 2014 i think that i will release new guide with [+] and [-] buttons too, especially for prestashop v1.6 when? this weekend 2 Link to comment Share on other sites More sharing options...
roz Posted April 25, 2014 Share Posted April 25, 2014 i think that i will release new guide with [+] and [-] buttons too, especially for prestashop v1.6 when? this weekend wow! that would be really really great! update us here please! thank you soooo much! Link to comment Share on other sites More sharing options...
arturobelver Posted April 25, 2014 Share Posted April 25, 2014 i think that i will release new guide with [+] and [-] buttons too, especially for prestashop v1.6 when? this weekend this guy is brilliant!! Link to comment Share on other sites More sharing options...
roz Posted April 28, 2014 Share Posted April 28, 2014 i wonder if Vekia has already done it over the weekend Link to comment Share on other sites More sharing options...
vekia Posted April 28, 2014 Share Posted April 28, 2014 it's almost ready 2 Link to comment Share on other sites More sharing options...
roz Posted May 9, 2014 Share Posted May 9, 2014 it's almost ready hi vekia! wondering if it's ready? Link to comment Share on other sites More sharing options...
papich Posted December 1, 2014 Share Posted December 1, 2014 it's almost ready Hello, Where we can find your quantity wanted for product list for 1.6? thanks Link to comment Share on other sites More sharing options...
w3bsolutions Posted December 27, 2014 Share Posted December 27, 2014 Hello, Where we can find your quantity wanted for product list for 1.6? thanks Here: http://mypresta.eu/en/art/developer/prestashop-quantity-field-on-product-list.html Link to comment Share on other sites More sharing options...
parmod Posted April 6, 2015 Share Posted April 6, 2015 A way to do this, with 2 modifications. This works only when Ajax is activated in BlockCart module configuration. In the theme directory, file product-list.tpl, replace : {if ($product.allow_oosp OR $product.quantity > 0) && $product.customizable != 2} <a class="button ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$base_dir}cart.php?add&id;_product={$product.id_product|intval}&token;={$static_token}">{l s='Add to cart'}</a>{else}BY (2 lines inserted) {if ($product.allow_oosp OR $product.quantity > 0) && $product.customizable != 2} <label>{l s='Quantity :'}</label> <input type="text" name="ajax_qty_to_add_to_cart[{$product.id_product|intval}]" id="quantity_wanted_{$product.id_product|intval}" class="text" value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}1{/if}" size="2" maxlength="3" /> <a class="button ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$base_dir}cart.php?add&id;_product={$product.id_product|intval}&token;={$static_token}">{l s='Add to cart'}</a>{else} In the module blockcart, file ajax-cart.js, in the first block " for every 'add' buttons.", replace : ajaxCart.add(idProduct, null, false, this);BY ajaxCart.add(idProduct, null, false, this, $('#quantity_wanted_'+idProduct)); does it work for prestashop1.6 too ??? Link to comment Share on other sites More sharing options...
w3bsolutions Posted April 6, 2015 Share Posted April 6, 2015 A way to do this, with 2 modifications. This works only when Ajax is activated in BlockCart module configuration. In the theme directory, file product-list.tpl, replace : {if ($product.allow_oosp OR $product.quantity > 0) && $product.customizable != 2} <a class="button ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$base_dir}cart.php?add&id;_product={$product.id_product|intval}&token;={$static_token}">{l s='Add to cart'}</a>{else}BY (2 lines inserted) {if ($product.allow_oosp OR $product.quantity > 0) && $product.customizable != 2} <label>{l s='Quantity :'}</label> <input type="text" name="ajax_qty_to_add_to_cart[{$product.id_product|intval}]" id="quantity_wanted_{$product.id_product|intval}" class="text" value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}1{/if}" size="2" maxlength="3" /> <a class="button ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$base_dir}cart.php?add&id;_product={$product.id_product|intval}&token;={$static_token}">{l s='Add to cart'}</a>{else}In the module blockcart, file ajax-cart.js, in the first block " for every 'add' buttons.", replace : ajaxCart.add(idProduct, null, false, this);BY ajaxCart.add(idProduct, null, false, this, $('#quantity_wanted_'+idProduct)); does it work for prestashop1.6 too ??? Yes it does, try it out. Link to comment Share on other sites More sharing options...
papich Posted May 14, 2015 Share Posted May 14, 2015 (edited) hi, i don't think build it for PS 1.6 right? Module is better to modify code Edited May 14, 2015 by papich (see edit history) Link to comment Share on other sites More sharing options...
encalk Posted February 27, 2017 Share Posted February 27, 2017 modul theme ? In product-list.tpl i have added the following: ------------------------------------------------------------------------------------------ {if ($product.allow_oosp OR $product.quantity > 0) && $product.customizable != 2} <a class="button ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$base_dir}cart.php?add&id;_product={$product.id_product|intval}&token;={$static_token}">{l s='Add to cart'}</a>{else} reaple {if ($product.allow_oosp OR $product.quantity > 0) && $product.customizable != 2} <label>{l s='Quantity :'}</label> <input type="text" name="ajax_qty_to_add_to_cart[{$product.id_product|intval}]" id="quantity_wanted_{$product.id_product|intval}" class="text" value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}1{/if}" size="2" maxlength="3" /> <a class="button ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$base_dir}cart.php?add&id;_product={$product.id_product|intval}&token;={$static_token}">{l s='Add to cart'}</a>{else} --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- in the module blockcart, file ajax-cart.js ajaxCart.add(idProduct, null, false, this); reaple ajaxCart.add(idProduct, null, false, this, $('#quantity_wanted_'+idProduct)); --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- esoes help me pls hi. i tried to do this but not working i am using Shoppy Store... can you help. how to do this work to Shoppy Store Link to comment Share on other sites More sharing options...
-iD- Posted March 6, 2017 Share Posted March 6, 2017 (edited) themes/_YOUR_THEME_/product-list.tpl round line 155 inside .button-container <p class="quantity_wanted_p"> <input type="text" readonly name="quantity_to_cart_{$product.id_product|intval}" id="quantity_to_cart_{$product.id_product|intval}" class="text" value="{if isset($product.product_attribute_minimal_quantity) && $product.product_attribute_minimal_quantity >= 1}{$product.product_attribute_minimal_quantity|intval}{else}{$product.minimal_quantity|intval}{/if}" data-minimal_quantity="{if isset($product.product_attribute_minimal_quantity) && $product.product_attribute_minimal_quantity >= 1}{$product.product_attribute_minimal_quantity|intval}{else}{$product.minimal_quantity|intval}{/if}" /> <a href="#" data-field-qty="quantity_to_cart_{$product.id_product|intval}" class="btn btn-default button-minus product_quantity_down"> <span><i class="icon-minus"></i></span> </a> <a href="#" data-field-qty="quantity_to_cart_{$product.id_product|intval}" class="btn btn-default button-plus product_quantity_up"> <span><i class="icon-plus"></i></span> </a> <span class="clearfix"></span> </p> themes/_YOUR_THEME_/js/global.js round line 26 after var responsiveflag = false; // The button to increment the product value $(document).on('click', '.product_list .product_quantity_up', function(e){ e.preventDefault(); fieldName = $(this).data('field-qty'); var currentVal = parseInt($('input[name='+fieldName+']').val()); var minimalVal = parseInt($('input[name='+fieldName+']').attr("data-minimal_quantity")); if (!isNaN(currentVal) && currentVal < minimalVal) { $('input[name='+fieldName+']').val(minimalVal); $(this).parent().parent().find(".ajax_add_to_cart_button").attr("data-minimal_quantity",minimalVal); } else { $('input[name='+fieldName+']').val(currentVal + 1).trigger('keyup'); $(this).parent().parent().find(".ajax_add_to_cart_button").attr("data-minimal_quantity",currentVal + 1); } $('#'+fieldName).change(); }); // The button to decrement the product value $(document).on('click', '.product_list .product_quantity_down', function(e){ e.preventDefault(); fieldName = $(this).data('field-qty'); var currentVal = parseInt($('input[name='+fieldName+']').val()); var minimalVal = parseInt($('input[name='+fieldName+']').attr("data-minimal_quantity")); if (!isNaN(currentVal) && currentVal > minimalVal){ $('input[name='+fieldName+']').val(currentVal - 1).trigger('keyup'); $(this).parent().parent().find(".ajax_add_to_cart_button").attr("data-minimal_quantity",currentVal - 1); } else { $('input[name='+fieldName+']').val(minimalVal); $(this).parent().parent().find(".ajax_add_to_cart_button").attr("data-minimal_quantity",minimalVal); } $('#'+fieldName).change(); }); themes/_YOUR_THEME_/js/modules/blockcart/ajax-cart.js line 135 replace this var minimalQuantity = parseInt($(this).data('minimal_quantity')); with this var minimalQuantity = parseInt($(this).attr('data-minimal_quantity')); Result : Edited March 6, 2017 by -iD- (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts