Page 1 of 1

Clear options after pressing "add to cart"

Posted: Sun Aug 18, 2013 8:54 pm
by fmchristiansen
Hello

I am building a website where i sell engraved tags. I am using text fields for the customer to specify their engraving wishes. If the customers wants to buy the same item twice or more they need to delete the field before inserting new text. This is not optimal, I therefore need the textbox option fields to clear after pressing "add to cart".

Any solutions, ideas?

Regards
Frederik

Re: Clear options after pressing "add to cart"

Posted: Mon Sep 02, 2013 11:28 pm
by fmchristiansen
Am i in the wrong forum?

Re: Clear options after pressing "add to cart"

Posted: Mon Sep 02, 2013 11:42 pm
by CZechBoY
you can insert quantity:2 and then add to cart

Re: Clear options after pressing "add to cart"

Posted: Wed Sep 04, 2013 1:46 am
by fmchristiansen
My problem is when the customer wants the same product twice, but with differents engravings. As it is now, the customer need to clear all the text fields and enter the new text. Then pressing add to cart again. I therefore seek to way to clear all options after pressing add to cart.

Any ideas?

Re: Clear options after pressing "add to cart"

Posted: Wed Sep 04, 2013 3:21 am
by Qphoria
Tested on 1.5.5.1 and 1.5.6

1. EDIT: catalog/view/theme/default/template/product/product.tpl

2. FIND:

Code: Select all

$('#button-cart').bind('click', function() {
	$.ajax({
		url: 'index.php?route=checkout/cart/add',
		type: 'post',
		data: $('.product-info input[type=\'text\'], .product-info input[type=\'hidden\'], .product-info input[type=\'radio\']:checked, .product-info input[type=\'checkbox\']:checked, .product-info select, .product-info textarea'),
		dataType: 'json',
		success: function(json) {


3. REPLACE WITH:

Code: Select all

$('#button-cart').bind('click', function() {
	$.ajax({
		url: 'index.php?route=checkout/cart/add',
		type: 'post',
		data: $('.product-info input[type=\'text\'], .product-info input[type=\'hidden\'], .product-info input[type=\'radio\']:checked, .product-info input[type=\'checkbox\']:checked, .product-info select, .product-info textarea'),
		dataType: 'json',
		success: function(json) {
			$('input[name^=option][type=text]').val('');
			$('input[name^=option][type=radio]').prop("checked", false).end().buttonset("refresh");
			$('select[name^=option]').each(function() { this.selectedIndex = 0; });
			$('input[name^=option][type=checkbox]').prop("checked", false).end().buttonset("refresh");
			$('textarea[name^=option]').val('');
Be sure not to alter the rest of the code in that section.

Re: Clear options after pressing "add to cart"

Posted: Wed Feb 21, 2018 9:20 pm
by dazzul
Hello, Would this fix work with v2.3.0.2?

Thanks

Re: Clear options after pressing "add to cart"

Posted: Fri Feb 23, 2018 5:17 am
by IP_CAM
Well, the best way, to find out, would be to just try ut out... :laugh:
You cannot ruin anything, as long as you keep a backup-file.
Ernie