Page 1 of 1

aanpassen code

Posted: Tue Aug 13, 2013 1:29 pm
by danny1515
Om een of andere reden wordt het aantal stuks niet verrekend in de winkelwagen.
Bij klikken op toevoegen neemt ie maar 1 stuk ipv het aantal ingevuld.
code hiervan:

Code: Select all

 	
<tr>
<td class="prijs-box">
</script> 
<script type="text/javascript"><!--
jQuery(document).ready(function(){
    // This button will increment the value
    $('.qtyplus').click(function(e){
        // Stop acting like a button
        e.preventDefault();
        // Get the field name
        quant = $(this).attr('field');
        // Get its current value
        var currentVal = parseInt($('input[name='+quant+']').val());
        // If is not undefined
        if (!isNaN(currentVal)) {
            // Increment
            $('input[name='+quant+']').val(currentVal + 1);
        } else {
            // Otherwise put a 0 there
            $('input[name='+quant+']').val(1);
        }
    });
    // This button will decrement the value till 0
    $(".qtyminus").click(function(e) {
        // Stop acting like a button
        e.preventDefault();
        // Get the field name
        quant = $(this).attr('field');
        // Get its current value
        var currentVal = parseInt($('input[name='+quant+']').val());
        // If it isn't undefined or its greater than 0
        if (!isNaN(currentVal) && currentVal > 1) {
            // Decrement one
            $('input[name='+quant+']').val(currentVal - 1);
        } else {
            // Otherwise put a 0 there
            $('input[name='+quant+']').val(1);
        }
    });
});

//--></script> 
<div class="cart">
<div><?php echo $text_qty; ?>
    <input type='button' value='-' class='qtyminus' field='quantity' />
    <input type="text" name="quantity" size="2" value="<?php echo $minimum; ?>" class="qty" ;/>
	
    <input type='button' value='+' class='qtyplus' field='quantity' >
  <input type="hidden" name="product_id" size="2" value="<?php echo $product_id; ?>" />
<input type='hidden' value="<?php echo $button_cart; ?>" id="button-cart" class="button" />
                       
	<a onclick="addToCart('<?php echo $product_id; ?>');"><div class="button-product">Toevoegen aan winkelmandje</div>
<a onclick="addToCompare('<?php echo $product_id; ?>');"><div class="button-vergelijking">Toevoegen aan productvergelijking</div></a>

</td>
</tr>

 </table>
</div>

Ook zou het "aantal vakje" binnenin het "toevoegen aan winkelmandje moeten komen"
Kan iemand mij helpen met het aanpassen van de code.

Re: aanpassen code

Posted: Wed Aug 14, 2013 4:11 am
by victorj
probeer eerst eens wat er gebeurt, als je tijdelijk even test met default template.
werkt het daar wel, zo ja dan is het een template probleem.