| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
use MyParcelNL\Sdk\src\Model\Consignment\AbstractConsignment; |
| 6 |
|
| 7 |
if (! defined('ABSPATH')) { |
| 8 |
exit; |
| 9 |
} // Exit if accessed directly |
| 10 |
|
| 11 |
/** |
| 12 |
* @var \WC_Order $order |
| 13 |
* @var int $order_id |
| 14 |
*/ |
| 15 |
|
| 16 |
/** @noinspection PhpUnhandledExceptionInspection */ |
| 17 |
$orderSettings = new OrderSettings($order); |
| 18 |
|
| 19 |
?> |
| 20 |
<table class="wcpn__settings-table" style="width: auto"> |
| 21 |
<tr> |
| 22 |
<td> |
| 23 |
<?php _e("Shipment type", "woocommerce-postnl") ?>:<br/> <small class="calculated_weight"> |
| 24 |
<?php printf( |
| 25 |
__("calculated_order_weight", "woocommerce-postnl"), |
| 26 |
wc_format_weight($orderSettings->getWeight()) |
| 27 |
) ?> |
| 28 |
</small> |
| 29 |
</td> |
| 30 |
<td> |
| 31 |
<?php |
| 32 |
$name = "postnl_options[{$order_id}][package_type]"; |
| 33 |
printf('<select name="%s" class="package_type">', $name); |
| 34 |
foreach (WCPN_Data::getPackageTypesHuman() as $key => $label) { |
| 35 |
$isReturnPackageType = in_array( |
| 36 |
$key, |
| 37 |
[ |
| 38 |
AbstractConsignment::PACKAGE_TYPE_PACKAGE_NAME, |
| 39 |
AbstractConsignment::PACKAGE_TYPE_MAILBOX_NAME, |
| 40 |
] |
| 41 |
); |
| 42 |
|
| 43 |
if (! $isReturnPackageType) { |
| 44 |
return; |
| 45 |
} |
| 46 |
|
| 47 |
printf( |
| 48 |
'<option value="%s">%s</option>', |
| 49 |
WCPN_Data::getPackageTypeId($key), |
| 50 |
$label |
| 51 |
); |
| 52 |
} |
| 53 |
echo '</select>'; |
| 54 |
?> |
| 55 |
</td> |
| 56 |
</tr> |
| 57 |
</table><br> |
| 58 |
<?php if (! isset($skip_save)): ?> |
| 59 |
<div class="wcpn__d--flex"> |
| 60 |
<a class="button save" data-order="<?php echo $order_id; ?>"><?php _e("Save", "woocommerce-postnl") ?> |
| 61 |
<?php WCMYPA_Admin::renderSpinner() ?> |
| 62 |
</a> |
| 63 |
</div> |
| 64 |
<?php endif ?> |
| 65 |
|