Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Модальное окно оформления заказа


 Share

Recommended Posts

Всем привет , подскажите пожалуйста , можно ли как то сделать оформление заказа в модельном окне ?
Не корзину , а само оформление заказа checkout/checkout ?
Что бы нажимая на кнопку купить в карточке товара , не переходило на страницу checkout/checkout а подгружалась на этой же странице.
Полазив в нете , понял , что надо через jquery , onclick .load **** 
Но зашёл в тупик , увидев внизу , в карточке товара скрипт отправляющий данные в корзину , там стоит url на страницу index.php?route=checkout/cart/add 

И теперь понятия не имею как это сообразить .
Прошу у вас помощи или хотя бы направление , куда правильно копать .
Спасибо .
 


 

<script type="text/javascript"><!--
$('#button-cart').on('click', function() {
	$.ajax({
		url: 'index.php?route=checkout/cart/add',
		type: 'post',
		data: $('#product input[type=\'text\'], #product input[type=\'hidden\'], #product input[type=\'radio\']:checked, #product input[type=\'checkbox\']:checked, #product select, #product textarea'),
		dataType: 'json',
		beforeSend: function() {
			$('#button-cart').button('loading');
		},
		complete: function() {
			$('#button-cart').button('reset');
		},
		success: function(json) {
			$('.alert, .text-danger').remove();
			$('.form-group').removeClass('has-error');

			if (json['error']) {
				if (json['error']['option']) {
					for (i in json['error']['option']) {
						var element = $('#input-option' + i.replace('_', '-'));

						if (element.parent().hasClass('input-group')) {
							element.parent().after('<div class="text-danger">' + json['error']['option'][i] + '</div>');
						} else {
							element.after('<div class="text-danger">' + json['error']['option'][i] + '</div>');
						}
					}
				}

				if (json['error']['recurring']) {
					$('select[name=\'recurring_id\']').after('<div class="text-danger">' + json['error']['recurring'] + '</div>');
				}

				$('.text-danger').parent().addClass('has-error');
			}			
			
			if (json['success']) {
				$('#notification').html('<div class="success" style="display: none;">' + json['success'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
				
				$('.success').fadeIn('slow');
				
				$('#cart_total').html(json['total']);
				
				
        
        window.location.href = 'index.php?route=checkout/cart';
			}	
			
			
			
		},
        error: function(xhr, ajaxOptions, thrownError) {
            alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
        }
	});
});
//--></script>

 

Link to comment
Share on other sites


14 часов назад, ssoundslider сказал:

Всё , разобрался )
Чёт сразу не увидел :


 window.location.href = 'index.php?route=checkout/cart';
$("#new_cart").on('click', function() {
  $('#modal_cart').modal('show');
  $('.simple').load('index.php?route=checkout/simplecheckout&popup=1');
});

вот держи сделай как тут и все будет

Link to comment
Share on other sites


  • 9 months later...
  • 8 months later...
В 05.02.2020 в 11:21, AUSS сказал:

$("#new_cart").on('click', function() {
  $('#modal_cart').modal('show');
  $('.simple').load('index.php?route=checkout/simplecheckout&popup=1');
});

вот держи сделай как тут и все будет

Поподробней можно? Только не через модуль simple оформление заказа. 

Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.