lezard Posted March 3, 2017 Share Posted March 3, 2017 Bonjour, j'aimerais permettre a l'utilisateur de choisir sa quantité directement depuis la liste des produits (sans rentrer dans la fiche produit ). J'ai essayer plusieurs technique pour y parvenir cependant le panier ajax ne prends jamais la valeur de l'input ajouté . Le dernier tuto que j'ai suivi est ce lui ci https://mypresta.eu/en/art/prestashop-16/quantity-product-list.html je pense que mon problème viens du thème que j'utilise car d'après les retour la technique fonctionne. je suis sous prestashop 1.6.1.5 Thème optima (version tool) le site est en prod mais je test sur une version en local sous wamp je vous copie les deux bout de code concerné par la modif au cas ou ../themes/pos_optima-tools/js/modules/blockcart/ajax-cart.js : var ajaxCart = { nb_total_products: 0, //override every button in the page in relation to the cart overrideButtonsInThePage : function(){ //for every 'add' buttons... $(document).on('click', '.ajax_add_to_cart_button', function(e){ e.preventDefault(); var idProduct = $(this).data('id-product'); if ($(this).prop('disabled') != 'disabled') ajaxCart.add(idProduct, null, false, this, $('#quantity_to_cart_'+idProduct+'').val()); }); ../themes/pos_optima-tools/js/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 || $product.quantity > 0)} {if isset($static_token)} <input style="font-size:27px; text-align:center; width:30px;" type="text" name="qty" id="quantity_to_cart_{$product.id_product|intval}" value="1"/> <a class="button ajax_add_to_cart_button btn btn-default" href="{$link->getPageLink('cart',false, NULL, 'add=1&id_product={$product.id_product|intval}&token={$static_token}', false)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Add to cart'}" data-id-product="{$product.id_product|intval}"> <span>{l s='Add to cart'}</span> </a> {else} <a class="button ajax_add_to_cart_button btn btn-default" href="{$link->getPageLink('cart',false, NULL, 'add=1&id_product={$product.id_product|intval}', false)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Add to cart'}" data-id-product="{$product.id_product|intval}"> <span>{l s='Add to cart'}</span> </a> {/if} {else} <span class="button ajax_add_to_cart_button btn btn-default disabled"> <span>{l s='Add to cart'}</span> </span> {/if} {/if} Merci d'avance . 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