-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmyparcel.ocmod.xml
executable file
·395 lines (370 loc) · 20.2 KB
/
myparcel.ocmod.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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
<?xml version="1.0" encoding="UTF-8"?>
<modification>
<name>OCMOD MYPARCEL</name>
<version>1.3.9</version>
<code>myparcel</code>
<author>balticode.com</author>
<file path="admin/model/sale/order.php">
<operation>
<search><![CDATA[$sql = "SELECT o.order_id, CONCAT(o.firstname, ' ', o.lastname) AS customer, (SELECT os.name FROM " . DB_PREFIX . "order_status os WHERE os.order_status_id = o.order_status_id AND os.language_id = '" . (int)$this->config->get('config_language_id') . "') AS status, o.shipping_code, o.total, o.currency_code, o.currency_value, o.date_added, o.date_modified FROM `" . DB_PREFIX . "order` o";]]></search>
<add position="after"><![CDATA[
$sql = "SELECT shipping_country_id, o.order_id, CONCAT(o.firstname, ' ', o.lastname) AS customer, (SELECT os.name FROM " . DB_PREFIX . "order_status os WHERE os.order_status_id = o.order_status_id AND os.language_id = '" . (int)$this->config->get('config_language_id') . "') AS status, o.shipping_code, o.total, o.currency_code, o.currency_value, o.date_added, o.date_modified FROM `" . DB_PREFIX . "order` o";
]]></add>
</operation>
</file>
<file path="admin/model/sale/order.php">
<operation>
<search><![CDATA[$sql = "SELECT o.order_id, CONCAT(o.firstname, ' ', o.lastname) AS customer, (SELECT os.name FROM " . DB_PREFIX . "order_status os WHERE os.order_status_id = o.order_status_id AND os.language_id = '" . (int)$this->config->get('config_language_id') . "') AS order_status, o.shipping_code, o.total, o.currency_code, o.currency_value, o.date_added, o.date_modified FROM `" . DB_PREFIX . "order` o";]]></search>
<add position="after"><![CDATA[
$sql = "SELECT shipping_country_id, o.order_id, CONCAT(o.firstname, ' ', o.lastname) AS customer, (SELECT os.name FROM " . DB_PREFIX . "order_status os WHERE os.order_status_id = o.order_status_id AND os.language_id = '" . (int)$this->config->get('config_language_id') . "') AS order_status, o.shipping_code, o.total, o.currency_code, o.currency_value, o.date_added, o.date_modified FROM `" . DB_PREFIX . "order` o";
]]></add>
</operation>
</file>
<!-- This fix is for Opencart version 2.3.0.2 -->
<file path="catalog/controller/common/header.php">
<operation>
<search><![CDATA[$data['telephone'] = $this->config->get('config_telephone');]]></search>
<add position="after"><![CDATA[$data['myparcel_config'] = $this->config;]]></add>
</operation>
</file>
<file path="catalog/controller/checkout/shipping_address.php">
<operation>
<search><![CDATA[$data['button_upload'] = $this->language->get('button_upload');]]></search>
<add position="after"><![CDATA[$data['myparcel_config'] = $this->config;]]></add>
</operation>
</file>
<file path="catalog/controller/checkout/guest_shipping.php">
<operation>
<search><![CDATA[$data['entry_zone'] = $this->language->get('entry_zone');]]></search>
<add position="after"><![CDATA[$data['myparcel_config'] = $this->config;]]></add>
</operation>
</file>
<file path="admin/controller/common/header.php">
<operation>
<search><![CDATA[return $this->load->view('common/header', $data);]]></search>
<add position="before"><![CDATA[if(version_compare(VERSION, '2.3.0.0', '>=')) {
$source_file = DIR_APPLICATION . 'controller/common/myparcel.php';
$destination_folder = DIR_APPLICATION . 'controller/extension/module/';
$destination_file = DIR_APPLICATION . 'controller/extension/module/myparcel.php';
if (!is_file($destination_file) && is_file($source_file)) {
@mkdir($destination_folder, 0777, true);
@copy($source_file, $destination_file);
@unlink(DIR_APPLICATION . 'controller/module/myparcel.php');
}
}
]]></add>
</operation>
</file>
<!-- End fix for Opencart version 2.3.0.2 -->
<file path="admin/controller/sale/order.php">
<operation>
<search><![CDATA[protected function getList() {]]></search>
<add position="after"><![CDATA[
$check_if_table = $this->db->query("SHOW TABLES LIKE '" . DB_PREFIX . "orders_myparcel'");
if ($check_if_table->num_rows < 1)
{
$this->db->query("CREATE TABLE IF NOT EXISTS " . DB_PREFIX . "orders_myparcel (`orders_myparcel_id` int(11) NOT NULL AUTO_INCREMENT, `orders_id` int(11) NOT NULL, `consignment_id` bigint(20) NOT NULL, `retour` tinyint(1) NOT NULL DEFAULT '0', `tracktrace` varchar(32) NOT NULL, `postcode` varchar(6) NOT NULL, `tnt_status` varchar(255) NOT NULL, `tnt_updated_on` datetime NOT NULL, `tnt_final` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`orders_myparcel_id`));");
}
]]></add>
</operation>
<operation>
<search><![CDATA['order_id' => $result['order_id'],]]></search>
<add position="after"><![CDATA[
'vendors' => ($query = "SELECT * FROM `" . DB_PREFIX . "orders_myparcel` WHERE `orders_id` = '" . $result['order_id'] . "'")?$this->db->query( $query ):"",
'countries' => ($queryCountries = "SELECT * FROM `" . DB_PREFIX . "country`")?$this->db->query( $queryCountries ):"",
'shipping_country_id' => $result['shipping_country_id'],
]]></add>
</operation>
</file>
<file path="admin/view/template/sale/order_list.tpl">
<operation>
<search><![CDATA[<td class="text-right"><?php echo $column_action; ?></td>]]></search>
<add position="before"><![CDATA[<td class="text-left" style="text-align: center;">
<span><?php echo "MyParcel Labels"; ?></span>
<?php $_SESSION['MYPARCEL_VISIBLE_CONSIGNMENTS'] = ''; ?>
<script type="text/javascript">var mano_admin_path="<?php echo HTTP_SERVER; ?>"</script>
<script type="text/javascript" src="view/javascript/myparcel_plugin.js"></script>
<input type="checkbox" onclick="selectAllConsignmentsForPrint(this);">
<a class="myparcel-pdf myparight" onclick="return printConsignmentSelection();" href="#">
<img src="<?php echo HTTP_SERVER; ?>model/myparcel/images/myparcel_pdf.png">
</a>
<a class="myparcel-pdf myparight" onclick="return processConsignmentSelection('24');" href="#">
<img src="<?php echo HTTP_SERVER; ?>model/myparcel/images/myparcel_pdf_add.png">
</a>
</td>]]></add>
</operation>
<!-- <operation>
<search><![CDATA[<button type="submit" id="button-shipping" form="form-order" formaction="<?php echo $shipping; ?>" data-toggle="tooltip" title="<?php echo $button_shipping_print; ?>" class="btn btn-info"><i class="fa fa-truck"></i></button>]]></search>
<add position="before"><![CDATA[
<input type="checkbox" onclick="selectAllConsignmentsForPrint(this);">
<a class="myparcel-pdf myparight" onclick="return printConsignmentSelection();" href="#">
<img src="<?php echo HTTP_SERVER; ?>model/myparcel/images/myparcel_pdf.png">
</a>
<a class="myparcel-pdf myparight" onclick="return processConsignmentSelection('24');" href="#">
<img src="<?php echo HTTP_SERVER; ?>model/myparcel/images/myparcel_pdf_add.png">
</a>
]]></add>
</operation> -->
<!-- <operation>
<search><![CDATA[<td><input type="text" name="filter_date_modified" value="<?php echo $filter_date_modified; ?>" size="12" class="date" /></td>]]></search>
<add position="after"><![CDATA[<td class="left" style="text-align: center;">
<input type="checkbox" onclick="selectAllConsignmentsForPrint(this);">
<a class="myparcel-pdf myparight" onclick="return printConsignmentSelection();" href="#">
<img src="<?php echo HTTP_SERVER; ?>model/myparcel/images/myparcel_pdf.png">
</a>
<a class="myparcel-pdf myparight" onclick="return processConsignmentSelection('24');" href="#">
<img src="<?php echo HTTP_SERVER; ?>model/myparcel/images/myparcel_pdf_add.png">
</a>
</td>]]></add>
</operation> -->
<operation>
<search><![CDATA[<?php if ($orders) { ?>]]></search>
<add position="replace"><![CDATA[<?php if ($orders) { $order_inc=0; ?>]]></add>
</operation>
<operation>
<search><![CDATA[<input type="checkbox" name="selected[]" value="<?php echo $order['order_id']; ?>" checked="checked" />]]></search>
<add position="replace"><![CDATA[<input id="cb<?php echo $order_inc++;?>" type="checkbox" name="selected[]" value="<?php echo $order['order_id']; ?>" checked="checked" />]]></add>
</operation>
<operation>
<search><![CDATA[<input type="checkbox" name="selected[]" value="<?php echo $order['order_id']; ?>" />]]></search>
<add position="replace"><![CDATA[<input id="cb<?php echo $order_inc++;?>" type="checkbox" name="selected[]" value="<?php echo $order['order_id']; ?>" />]]></add>
</operation>
<operation>
<search><![CDATA[<td class="text-left" id="date-modified-<?php echo $order['order_id']; ?>"><?php echo $order['date_modified']; ?></td>]]></search>
<add position="after"><![CDATA[<td style="text-align: right;">
<div id="mypa_exist_<?php echo $order['order_id']; ?>" style="display: inline-block;">
<?php
if(isset($order['vendors'])&&is_object($order['vendors']))
{
$vendors = $order['vendors'];
$countries = $order['countries'];
$countryCode = "NL";
for ($i3=0, $m=count( $countries->rows ); $i3 < $m; $i3++)
{
$rowCountry = $countries->rows[$i3];
if($rowCountry['country_id'] == $order['shipping_country_id']){
$countryCode = $rowCountry['iso_code_2'];
}
}
for ($i2=0, $n=count( $vendors->rows ); $i2 < $n; $i2++)
{
$row = $vendors->rows[$i2];
$_SESSION['MYPARCEL_VISIBLE_CONSIGNMENTS'] .= $row['consignment_id'] . '|';
//$mypa_tracktrace_link = 'https://www.postnlpakketten.nl/klantenservice/tracktrace/basicsearch.aspx?lang=nl&B=' . $row['tracktrace'] . '&P=' . $row['postcode'];
$mypa_tracktrace_link = sprintf('http://postnl.nl/tracktrace/?B=%s&D=%s&P=%s&T=C', $row['tracktrace'], $countryCode, $row['postcode']);
$mypa_tnt_status = empty($row['tnt_status']) ? 'Track&Trace' : $row['tnt_status'];
$mypa_pdf_image = ($row['retour'] == 1) ? 'myparcel_retour.png' : 'myparcel_pdf.png';
echo '<div><input type="checkbox" value="' . $row['consignment_id'] . '" class="mypaleft mypacheck" /><a href="' . $mypa_tracktrace_link . '" target="_blank">' . $mypa_tnt_status . '</a><a href="#" onclick="return printConsignments(\'' . $row['consignment_id'] . '\');" class="myparcel-pdf"><img src="'.HTTP_SERVER.'model/myparcel/images/'.$mypa_pdf_image.'" /></a></div>';
}
}
?>
</div>
<span class="mypafunc" style="text-align: right;">
<a onclick="return createNewConsignment('<?php echo $order['order_id']; ?>');" class="myparcel-consignment-new" href="#">
<img src="<?php echo HTTP_SERVER; ?>model/myparcel/images/myparcel_pdf_add.png">
</a>
<a onclick="return createNewConsignment('<?php echo $order['order_id']; ?>', true);" class="myparcel-consignment-retour" href="#">
<img src="<?php echo HTTP_SERVER; ?>model/myparcel/images/myparcel_retour_add.png">
</a>
</span>
</td>]]></add>
</operation>
</file>
<file path="admin/view/template/sale/order_list.tpl">
<operation>
<search><![CDATA[<td class="text-left"><?php echo $order['date_modified']; ?></td>]]></search>
<add position="after"><![CDATA[<td style="text-align: right;">
<div id="mypa_exist_<?php echo $order['order_id']; ?>" style="display: inline-block;">
<?php
if(isset($order['vendors'])&&is_object($order['vendors']))
{
$vendors = $order['vendors'];
$countries = $order['countries'];
$countryCode = "NL";
for ($i3=0, $m=count( $countries->rows ); $i3 < $m; $i3++)
{
$rowCountry = $countries->rows[$i3];
if($rowCountry['country_id'] == $order['shipping_country_id']){
$countryCode = $rowCountry['iso_code_2'];
}
}
for ($i2=0, $n=count( $vendors->rows ); $i2 < $n; $i2++)
{
$row = $vendors->rows[$i2];
$_SESSION['MYPARCEL_VISIBLE_CONSIGNMENTS'] .= $row['consignment_id'] . '|';
//$mypa_tracktrace_link = 'https://www.postnlpakketten.nl/klantenservice/tracktrace/basicsearch.aspx?lang=nl&B=' . $row['tracktrace'] . '&P=' . $row['postcode'];
$mypa_tracktrace_link = sprintf('http://postnl.nl/tracktrace/?B=%s&D=%s&P=%s&T=C', $row['tracktrace'], $countryCode, $row['postcode']);
$mypa_tnt_status = empty($row['tnt_status']) ? 'Track&Trace' : $row['tnt_status'];
$mypa_pdf_image = ($row['retour'] == 1) ? 'myparcel_retour.png' : 'myparcel_pdf.png';
echo '<div><input type="checkbox" value="' . $row['consignment_id'] . '" class="mypaleft mypacheck" /><a href="' . $mypa_tracktrace_link . '" target="_blank">' . $mypa_tnt_status . '</a><a href="#" onclick="return printConsignments(\'' . $row['consignment_id'] . '\');" class="myparcel-pdf"><img src="'.HTTP_SERVER.'model/myparcel/images/'.$mypa_pdf_image.'" /></a></div>';
}
}
?>
</div>
<span class="mypafunc" style="text-align: right;">
<a onclick="return createNewConsignment('<?php echo $order['order_id']; ?>');" class="myparcel-consignment-new" href="#">
<img src="<?php echo HTTP_SERVER; ?>model/myparcel/images/myparcel_pdf_add.png">
</a>
<a onclick="return createNewConsignment('<?php echo $order['order_id']; ?>', true);" class="myparcel-consignment-retour" href="#">
<img src="<?php echo HTTP_SERVER; ?>model/myparcel/images/myparcel_retour_add.png">
</a>
</span>
</td>]]></add>
</operation>
</file>
<file path="catalog/view/theme/*/template/checkout/shipping_address.tpl">
<operation>
<search><![CDATA[<div id="shipping-new" style="display: <?php echo ($addresses ? 'none' : 'block'); ?>;">]]></search>
<add position="after"><![CDATA[<?php
global $config;
if (!$config) {
$config = $myparcel_config;
}
if ($config->get('myparcel_module_frontend')) { ?>
<p>Kies <span onclick="return pakjegemak();" style="cursor: pointer; text-decoration: underline">hier</span> uw locatie indien u het pakket op een PostNL afleverlocatie wil laten bezorgen.</p>
<?php
$username = $config->get('myparcel_module_username');
$api_key = $config->get('myparcel_module_api_key');
$webshop = HTTP_SERVER . 'catalog/view/theme/default/template/module/myparcel-passdata-opencart.html';//JURI::base().DS.'components'.DS.'com_myparcel'.DS. '/myparcel-passdata-virtuemart.html';
$uw_hash = hash_hmac('sha1', $username . 'MyParcel' . $webshop, $api_key);
?>
<script type="text/javascript">
var pg_popup;
function pakjegemak()
{
if(!pg_popup || pg_popup.closed)
{
pg_popup = window.open(
'//www.myparcel.nl/pakjegemak-locatie?hash=<?php echo $uw_hash; ?>&webshop=<?php echo urlencode($webshop); ?>&user=<?php echo $username; ?>',
'myparcel-pakjegemak',
'width=980,height=680,dependent,resizable,scrollbars'
);
if(window.focus) { pg_popup.focus(); }
}
else
{
pg_popup.focus();
}
return false;
}
</script>
<?php } ?>]]></add>
</operation>
</file>
<file path="catalog/view/theme/*/template/checkout/guest_shipping.tpl">
<operation>
<search><![CDATA[<form class="form-horizontal">]]></search>
<add position="before"><![CDATA[<?php
global $config;
if (!$config) {
$config = $myparcel_config;
}
if ($config->get('myparcel_module_frontend')) { ?>
<p>Kies <span onclick="return pakjegemak();" style="cursor: pointer; text-decoration: underline">hier</span> uw locatie indien u het pakket op een PostNL afleverlocatie wil laten bezorgen.</p>
<?php
$username = $config->get('myparcel_module_username');
$api_key = $config->get('myparcel_module_api_key');
$webshop = HTTP_SERVER . 'catalog/view/theme/default/template/module/myparcel-passdata-opencart.html';//JURI::base().DS.'components'.DS.'com_myparcel'.DS. '/myparcel-passdata-virtuemart.html';
$uw_hash = hash_hmac('sha1', $username . 'MyParcel' . $webshop, $api_key);
?>
<script type="text/javascript">
var pg_popup;
function pakjegemak()
{
if(!pg_popup || pg_popup.closed)
{
pg_popup = window.open(
'//www.myparcel.nl/pakjegemak-locatie?hash=<?php echo $uw_hash; ?>&webshop=<?php echo urlencode($webshop); ?>&user=<?php echo $username; ?>',
'myparcel-pakjegemak',
'width=980,height=680,dependent,resizable,scrollbars'
);
if(window.focus) { pg_popup.focus(); }
}
else
{
pg_popup.focus();
}
return false;
}
</script>
<?php } ?>]]></add>
</operation>
</file>
<file path="catalog/controller/module/d_quickcheckout.php">
<ignoreif><![CDATA[// a_vqmod_d_quickcheckout.xml]]></ignoreif>
<operation>
<search><![CDATA[$this->document->addScript('catalog/view/javascript/d_quickcheckout/compress/d_quickcheckout.min.js');]]></search>
<add position="after"><![CDATA[$this->document->addScript('catalog/view/javascript/myparcel/myparcel_frontend.js');]]></add>
</operation>
</file>
<file path="catalog/view/theme/*/template/common/header.tpl">
<ignoreif><![CDATA[// a_vqmod_d_quickcheckout.xml]]></ignoreif>
<operation>
<search><![CDATA[</head>]]></search>
<add position="before"><![CDATA[<?php
global $config;
if (!$config) {
$config = $myparcel_config;
}
if ($config->get('myparcel_module_frontend')) {
$username = $config->get('myparcel_module_username');
$api_key = $config->get('myparcel_module_api_key');
$webshop = HTTP_SERVER . 'catalog/view/theme/default/template/module/myparcel-passdata-opencart.html';
$uw_hash = hash_hmac('sha1', $username . 'MyParcel' . $webshop, $api_key);
$myparcel_url = '//www.myparcel.nl/pakjegemak-locatie?hash=' . $uw_hash . '&webshop=' . urlencode($webshop) . '&user=' . $username;
echo '<script> var MYPARCEL_PAKJEGEMAK_URL = "' . $myparcel_url . '"</script>';
}else{
echo '<script> var MYPARCEL_PAKJEGEMAK_URL = 0;</script>';
}
?>]]></add>
</operation>
</file>
<file path="catalog/view/theme/*/template/common/header.tpl">
</file>
<file path="catalog/view/theme/*/template/journal2/checkout/address_form.tpl">
<operation>
<search><![CDATA[<?php if ($name): ?>]]></search>
<add position="before"><![CDATA[
<?php if ($type == 'shipping') : ?>
<?php
global $config;
if (!$config) {
$config = $myparcel_config;
}
if ($config->get('myparcel_module_frontend')) { ?>
<p>Kies <span onclick="return pakjegemak();" style="cursor: pointer; text-decoration: underline">hier</span> uw locatie indien u het pakket op een PostNL afleverlocatie wil laten bezorgen.</p>
<br/>
<?php
$username = $config->get('myparcel_module_username');
$api_key = $config->get('myparcel_module_api_key');
$webshop = HTTP_SERVER . 'catalog/view/theme/default/template/module/myparcel-passdata-opencart.html';//JURI::base().DS.'components'.DS.'com_myparcel'.DS. '/myparcel-passdata-virtuemart.html';
$uw_hash = hash_hmac('sha1', $username . 'MyParcel' . $webshop, $api_key);
?>
<script type="text/javascript">
var pg_popup;
function pakjegemak()
{
if(!pg_popup || pg_popup.closed)
{
pg_popup = window.open(
'//www.myparcel.nl/pakjegemak-locatie?hash=<?php echo $uw_hash; ?>&webshop=<?php echo urlencode($webshop); ?>&user=<?php echo $username; ?>',
'myparcel-pakjegemak',
'width=980,height=680,dependent,resizable,scrollbars'
);
if(window.focus) { pg_popup.focus(); }
}
else
{
pg_popup.focus();
}
return false;
}
</script>
<?php } ?>
<?php endif; ?>
]]></add>
</operation>
</file>
<!-- JOURNAL THEME -->
<!---->
</modification>