-
Notifications
You must be signed in to change notification settings - Fork 4
/
install.oc2.xml
160 lines (145 loc) · 6.12 KB
/
install.oc2.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<?xml version="1.0" encoding="utf-8"?>
<modification>
<name>foc_addtocart_box</name>
<code>foc_addtocart_box</code>
<version>2.1.0.0</version>
<author>ikenfin</author>
<link>http://freeocart.ru</link>
<file path="catalog/controller/common/header.php">
<operation>
<search><![CDATA[return $this->load->view('common/header', $data);]]></search>
<add position="before"><![CDATA[
/* foc_add2cart_box code */
$this->load->model('extension/module/foc_add2cart_box');
$data['foc_add2cart_box_enabled'] = $this->model_extension_module_foc_add2cart_box->isEnabled();
if ($data['foc_add2cart_box_enabled']) {
// variables for title/content text
$foc_add2cart_box_urls = array(
'site_name' => $this->config->get('config_name'),
'site_logo' => $data['logo'],
'site_phone' => $this->config->get('config_telephone'),
'url_cart' => $this->url->link('checkout/cart'),
'url_checkout' => $this->url->link('checkout/checkout'),
'url_history' => $this->url->link('account/order'),
'url_wishlist' => $this->url->link('account/wishlist'),
'url_voucher' => $this->url->link('account/voucher'),
'url_contact' => $this->url->link('information/contact'),
'url_manufacturer' => $this->url->link('product/manufacturer'),
'url_specials' => $this->url->link('product/special'),
'url_home' => $this->url->link('common/home')
);
$data['foc_add2cart_box_title'] = $this->model_extension_module_foc_add2cart_box->getModalTitle($foc_add2cart_box_urls);
$data['foc_add2cart_box_content'] = $this->model_extension_module_foc_add2cart_box->getModalContent($foc_add2cart_box_urls);
$data['foc_add2cart_box_autoclose_time'] = $this->model_extension_module_foc_add2cart_box->getAutocloseTime();
$this->document->addScript('catalog/view/javascript/jquery/magnific/jquery.magnific-popup.min.js');
$this->document->addStyle('catalog/view/javascript/jquery/magnific/magnific-popup.css');
$data['styles'] = $this->document->getStyles();
$data['scripts'] = $this->document->getScripts();
}
/* end foc_add2cart_box code */
]]></add>
</operation>
</file>
<file path="catalog/view/theme/*/template/common/header.tpl">
<operation>
<search><![CDATA[<body]]></search>
<add position="after"><![CDATA[
<?php if ($foc_add2cart_box_enabled) : ?>
<style>
.foc-add2cart-box-popup {
position: relative;
background: #FFF;
padding: 20px;
width:auto;
max-width: 500px;
margin: 20px auto;
}
</style>
<div id="foc_add2cart_box" class="foc-add2cart-box-popup white-popup mfp-hide">
<?php if ($foc_add2cart_box_title) : ?>
<h1><?php echo $foc_add2cart_box_title; ?></h1>
<?php endif; ?>
<?php echo $foc_add2cart_box_content; ?>
</div>
<script>
$(function () {
$(document).on('click', '.popup-modal-dismiss', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
window.foc_add2cart_box_open_modal = function () {
$.magnificPopup.open({
items: {
type:'inline',
src:'#foc_add2cart_box'
},
removalDelay: 500
});
<?php if (is_numeric($foc_add2cart_box_autoclose_time) && $foc_add2cart_box_autoclose_time > 0) : ?>
setTimeout($.magnificPopup.close, <?php echo $foc_add2cart_box_autoclose_time * 1000; ?>);
<?php endif; ?>
}
});
</script>
<?php else : ?>
<script>
window.foc_add2cart_box_open_modal = function () {
$('html, body').animate({ scrollTop: 0 }, 'slow');
}
</script>
<?php endif; ?>
]]></add>
</operation>
<operation>
<search><![CDATA[</head>]]></search>
<add position="before"><![CDATA[
<?php if ($foc_add2cart_box_enabled) : ?>
<script>
window.cart.add = function (product_id, quantity) {
$.ajax({
url: 'index.php?route=checkout/cart/add',
type: 'post',
data: 'product_id=' + product_id + '&quantity=' + (typeof(quantity) != 'undefined' ? quantity : 1),
dataType: 'json',
beforeSend: function() {
$('#cart > button').button('loading');
},
complete: function() {
$('#cart > button').button('reset');
},
success: function(json) {
$('.alert, .text-danger').remove();
if (json['redirect']) {
location = json['redirect'];
}
if (json['success']) {
$('#content').parent().before('<div class="alert alert-success"><i class="fa fa-check-circle"></i> ' + json['success'] + ' <button type="button" class="close" data-dismiss="alert">×</button></div>');
// Need to set timeout otherwise it wont update the total
setTimeout(function () {
$('#cart > button').html('<span id="cart-total"><i class="fa fa-shopping-cart"></i> ' + json['total'] + '</span>');
$('#total').text(parseInt(json['total']));
}, 100);
window.foc_add2cart_box_open_modal();
//$('html, body').animate({ scrollTop: 0 }, 'slow');
$('#cart > ul').load('index.php?route=common/cart/info ul li');
}
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
}
</script>
<?php endif; ?>
]]></add>
</operation>
</file>
<file path="catalog/view/theme/*/template/product/product.tpl">
<operation>
<search><![CDATA[$('html, body').animate({ scrollTop: 0 }, 'slow');]]></search>
<add position="replace"><![CDATA[
window.foc_add2cart_box_open_modal();
]]></add>
</operation>
</file>
</modification>