I use Prestshop 1.6. How can i add the product quantity field and increase, decrease buttons per product in the dropdown cart ?
I added the code below inside the /themes/community-theme-default/modules/blockcart/includes/dropdown.tpl file but worked partially.
Here is the code:
<td class="cart_quantity text-center" data-title="{l s='Quantity'}"> {if (isset($cannotModify) && $cannotModify == 1)} <span> {if $quantityDisplayed == 0 AND isset($customizedDatas.$productId.$productAttributeId)} {$product.customizationQuantityTotal} {else} {$product.cart_quantity-$quantityDisplayed} {/if} </span> {else} {if isset($customizedDatas.$productId.$productAttributeId) AND $quantityDisplayed == 0} <span id="cart_quantity_custom_{$product.id_product}_{$product.id_product_attribute}_{$product.id_address_delivery|intval}" >{$product.customizationQuantityTotal}</span> {/if} {if !isset($customizedDatas.$productId.$productAttributeId) OR $quantityDisplayed > 0} <input type="hidden" value="{if $quantityDisplayed == 0 AND isset($customizedDatas.$productId.$productAttributeId)}{$customizedDatas.$productId.$productAttributeId|@count}{else}{$product.cart_quantity-$quantityDisplayed}{/if}" name="quantity_{$product.id_product}_{$product.id_product_attribute}_{if $quantityDisplayed > 0}nocustom{else}0{/if}_{$product.id_address_delivery|intval}_hidden"> <input size="2" type="text" autocomplete="off" class="cart_quantity_input form-control text-center" value="{if $quantityDisplayed == 0 AND isset($customizedDatas.$productId.$productAttributeId)}{$customizedDatas.$productId.$productAttributeId|@count}{else}{$product.cart_quantity-$quantityDisplayed}{/if}" name="quantity_{$product.id_product}_{$product.id_product_attribute}_{if $quantityDisplayed > 0}nocustom{else}0{/if}_{$product.id_address_delivery|intval}"> <div class="cart_quantity_button clearfix"> {if $product.minimal_quantity < ($product.cart_quantity-$quantityDisplayed) OR $product.minimal_quantity <= 1} <a rel="nofollow" class="cart_quantity_down btn btn-default button-minus" id="cart_quantity_down_{$product.id_product}_{$product.id_product_attribute}_{if $quantityDisplayed > 0}nocustom{else}0{/if}_{$product.id_address_delivery|intval}" href="{$link->getPageLink('cart', true, NULL, "add=1&id_product={$product.id_product|intval}&ipa={$product.id_product_attribute|intval}&id_address_delivery={$product.id_address_delivery|intval}&op=down&token={$token_cart}")|escape:'html':'UTF-8'}" title="{l s='Subtract'}"> <i class="icon icon-fw icon-minus"></i> </a> {else} <a class="cart_quantity_down btn btn-default button-minus disabled" href="#" id="cart_quantity_down_{$product.id_product}_{$product.id_product_attribute}_{if $quantityDisplayed > 0}nocustom{else}0{/if}_{$product.id_address_delivery|intval}" title="{l s='You must purchase a minimum of %d of this product.' sprintf=$product.minimal_quantity}"> <i class="icon icon-fw icon-minus"></i> </a> {/if} <a rel="nofollow" class="cart_quantity_up btn btn-default button-plus" id="cart_quantity_up_{$product.id_product}_{$product.id_product_attribute}_{if $quantityDisplayed > 0}nocustom{else}0{/if}_{$product.id_address_delivery|intval}" href="{$link->getPageLink('cart', true, NULL, "add=1&id_product={$product.id_product|intval}&ipa={$product.id_product_attribute|intval}&id_address_delivery={$product.id_address_delivery|intval}&token={$token_cart}")|escape:'html':'UTF-8'}" title="{l s='Add'}"><i class="icon icon-fw icon-plus"></i></a> </div> {/if} {/if} </td>
The problem is that it works only if you visit checkout page. I noticed that this happens because the (+, -) quantity buttons need to call some events that are included in the file: /themes/community-theme-default/js/cart-summary.js, but the file cart-summary.js is called only when you visit the checkout page. How can i make this work as i need it on my custom theme?
Thanks in advance.