<?xml version="1.0" encoding="UTF-8" ?>
- <modification>
<id>Buy Now</id>
<name>Buy Now</name>
<code>buy_now</code>
<version>1.0</version>
<author>SK</author>
<link>https://www.opencart.com/</link>
- <file path="catalog/view/theme/*/template/product/product.twig">
- <operation>
- <search>
- <![CDATA[ <button type="button" id="button-cart" data-loading-text="
]]>
</search>
- <add position="before">
- <![CDATA[ <button type="button" id="button-checkout" data-loading-text="{{ text_loading }}" class="btn btn-primary btn-lg btn-block">Buy Now</button>
]]>
</add>
</operation>
- <operation>
- <search>
- <![CDATA[ $('#button-cart').on('click', function() {
]]>
</search>
- <add position="before">
- <![CDATA[ $('#button-checkout').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-checkout').button('loading');
},
complete: function() {
$('#button-checkout').button('reset');
},
success: function(json) {
$('.alert-dismissible, .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'] + '</div>');
} else {
element.after('<div class="text-danger">' + json['error']['option'] + '</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']) {
$('.breadcrumb').after('<div class="alert alert-success alert-dismissible">' + json['success'] + '<button type="button" class="close" data-dismiss="alert">×</button></div>');
$('#cart > button').html('<span id="cart-total"><i class="fa fa-shopping-cart"></i> ' + json['total'] + '</span>');
$('html, body').animate({ scrollTop: 0 }, 'slow');
window.location.href = "index.php?route=checkout/checkout";
}
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
});
]]>
</add>
</operation>
</file>
</modification>
Hello Guys i am new here
i don't know how to download any from here
please help
- <modification>
<id>Buy Now</id>
<name>Buy Now</name>
<code>buy_now</code>
<version>1.0</version>
<author>SK</author>
<link>https://www.opencart.com/</link>
- <file path="catalog/view/theme/*/template/product/product.twig">
- <operation>
- <search>
- <![CDATA[ <button type="button" id="button-cart" data-loading-text="
]]>
</search>
- <add position="before">
- <![CDATA[ <button type="button" id="button-checkout" data-loading-text="{{ text_loading }}" class="btn btn-primary btn-lg btn-block">Buy Now</button>
]]>
</add>
</operation>
- <operation>
- <search>
- <![CDATA[ $('#button-cart').on('click', function() {
]]>
</search>
- <add position="before">
- <![CDATA[ $('#button-checkout').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-checkout').button('loading');
},
complete: function() {
$('#button-checkout').button('reset');
},
success: function(json) {
$('.alert-dismissible, .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'] + '</div>');
} else {
element.after('<div class="text-danger">' + json['error']['option'] + '</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']) {
$('.breadcrumb').after('<div class="alert alert-success alert-dismissible">' + json['success'] + '<button type="button" class="close" data-dismiss="alert">×</button></div>');
$('#cart > button').html('<span id="cart-total"><i class="fa fa-shopping-cart"></i> ' + json['total'] + '</span>');
$('html, body').animate({ scrollTop: 0 }, 'slow');
window.location.href = "index.php?route=checkout/checkout";
}
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
});
]]>
</add>
</operation>
</file>
</modification>
Post automatically merged:
Hello Guys i am new here
i don't know how to download any from here
please help