pradyut Posted October 17, 2011 Share Posted October 17, 2011 I have amended the below changes in Product-list.tpl to reflect the Quantity box in product list, This was suggested in forum Itself. 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 help me to resolve the issue. I have attached the screenshot of my product list to explain the situation better. Link to comment Share on other sites More sharing options...
pradyut Posted October 17, 2011 Author Share Posted October 17, 2011 Any one???? I am waiting for reply Link to comment Share on other sites More sharing options...
tomerg3 Posted October 17, 2011 Share Posted October 17, 2011 You removed the code for the add to cart and only left the text.... You much keep the <a> tag around the add to cart text... Link to comment Share on other sites More sharing options...
pradyut Posted October 17, 2011 Author Share Posted October 17, 2011 Thanks for the reply...issue resolved much appreciated!! Link to comment Share on other sites More sharing options...
veggie Posted November 22, 2011 Share Posted November 22, 2011 I have amended the below changes in Product-list.tpl to reflect the Quantity box in product list, This was suggested in forum Itself. 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 help me to resolve the issue. I have attached the screenshot of my product list to explain the situation better. I have similar issue with version 1.4.5.1, may you please paste the exact final code which worked for you. I am using prestashop_new theme with Add to Cart Buttons Link to comment Share on other sites More sharing options...
veggie Posted November 23, 2011 Share Posted November 23, 2011 May please provide the required code for version 1.4.5.1 We have following code in product-list.tpl file {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'}"><span></span>{l s='Add to cart'}</a><br /> {else} <span class="exclusive"><span></span>{l s='Add to cart'}</span><br /> {/if} Kindly provide the code to replace this, so that i can show quantity box directly in the product listing page. I am able to show box but add to cart button still accept quantity 1 with one click. Link to comment Share on other sites More sharing options...
veggie Posted December 8, 2011 Share Posted December 8, 2011 you may please help me on this. Link to comment Share on other sites More sharing options...
gorrasriders Posted December 8, 2011 Share Posted December 8, 2011 can anibody provide the code plz Link to comment Share on other sites More sharing options...
dgzurita Posted December 12, 2011 Share Posted December 12, 2011 Any solution for 1.4.6 ? Thanks Link to comment Share on other sites More sharing options...
tomerg3 Posted December 13, 2011 Share Posted December 13, 2011 This is not a simple change, especially if you take into consideration the minimal quantity in PS 1.4+ We have created a module that lets you choose attributes + quantity from all product list pages http://www.prestashop.com/forums/index.php?/topic/79758-module-product-list-attributes-allow-customers-to-select-product-attributes-on-the-category-manufacturer-supplier-and-search-pages/ Link to comment Share on other sites More sharing options...
DrogPatria Posted July 24, 2012 Share Posted July 24, 2012 (edited) I managed to include the option to change the number but I do not sum to Cart, someone that can resolved this? {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" /> <a class="btn_cart ajax_add_to_cart_button" 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} Edited July 24, 2012 by DrogPatria (see edit history) Link to comment Share on other sites More sharing options...
netmechanics Posted August 2, 2012 Share Posted August 2, 2012 Hiya - did you change the Javascript in blockcart? Link to comment Share on other sites More sharing options...
xertion Posted August 22, 2012 Share Posted August 22, 2012 I'm also having issues with this. I've read multiple threads about this and tried every solution I can find, however everything ends up the same. I can create the box, but when I press "Add to cart" it only adds 1 in quantity, even if I write 5. I've replaced the code in ajax-cart.js and added the .val(). I've added the quantity box to product-list.tpl I've added some javascript to the top of product-list.tpl that someone suggested I've made sure there is no duplicate ID's in the source code I have also tried to add a alert("Hello World"); to the ajax-cart.js close to where the ajaxCart.add() is being called. However I do not get any alert. It almost seems as if the function is never called actually. I'm running latest version of Prestashop. My current code: ajax-cart.js: $('.ajax_add_to_cart_button').unbind('click').click(function(){ var idProduct = $(this).attr('rel').replace('ajax_id_product_', ''); if ($(this).attr('disabled') != 'disabled') ajaxCart.add(idProduct, null, false, this, $('#quantity_wanted_'+idProduct).val()); return false; }); product-list.tpl: {if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.minimal_quantity == 1 && $product.customizable != 2 && !$PS_CATALOG_MODE} {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" /> <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'}"><span></span>{l s='Add to cart'}</a><br /> {else} <span class="exclusive"><span></span>{l s='Add to cart'}</span><br /> {/if} {/if} 1 Link to comment Share on other sites More sharing options...
daniel_caldarus Posted September 4, 2012 Share Posted September 4, 2012 same issue here. Link to comment Share on other sites More sharing options...
ZeroDay Posted October 4, 2012 Share Posted October 4, 2012 (edited) ... Edited October 21, 2012 by ZeroDay (see edit history) Link to comment Share on other sites More sharing options...
Marco BRUNO Posted October 4, 2012 Share Posted October 4, 2012 (edited) I have tried to insert the code but in prestashop don't 1.5 work? suggestions? {if ($product.allow_oosp || $product.quantity > 0)} {if isset($static_token)} <a class="button ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart',false, NULL, "add&id_product={$product.id_product|intval}&token={$static_token}", true)}" title="{l s='Add to cart'}"><span></span>{l s='Add to cart'}</a> {else} <a class="button ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart',false, NULL, "add&id_product={$product.id_product|intval}", true)} title="{l s='Add to cart'}"><span></span>{l s='Add to cart'}</a> {/if} {else} <span class="exclusive"><span></span>{l s='Add to cart'}</span><br /> {/if} Edited October 4, 2012 by Marco BRUNO (see edit history) Link to comment Share on other sites More sharing options...
Riyal MHH Posted November 11, 2012 Share Posted November 11, 2012 I'm also having issues with this. I've read multiple threads about this and tried every solution I can find, however everything ends up the same. I can create the box, but when I press "Add to cart" it only adds 1 in quantity, even if I write 5. I've replaced the code in ajax-cart.js and added the .val(). I've added the quantity box to product-list.tpl I've added some javascript to the top of product-list.tpl that someone suggested I've made sure there is no duplicate ID's in the source code I have also tried to add a alert("Hello World"); to the ajax-cart.js close to where the ajaxCart.add() is being called. However I do not get any alert. It almost seems as if the function is never called actually. I'm running latest version of Prestashop. My current code: ajax-cart.js: $('.ajax_add_to_cart_button').unbind('click').click(function(){ var idProduct = $(this).attr('rel').replace('ajax_id_product_', ''); if ($(this).attr('disabled') != 'disabled') ajaxCart.add(idProduct, null, false, this, $('#quantity_wanted_'+idProduct).val()); return false; }); product-list.tpl: {if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.minimal_quantity == 1 && $product.customizable != 2 && !$PS_CATALOG_MODE} {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" /> <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'}"><span></span>{l s='Add to cart'}</a><br /> {else} <span class="exclusive"><span></span>{l s='Add to cart'}</span><br /> {/if} {/if} i'm using PS 1.4.7 following change in the ajax-cart.js worked for me //for every 'add' buttons... $('.ajax_add_to_cart_button').unbind('click').click(function(){ var idProduct = $(this).attr('rel').replace('ajax_id_product_', ''); if ($(this).attr('disabled') != 'disabled') ajaxCart.add(idProduct, null, false, this,$('#quantity_wanted_'+ idProduct).val()); //alert($('#quantity_wanted_'+ idProduct).val()); return false; }); Link to comment Share on other sites More sharing options...
silberstern Posted December 11, 2012 Share Posted December 11, 2012 Hi, I have tried this solution for my shop and it didn't work . I am using 1.4.8.2 PS version. I have set an alert to ajax-cart.js file where I have made the change. I do not see that alert. I suppose that that the code I have changed is not called. Has someone some ideas what could go wrong? I have seen that there are other people that also have this problem. Thanks! Link to comment Share on other sites More sharing options...
Rooob Posted December 23, 2012 Share Posted December 23, 2012 OMG thank you! Link to comment Share on other sites More sharing options...
silberstern Posted February 2, 2013 Share Posted February 2, 2013 Hi, Has anybody manage to add more than 1 product to cart by making changes suggested in this thread? Link to comment Share on other sites More sharing options...
autonomie Posted February 17, 2013 Share Posted February 17, 2013 Hi I just try to use in PS 1.5.3 and it works In fact I just change file ajax-cart.js in the /modules/blockcart of prestashop and not in /theme/defaut/js/modules let me tell if it's ok for you thank for all Link to comment Share on other sites More sharing options...
xpasqual Posted February 26, 2013 Share Posted February 26, 2013 Hello, i'm using presta shop 1.5 and works fine for me. Notice that I made some changes... I added else condition {if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.minimal_quantity <= 1 && $product.customizable != 2 && !$PS_CATALOG_MODE} ... {else} {if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && !isset($restricted_country_mode) && $product.minimal_quantity > 1 && $product.customizable != 2 && !$PS_CATALOG_MODE} <input type="hidden" 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" /> {if isset($static_token)} <a class="ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart',false, NULL, "add&id_product={$product.id_product|intval}&token={$static_token}", true)}" title="{l s='Add to cart'}">{l s='Add to cart'}</a> {else} <a class="ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart',false, NULL, "add&id_product={$product.id_product|intval}", true)} title="{l s='Add to cart'}">{l s='Add to cart'}</a> {/if} {/if} Inside this new else I put the same If condition, but remove variable "available_for_order" and set $product.minimal_quantity > 1. These variables combined make disappear "add to cart" button. Is important to remaining checks to ensure that the product is visible, which has no country restrictions, etc. Link to comment Share on other sites More sharing options...
threeopus3 Posted May 9, 2013 Share Posted May 9, 2013 Yes. It works. Link to comment Share on other sites More sharing options...
papich Posted January 30, 2015 Share Posted January 30, 2015 hi someone test in 1.6? 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