Skip to content

Commit 98c29df

Browse files
author
Rick Wong
committed
Release 5.1.4
+ Now with support for Joomla-based OpenCart installations! + For users with PHP 5.2 or older this fixes a regression bug.
1 parent 9891570 commit 98c29df

File tree

9 files changed

+173
-156
lines changed

9 files changed

+173
-156
lines changed

admin/controller/payment/mollie_ideal.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ protected function _checkModuleStatus()
293293
/**
294294
* Version of the plugin.
295295
*/
296-
const PLUGIN_VERSION = "5.1.3";
296+
const PLUGIN_VERSION = "5.1.4";
297297

298298
/**
299299
* @var Mollie_API_Client

admin/view/template/payment/mollie_ideal.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
<div class="heading">
2929
<h1><img src="view/image/payment.png" alt="" /> <?php clean_echo($heading_title) ?></h1>
30-
<div class="buttons"><a onclick="$('#form').submit()" class="button"><span><?php clean_echo($button_save) ?></span></a><a href="<?php clean_echo($cancel) ?>" class="button"><span><?php clean_echo($button_cancel) ?></span></a></div>
30+
<div class="buttons"><a onclick="(window.jQuery || window.$)('#form').submit()" class="button"><span><?php clean_echo($button_save) ?></span></a><a href="<?php clean_echo($cancel) ?>" class="button"><span><?php clean_echo($button_cancel) ?></span></a></div>
3131
</div>
3232

3333
<div class="content">

catalog/controller/payment/mollie_ideal.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class ControllerPaymentMollieIdeal extends Controller
5252
/**
5353
* Version of the plugin.
5454
*/
55-
const PLUGIN_VERSION = "5.1.3";
55+
const PLUGIN_VERSION = "5.1.4";
5656

5757
/**
5858
* @var Mollie_API_Client

catalog/model/payment/mollie_ideal.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class ModelPaymentMollieIdeal extends Model
4444
/**
4545
* Version of the plugin.
4646
*/
47-
const PLUGIN_VERSION = "5.1.3";
47+
const PLUGIN_VERSION = "5.1.4";
4848

4949
/**
5050
* @var Mollie_API_Client
@@ -191,9 +191,17 @@ public function getMethod ($address, $total)
191191
$base_url = $this->config->get('config_url');
192192
}
193193

194+
/**
195+
* FIX for Joomla-based OpenCart.
196+
*/
197+
if (preg_match('~(/.+/com_opencart)/catalog~iu', __FILE__, $matches))
198+
{
199+
$base_url = $matches[1];
200+
}
201+
194202
// Add some javascript to make it seem as if all Mollie methods are top level.
195203
$js = '<script type="text/javascript" src="' . rtrim($base_url, '/') . '/catalog/view/javascript/mollie_methods.js"></script>';
196-
$js .= '<script type="text/javascript">'.'(function () {';
204+
$js .= '<script type="text/javascript">'.'(function ($) {';
197205

198206
$i = 0;
199207
foreach ($payment_methods as $payment_method)
@@ -223,7 +231,7 @@ public function getMethod ($address, $total)
223231
$("tr.mpm_issuer_rows").hide();
224232
$("input[name=payment_method]:checked").click();
225233
226-
}) ();</script>';
234+
}) (window.jQuery || window.$);</script>';
227235

228236
if (!$this->config->get('mollie_ideal_no_js'))
229237
{
Lines changed: 151 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -1,149 +1,154 @@
11
if (!window.mollie_method_add)
22
{
3-
window.mollie_method_add = function (id, description, image)
4-
{
5-
if (!window.mollie_methods)
6-
{
7-
window.mollie_methods = [];
8-
}
9-
10-
for (var i = 0; i < window.mollie_methods.length; i++)
11-
{
12-
if (window.mollie_methods[i].id == id)
13-
{
14-
return window.mollie_methods;
15-
}
16-
}
17-
18-
window.mollie_methods.push({ id: id, description: description, image: image });
19-
20-
return window.mollie_methods;
21-
};
22-
23-
window.mollie_issuer_add = function (method_id, id, name)
24-
{
25-
if (!window.mollie_issuers)
26-
{
27-
window.mollie_issuers = [];
28-
}
29-
30-
for (var i = 0; i < window.mollie_methods.length; i++)
31-
{
32-
if (window.mollie_methods[i].id == method_id)
33-
{
34-
if (!window.mollie_issuers[i])
35-
{
36-
window.mollie_issuers[i] = [];
37-
}
38-
39-
for (var j = 0; j < window.mollie_issuers[i].length; j++)
40-
{
41-
if (window.mollie_issuers[i][j].id == id)
42-
{
43-
return window.mollie_issuers[i];
44-
}
45-
}
46-
47-
window.mollie_issuers[i].push({ id: id, name: name });
48-
49-
return window.mollie_issuers[i];
50-
}
51-
}
52-
53-
return [];
54-
};
55-
56-
window.mollie_methods_append = function (method_report_url, issuer_report_url, issuer_text, methods)
57-
{
58-
var mollie = $("#mollie_ideal"), method, m, i;
59-
60-
if (!mollie.length)
61-
{
62-
window.console && console.log('Error in mollie_methods_append: Cannot append non-existing method.');
63-
return false;
64-
}
65-
66-
if (typeof methods === "undefined" || !methods.length)
67-
{
68-
methods = window.mollie_methods;
69-
}
70-
71-
if (!methods.length)
72-
{
73-
window.console && console.log('Error in mollie_methods_append: No methods found.');
74-
return false;
75-
}
76-
77-
if (typeof issuer_text === "undefined" || issuer_text == '')
78-
{
79-
issuer_text = 'Select your bank:';
80-
}
81-
82-
var row = mollie.parents("tr"),
83-
tbody = row.parents("tbody");
84-
row.remove();
85-
86-
for (m = 0; m < methods.length; m++)
87-
{
88-
method = methods[m];
89-
90-
if (method.id && method.description)
91-
{
92-
var issuers_html = '';
93-
94-
if (window.mollie_issuers && window.mollie_issuers[m] && window.mollie_issuers[m].length)
95-
{
96-
var issuers = window.mollie_issuers[m];
97-
98-
issuers_html = '<tr class="mpm_issuer_rows" id="mpm_'+m+'_issuer_row"><td>&nbsp;</td><td><select id="mpm_'+m+'_issuer" onchange="mollie_issuer_select(\''+issuer_report_url+'\', $(this).val())">';
99-
issuers_html += '<option value="">'+issuer_text+'</option>';
100-
for (i = 0; i < issuers.length; i++) {
101-
issuers_html += '<option value="'+issuers[i].id+'">'+issuers[i].name+'</option>';
102-
}
103-
issuers_html += '</select></td></tr>';
104-
}
105-
106-
tbody.append(
107-
'<tr class="highlight">' +
108-
'<td>' +
109-
'<input id="mpm_'+m+'" type="radio" value="mollie_ideal" name="payment_method" onclick="window.mollie_method_select(\''+method_report_url+'\', \''+method.id+'\', \''+method.description+'\', \'mpm_'+m+'_issuer_row\');" />' +
110-
'</td>' +
111-
'<td>' +
112-
'<label for="mpm_'+m+'"><img src="'+method.image+'" height="24" align="left" style="margin-top:-5px" /> &nbsp;'+method.description +'</label>' +
113-
'</td>' +
114-
'</tr>' +
115-
issuers_html
116-
);
117-
}
118-
}
119-
120-
return true;
121-
};
122-
123-
window.mollie_method_select = function (report_url, method_id, method_description, issuers_row)
124-
{
125-
$.post(report_url, {
126-
mollie_method_id: method_id,
127-
mollie_method_description: method_description
128-
});
129-
130-
mollie_display_issuers(issuers_row);
131-
};
132-
133-
window.mollie_issuer_select = function (report_url, issuer_id)
134-
{
135-
$.post(report_url, {
136-
mollie_issuer_id: issuer_id
137-
});
138-
};
139-
140-
window.mollie_display_issuers = function (active_issuers_row)
141-
{
142-
$('tr.mpm_issuer_rows').hide();
143-
144-
if (typeof active_issuers_row !== "undefined" && active_issuers_row !== '')
145-
{
146-
$('#'+active_issuers_row).show();
147-
}
148-
};
3+
(function ($)
4+
{
5+
window.mollie_method_add = function (id, description, image)
6+
{
7+
if (!window.mollie_methods)
8+
{
9+
window.mollie_methods = [];
10+
}
11+
12+
for (var i = 0; i < window.mollie_methods.length; i++)
13+
{
14+
if (window.mollie_methods[i].id == id)
15+
{
16+
return window.mollie_methods;
17+
}
18+
}
19+
20+
window.mollie_methods.push({ id: id, description: description, image: image });
21+
22+
return window.mollie_methods;
23+
};
24+
25+
window.mollie_issuer_add = function (method_id, id, name)
26+
{
27+
if (!window.mollie_issuers)
28+
{
29+
window.mollie_issuers = [];
30+
}
31+
32+
for (var i = 0; i < window.mollie_methods.length; i++)
33+
{
34+
if (window.mollie_methods[i].id == method_id)
35+
{
36+
if (!window.mollie_issuers[i])
37+
{
38+
window.mollie_issuers[i] = [];
39+
}
40+
41+
for (var j = 0; j < window.mollie_issuers[i].length; j++)
42+
{
43+
if (window.mollie_issuers[i][j].id == id)
44+
{
45+
return window.mollie_issuers[i];
46+
}
47+
}
48+
49+
window.mollie_issuers[i].push({ id: id, name: name });
50+
51+
return window.mollie_issuers[i];
52+
}
53+
}
54+
55+
return [];
56+
};
57+
58+
window.mollie_methods_append = function (method_report_url, issuer_report_url, issuer_text, methods)
59+
{
60+
var mollie = $("#mollie_ideal"), method, m, i;
61+
62+
if (!mollie.length)
63+
{
64+
window.console && console.log('Error in mollie_methods_append: Cannot append non-existing method.');
65+
return false;
66+
}
67+
68+
if (typeof methods === "undefined" || !methods.length)
69+
{
70+
methods = window.mollie_methods;
71+
}
72+
73+
if (!methods.length)
74+
{
75+
window.console && console.log('Error in mollie_methods_append: No methods found.');
76+
return false;
77+
}
78+
79+
if (typeof issuer_text === "undefined" || issuer_text == '')
80+
{
81+
issuer_text = 'Select your bank:';
82+
}
83+
84+
var row = mollie.parents("tr"),
85+
tbody = row.parents("tbody");
86+
row.remove();
87+
88+
for (m = 0; m < methods.length; m++)
89+
{
90+
method = methods[m];
91+
92+
if (method.id && method.description)
93+
{
94+
var issuers_html = '';
95+
96+
if (window.mollie_issuers && window.mollie_issuers[m] && window.mollie_issuers[m].length)
97+
{
98+
var issuers = window.mollie_issuers[m];
99+
100+
issuers_html = '<tr class="mpm_issuer_rows" id="mpm_' + m + '_issuer_row"><td>&nbsp;</td><td><select id="mpm_' + m + '_issuer" onchange="mollie_issuer_select(\'' + issuer_report_url + '\', (window.jQuery || window.$)(this).val())">';
101+
issuers_html += '<option value="">' + issuer_text + '</option>';
102+
for (i = 0; i < issuers.length; i++)
103+
{
104+
issuers_html += '<option value="' + issuers[i].id + '">' + issuers[i].name + '</option>';
105+
}
106+
issuers_html += '</select></td></tr>';
107+
}
108+
109+
tbody.append(
110+
'<tr class="highlight">' +
111+
'<td>' +
112+
'<input id="mpm_' + m + '" type="radio" value="mollie_ideal" name="payment_method" onclick="window.mollie_method_select(\'' + method_report_url + '\', \'' + method.id + '\', \'' + method.description + '\', \'mpm_' + m + '_issuer_row\');" />' +
113+
'</td>' +
114+
'<td>' +
115+
'<label for="mpm_' + m + '"><img src="' + method.image + '" height="24" align="left" style="margin-top:-5px" /> &nbsp;' + method.description + '</label>' +
116+
'</td>' +
117+
'</tr>' +
118+
issuers_html
119+
);
120+
}
121+
}
122+
123+
return true;
124+
};
125+
126+
window.mollie_method_select = function (report_url, method_id, method_description, issuers_row)
127+
{
128+
$.post(report_url, {
129+
mollie_method_id: method_id,
130+
mollie_method_description: method_description
131+
});
132+
133+
mollie_display_issuers(issuers_row);
134+
};
135+
136+
window.mollie_issuer_select = function (report_url, issuer_id)
137+
{
138+
$.post(report_url, {
139+
mollie_issuer_id: issuer_id
140+
});
141+
};
142+
143+
window.mollie_display_issuers = function (active_issuers_row)
144+
{
145+
$('tr.mpm_issuer_rows').hide();
146+
147+
if (typeof active_issuers_row !== "undefined" && active_issuers_row !== '')
148+
{
149+
$('#' + active_issuers_row).show();
150+
}
151+
};
152+
153+
}) (window.jQuery || window.$);
149154
}

catalog/view/theme/default/template/payment/mollie_checkout_form.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@
5454

5555
<script type="text/javascript">
5656
// Don't rely on document.ready for jQuery 1.7- support.
57-
(function()
57+
(function ($)
5858
{
5959
$('#button-confirm').click($('#mollie_payment_form').submit);
60-
}) ();
60+
}) (window.jQuery || window.$);
6161
</script>
6262
</form>
6363
</div>

changelog.mdown

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
# Changelog #
44

5+
## Changes in release 5.1.4 ##
6+
+ Now with support for Joomla-based OpenCart installations.
7+
+ Fixed old PHP 5.2- regression bug.
8+
59
## Changes in release 5.1.3 ##
610
+ Added support for custom catalog paths.
711
+ Improved order status updates before and after payments.

0 commit comments

Comments
 (0)