Opencart Buy Now Button 3.x FREE

naga.sate

New member
XNullUser
Joined
May 14, 2020
Messages
3
Reaction score
4
Points
3
NullCash
21
<?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">&times;</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
 

Attachments

  • Buy-Now-3X.ocmod_.zip
    1.2 KB · Views: 6

said

New member
XNullUser
Joined
Oct 20, 2018
Messages
11
Reaction score
5
Points
3
NullCash
7
Code looks good, will try this out
 

nanosim

Member
XNullUser
Joined
Oct 2, 2020
Messages
147
Reaction score
0
Points
16
NullCash
3
Hello, thank you very much
 

Sikoniopuis

New member
XNullUser
Joined
Apr 23, 2021
Messages
4
Reaction score
0
Points
1
NullCash
9
Thanks for the sharing
 

dani72

New member
XNullUser
Joined
Apr 25, 2021
Messages
8
Reaction score
0
Points
1
NullCash
9
Thanks for the sharing, this extension for fast order, best.
 

ehuehi

Member
XNullUser
Joined
Nov 14, 2020
Messages
63
Reaction score
0
Points
6
NullCash
20
Hello, thank you very much
I need this addon, thank you for sharing it
 

kordiak

Member
XNullUser
Joined
Aug 2, 2022
Messages
678
Reaction score
10
Points
18
NullCash
5
Hello, thank you very much
I need this addon, thank you for sharing it
 
Top