prestashop 1.6通过javascript从tpl产品列表中获取值
我正在使用prestashop 1.6,我正在努力实现以下目标: -在产品列表中,我创建了一个添加数量按钮prestashop 1.6通过javascript从tpl产品列表中获取值,javascript,jquery,task-parallel-library,prestashop,smarty,Javascript,Jquery,Task Parallel Library,Prestashop,Smarty,我正在使用prestashop 1.6,我正在努力实现以下目标: -在产品列表中,我创建了一个添加数量按钮 <!------------------------ quantity wanted ----------------------------------------------> {if !$PS_CATALOG_MODE} <p class="quantity_wanted_p_"{if (!$allow_oosp &&
<!------------------------ quantity wanted ---------------------------------------------->
{if !$PS_CATALOG_MODE}
<p class="quantity_wanted_p_"{if (!$allow_oosp && $product->quantity <= 0) || !$product->available_for_order || $PS_CATALOG_MODE} style="display: block;"{/if}>
<!-- <label>{l s='Quantity'}</label> -->
<a class="btn button-minus product_quantity_down decrement_qty" data-field-qty="{$product.minimal_quantity}">
<span><i class="icon-minus"></i></span>
</a>
<input type="number" min="1" name="qty" id="quantity_wanted_{$product.id_product|intval}" class="text inputqtyfield" value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}{if $product.minimal_quantity > 1}{$product.minimal_quantity}{else}1{/if}{/if}" />
<span class="minQty" style="display:none;">{$product.minimal_quantity}</span>
<a class="btn button-plus product_quantity_up increment_qty">
<span><i class="icon-plus"></i></span>
</a>
<span class="clearfix"></span>
</p>
{/if}
$(文档).ready(函数(){
$('.increment_qty')。单击(函数(){
var oldVal=$(this.parent().find(“input”).val();
if(parseFloat(oldVal)>=0){
var newVal=parseFloat(oldVal)+1;
$(this.parent().find(“input”).val(newVal);
}})) }))
/////quantities in default product list
$('.decrement_qty').click(function() {
var oldVal = jQuery(this).parent().find("input").val();
if ( parseFloat(oldVal) >= 1 ) {
var newVal = parseFloat(oldVal) - 1;
$(this).parent().find("input").val(newVal);
}
});