Post by fmchristiansen » Sun Aug 18, 2013 8:54 pm

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


Posts

Joined
Sun Aug 18, 2013 8:22 pm

Post by fmchristiansen » Mon Sep 02, 2013 11:28 pm

Am i in the wrong forum?


Posts

Joined
Sun Aug 18, 2013 8:22 pm

Post by CZechBoY » Mon Sep 02, 2013 11:42 pm

you can insert quantity:2 and then add to cart

Mass update product descriptions/Hromadná změna popisků zboží


User avatar
Active Member

Posts

Joined
Mon Mar 19, 2012 1:39 am
Location - Europe, Czech republic; Hradec Králové, Brno

Post by fmchristiansen » Wed Sep 04, 2013 1:46 am

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?


Posts

Joined
Sun Aug 18, 2013 8:22 pm

Post by Qphoria » Wed Sep 04, 2013 3:21 am

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.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by dazzul » Wed Feb 21, 2018 9:20 pm

Hello, Would this fix work with v2.3.0.2?

Thanks

New member

Posts

Joined
Mon Feb 10, 2014 3:42 am

Post by IP_CAM » Fri Feb 23, 2018 5:17 am

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

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland
Who is online

Users browsing this forum: No registered users and 29 guests