Victor Castro Contreras Posted January 23, 2017 Share Posted January 23, 2017 (edited) PASO1 Ingresa este código: \themes\tu_template\product-list.tpl <div class="s_quantity_wanted"> <span class="s_quantity_input_wrap clearfix"> <a href="#" class="s_product_quantity_down">-</a> <input type="text" min="1" name="qty" class="s_product_quantity_{$product.id_product}" value="{if $product.product_attribute_minimal_quantity > 1}{$product.product_attribute_minimal_quantity}{else}1{/if}" /> <a href="#" class="s_product_quantity_up">+</a> </span> </div> PASO 2 Ahora a modificar los Javascripts, añade este código: \themes\tu_template\js\modules\blockcart\ajax-cart.js var quantity_wanted = $(this).closest('.ajax_block_product').find('input[name=qty]').val(); if (!quantity_wanted) quantity_wanted = 1; ... ajaxCart.add(idProduct, idProductAttribute, false, this, (minimalQuantity > quantity_wanted ? minimalQuantity : quantity_wanted)); Quedando finalmente así: \themes\tu_template\js\modules\blockcart\ajax-cart.js $(document).off('click', '.ajax_add_to_cart_button').on('click', '.ajax_add_to_cart_button', function(e){ e.preventDefault(); var idProduct = parseInt($(this).data('id-product')); var idProductAttribute = parseInt($(this).data('id-product-attribute')); var minimalQuantity = parseInt($(this).data('minimal_quantity')); if (!minimalQuantity) minimalQuantity = 1; var quantity_wanted = $(this).closest('.ajax_block_product').find('input[name=qty]').val(); if (!quantity_wanted) quantity_wanted = 1; if ($(this).prop('disabled') != 'disabled') ajaxCart.add(idProduct, idProductAttribute, false, this, (minimalQuantity > quantity_wanted ? minimalQuantity : quantity_wanted)); }); PASO 3 Finalmente solo queda darle un poco de css \themes\tu_template\css\global.css .s_quantity_input_wrap { display: inline-block; position: relative; vertical-align: middle; padding-right: 16px; } .s_product_quantity_up, .s_product_quantity_down { display: inline-block; width: 20px; height: 20px; line-height: 18px; background: #ffffff; border: 1px solid #CCCCCC; border-left-width: 0; text-align: center; position: absolute; right: 0; } .s_quantity_wanted input { border: 1px solid #e5e5e5; text-align: center; width: 32px; height: 32px; line-height: 26px; padding: 0 2px; } .s_product_quantity_up, .s_product_quantity_down { width: 16px; height: 16px; line-height: 14px; } .s_product_quantity_down { bottom: 0; } .s_product_quantity_up { top: 0; } Edited January 23, 2017 by Victor Castro Contreras (see edit history) Link to comment Share on other sites More sharing options...
cobrax13 Posted February 8, 2018 Share Posted February 8, 2018 Buenos días, he probado su código tal y como indica pero al clicar en el + y el - la Web lo que hace es subir y no cambia nada, se queda como estaba. He puesto tal cual el código en product-list.tpl y editado las filas correspondientes en ajax-cart.js ¿Es posible que haga falta alguna referencia en algún sitio al fichero product.js que es en el que se hace referencia a product_quantity_up y product_quantity_down? 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