Post by jerung » Mon May 26, 2014 3:49 am

Hi

I am having trouble making the accordion shift after each time clicking the Continue button, focusing only on the current step, not having to scroll down for the next step.

Lets say after completing the delivery details section and clicking the Continue button, the next step (Delivery Method) will shift the accordion and auto scroll to the top of the browser.

I tried putting the code below in in checkout.tpl but still no luck. Any ideas?

Code: Select all

$('#button-payment-method').live('click', function() {
var y = $(window).scrollTop();  //your current y position on the page



	$.ajax({
		url: 'index.php?route=checkout/payment_method/validate', 
		type: 'post',
		data: $('#payment-method input[type=\'radio\']:checked, #payment-method input[type=\'checkbox\']:checked, #payment-method textarea'),
		dataType: 'json',
		beforeSend: function() {
$('html, body').animate({
        scrollTop: $(window).scrollTop(y+150);
    }, 2000);
			$('#button-payment-method').attr('disabled', true);
			$('#button-payment-method').after('<span class="wait">&nbsp;<img src="catalog/view/theme/default/image/loading.gif" alt="" /></span>');
		},


		complete: function() {
			$('#button-payment-method').attr('disabled', false);
			$('.wait').remove();
		},			
		success: function(json) {
			$('.warning, .error').remove();
			
			if (json['redirect']) {
				location = json['redirect'];
			} else if (json['error']) {
				if (json['error']['warning']) {
					$('#payment-method .checkout-content').prepend('<div class="warning" style="display: none;">' + json['error']['warning'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
					
					$('.warning').fadeIn('slow');
				}			
			} else {
				$.ajax({
					url: 'index.php?route=checkout/confirm',
					dataType: 'html',
					success: function(html) {
						$('#confirm .checkout-content').html(html);
						
						$('#payment-method .checkout-content').slideUp('slow');
						
						$('#confirm .checkout-content').slideDown('slow');
						
						$('#payment-method .checkout-heading a').remove();
						
						$('#payment-method .checkout-heading').append('<a><?php echo $text_modify; ?></a>');	
					},
					error: function(xhr, ajaxOptions, thrownError) {
						alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
					}
				});	
			}
		},
		error: function(xhr, ajaxOptions, thrownError) {
			alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
		}
	});	
});

Newbie

Posts

Joined
Mon May 26, 2014 3:25 am

Post by divij » Wed May 13, 2015 11:23 pm

Hi, I am facing the same issue, did you figure out a solution for this?

Newbie

Posts

Joined
Wed May 13, 2015 6:36 pm
Who is online

Users browsing this forum: No registered users and 57 guests