PluginProbe
PostNL for WooCommerce / 4.4.1
PostNL for WooCommerce v4.4.1
5.9.12 5.9.11 5.9.10 5.9.9 5.9.8 5.9.7 5.9.6 trunk 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 3.1.4 3.1.5 3.1.6 3.1.7 4.0.0 4.0.1 4.0.2 4.3.2 4.3.3 4.4.0 4.4.1 All 72 releases
woo-postnl / includes / admin / views / html-send-return-email-form.php

html-send-return-email-form.php in PostNL for WooCommerce 4.4.1, at includes/admin/views/html-send-return-email-form.php

170 lines 8.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 use WPO\WC\PostNL\Compatibility\Order as WCX_Order;
4 use WPO\WC\PostNL\Compatibility\WC_Core as WCX;
5
6 defined('ABSPATH') or die();
7
8 include('html-start.php');
9
10 /**
11 * @var array $order_ids
12 */
13
14 $add_return = WCPN_Export::ADD_RETURN;
15 $export = WCPN_Export::EXPORT;
16
17 $order_ids_string = implode(';', $order_ids);
18
19 $target_url = wp_nonce_url(
20 admin_url("admin-ajax.php?action=$export&request=$add_return&modal=true&order_ids=$order_ids_string"),
21 WCPOST::NONCE_ACTION
22 );
23
24 ?>
25 <form
26 method="post" class="page-form wcpn__bulk-options wcpn__return-dialog" action="<?php echo $target_url; ?>">
27 <table style="width: 100%">
28 <tbody>
29 <?php
30 $c = true;
31 foreach ($order_ids as $order_id) :
32 $order = WCX::get_order($order_id);
33 $orderSettings = new OrderSettings($order);
34
35 // skip non-myparcel destinations
36 $shipping_country = WCX_Order::get_prop($order, 'shipping_country');
37 if (! WCPN_Country_Codes::isAllowedDestination($shipping_country)) {
38 continue;
39 }
40
41 $recipient = WCPN_Export::getRecipientFromOrder($order);
42 $package_types = WCPN_Data::getPackageTypes();
43 ?>
44 <tr
45 class="order-row <?php echo(($c = ! $c)
46 ? 'alternate'
47 : ''); ?>">
48 <td>
49 <table style="width: 100%">
50 <tr>
51 <td colspan="2">
52 <strong>
53 <?php echo sprintf(
54 "%s %s",
55 __("Order", "woocommerce-postnl"),
56 $order->get_order_number()
57 ); ?>
58 </strong>
59 </td>
60 </tr>
61 <tr>
62 <td class="ordercell">
63 <table class="widefat">
64 <thead>
65 <tr>
66 <th>#</th>
67 <th><?php _e("Product name", "woocommerce-postnl"); ?></th>
68 <th class="wcpn__text--right"><?php _e("weight", "woocommerce-postnl"); ?></th>
69 </tr>
70 </thead>
71 <tbody>
72 <?php foreach ($order->get_items() as $item_id => $item) : ?>
73 <tr>
74 <td><?php echo $item['qty'] . 'x'; ?></td>
75 <td><?php echo WCPN_Export::get_item_display_name($item, $order) ?></td>
76 <td class="wcpn__text--right">
77 <?php
78
79 $weight = $item->get_product()->weight;
80
81 if ($weight) {
82 echo wc_format_weight($weight * $item['qty']);
83 } else {
84 echo esc_html__('N/A', 'woocommerce');
85 }
86 ?>
87 </td>
88 </tr>
89 <?php endforeach; ?>
90 </tbody>
91 <tfoot>
92 <tr>
93 <th>&nbsp;</th>
94 <th><?php _e("Total weight", "woocommerce-postnl"); ?></th>
95 <th class="wcpn__text--right">
96 <?php
97 $weight = $orderSettings->getWeight();
98
99 if ($weight) {
100 echo wc_format_weight($weight);
101 } else {
102 echo esc_html__('N/A', 'woocommerce');
103 }
104 ?>
105 </th>
106 </tr>
107 </tfoot>
108 </table>
109 </td>
110 <td>
111 <?php
112 if (WCPN_Data::isHomeCountry($shipping_country)
113 && (empty($recipient['street']) || empty($recipient['number']))): ?>
114 <p>
115 <span style="color:red">
116 <?php __(
117 "This order does not contain valid street and house number data and cannot be exported because of this! This order was probably placed before the PostNL plugin was activated. The address data can still be manually entered in the order screen.",
118 "woocommerce-postnl"
119 ); ?>
120 </span>
121 </p>
122 </td>
123 </tr> <!-- last row -->
124 <?php else: // required address data is available
125 // print address
126 echo '<p>' . $order->get_formatted_shipping_address() . '<br/>' . WCX_Order::get_prop(
127 $order,
128 'billing_phone'
129 ) . '<br/>' . WCX_Order::get_prop($order, 'billing_email') . '</p>';
130 ?>
131 </td></tr>
132 <tr>
133 <td
134 colspan="2" class="wcpn__shipment-options">
135 <?php
136 $skip_save = true; // dont show save button for each order
137 if (isset($dialog) && $dialog === 'shipment') {
138 include('html-order-shipment-options.php');
139 } else {
140 include('html-order-return-shipment-options.php');
141 }
142 ?>
143 </td>
144 </tr>
145 <?php endif; ?>
146 </table>
147 </td>
148 </tr>
149 <?php endforeach; ?>
150 </tbody>
151 </table>
152 <div>
153 <?php
154 if (isset($dialog) && $dialog === 'shipment') {
155 $button_text = __("Export to PostNL", "woocommerce-postnl");
156 } else {
157 $button_text = __("Send email", "woocommerce-postnl");
158 }
159 ?>
160 <div class="wcpn__d--flex">
161 <input type="submit" value="<?php echo $button_text; ?>" class="button wcpn__return-dialog__save">
162 <?php WCPOST_Admin::renderSpinner() ?>
163 </div>
164 </div>
165 </form>
166
167 <?php
168
169 include('html-end.php');
170