forked from aliukevicius/commerce_mokilizingas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
commerce_mlizingas.checkout_pane.inc
40 lines (34 loc) · 1.46 KB
/
commerce_mlizingas.checkout_pane.inc
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
<?php
/**
* Checkout pane callback: presents a completion message on the complete page.
*/
function commerce_mlizingas_pane_checkout_form($form, &$form_state, $checkout_pane, $order) {
$pane_form = array();
// show only for mokilizingas WP payments
if ($order->data['payment_method'] == 'mlizingas_wps|commerce_payment_mlizingas_wps') {
$message = variable_get('commerce_mlizingas_pane_advance_payment_message', '');
$leftToPay = commerce_payment_order_balance($order);
if ($leftToPay['amount'] > 0 ) {
$message = t($message, array('@amount' => commerce_currency_format($leftToPay['amount'], $leftToPay['currency_code'])));
$pane_form['advance_payment_message'] = array(
'#markup' => '<div class="mlizingas_complete_advance_payment_info">' . $message . '</div>',
);
}
}
return $pane_form;
}
/**
* Implements base_settings_form()
*/
function commerce_mlizingas_pane_settings_form($checkout_pane) {
$default = 'You will need to pay @amount on delivery.';
$form['commerce_mlizingas_pane_advance_payment_message'] = array(
'#type' => 'textarea',
'#cols' => 20,
'#rows' => 5,
'#title' => t('Advance payment message'),
'#default_value' => variable_get('commerce_mlizingas_pane_advance_payment_message', $default),
'#description' => 'Use @amount to display amount which customer needs to pay on delivery.'
);
return $form;
}