#26 – Problem with the checkboy them

Posted in ‘Candies’
This is a public ticket. Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.
 Hi

We use the checkbox them, but it doesn`t work correct.
When i check only one item and press on add to cart, all products added to the cart.
What can be the problem?
our website is http://web954.login-10.loginserver.ch/www/beachflags/beachflag-mit-vorgegebenen-motiven/beachflag-coiffure-detail
You can see it when you klick on the button Spezifikation.

Thanks and best regards
Aleso
Hi Alexandros,

Yes, I found issue. Problem is that checkbox layout was only made for default quantity = 0 and you have set it to 1.

Well, that is correct and logical, but I forgot to prepare code to handle this.

I already uploaded new checkbox layout, so download it again.

Also, you will need to replace a little code in plugins/vmcustom/catproduct/catproduct/js/javascript.js right on top

Replace:
	jQuery("#catproduct_form input[id^='quantity_']").each(function() {	
		noQ = jQuery(this).attr('id').replace('quantity_','');
		if (jQuery('#def_group_qty_'+noQ).val()) {
			jQuery(this).val(jQuery('#def_group_qty_'+noQ).val());
		} else {
			jQuery(this).val(0);
		}
		
		jQuery(this).attr("checked",false);
		updateSumPrice(noQ);
	});
with
	jQuery("#catproduct_form input[id^='quantity_']").each(function() {	
		noQ = jQuery(this).attr('id').replace('quantity_','');
		if (jQuery(this).attr("type") == "checkbox") {
			jQuery(this).attr("checked",false);
			jQuery(this).val(0);
		} else {
			if (jQuery('#def_group_qty_'+noQ).val()) {
				jQuery(this).val(jQuery('#def_group_qty_'+noQ).val());
			} else {
				jQuery(this).val(0);
			}
		}
		updateSumPrice(noQ);
	});
Best Regards,
Maja
maja_mlinar

About the author

Who‘s behind this

Demo

Maja Mozina Mlinar

founder
Demo

Sandi Mlinar

procurator

info@sm-planet.net

Skype: maja.mozina1