PluginProbe
MakeCommerce for WooCommerce / 3.5.4
MakeCommerce for WooCommerce v3.5.4
4.1.0 4.0.8 trunk 1.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 2.0.0 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.2.0 2.2.1 2.2.2 All 96 releases
makecommerce / shipping / method / parcelmachine / dpd.php

dpd.php in MakeCommerce for WooCommerce 3.5.4, at shipping/method/parcelmachine/dpd.php

84 lines 3.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace MakeCommerce\Shipping\Method\ParcelMachine;
4
5 /**
6 * DPD parcelmachine shipping method.
7 * Defines all DPD specific options.
8 *
9 * @since 3.0.0
10 */
11
12 class DPD extends \MakeCommerce\Shipping\Method\ParcelMachine {
13
14 use \MakeCommerce\Shipping\Method\Common\DPD;
15
16 public $default_price = "5.00";
17 public $default_max_weight = "30";
18
19 /**
20 * Loads all form fields specific to this shipping method
21 *
22 * @since 3.0.0
23 */
24 public function initialize_method_form_fields() {
25
26 // MakeCommerce TMS or DPD contract
27 $this->form_fields['use_mk_contract'] = [
28 'type' => 'select',
29 'title' => __( 'Contract', 'wc_makecommerce_domain' ),
30 'options' => [
31 false => __( 'use my own DPD contract', 'wc_makecommerce_domain' ),
32 true => __( 'use the Shipping+ service', 'wc_makecommerce_domain' ),
33 ],
34 'default' => false,
35 'description' => '',
36 ];
37
38 //Verifies if you can use MakeCommerce as shipment mediation service
39 $this->form_fields['verify_feature_swc'] = [
40 'type' => 'verify_feature_swc',
41 'title' => __( 'Verify service status', 'wc_makecommerce_domain' ),
42 'description' => __( 'You must enable the Transport mediation service before using it.', 'wc_makecommerce_domain' ),
43 'desc_tip' => __( 'This will check if the Transport mediation service has been enabled for your shop.', 'wc_makecommerce_domain' ),
44 'placeholder' => __( 'Verify', 'wc_makecommerce_domain' ),
45 ];
46
47 //This is needed for our API. It changes behaviour depending on the country your contract has been signed in
48 $this->form_fields['service_carrier'] = [
49 'type' => 'select',
50 'title' => __( 'Integration country', 'wc_makecommerce_domain' ),
51 'options' => [
52 "DPD" => __( 'Estonia', 'wc_makecommerce_domain' ),
53 "DPD_LV" => __( 'Latvia', 'wc_makecommerce_domain' ),
54 "DPD_LT" => __( 'Lithuania', 'wc_makecommerce_domain' ),
55 ],
56 'default' => "ee",
57 'description' => __( "Which country's carrier gave you the credentials", 'wc_makecommerce_domain' ),
58 ];
59
60 $this->form_fields['credentials_description'] = [
61 'type' => 'title',
62 'title' => '',
63 'description' => sprintf('%s <br>', __( 'You can now use the API Key for a more streamlined integration process. Please note that the traditional username and password authentication method will be deprecated in the near future. We strongly encourage you to switch to API Key authentication as soon as possible.', 'wc_makecommerce_domain' ) ) .
64 sprintf('%s <br>', __( 'To obtain the API key please contact your sales manager or DPD:', 'wc_makecommerce_domain' ) ) .
65 sprintf('%s <br>', __( 'Estonia: sales@dpd.ee', 'wc_makecommerce_domain' ) ) .
66 sprintf('%s <br>', __( 'Latvia: sales@dpd.lv', 'wc_makecommerce_domain' ) ) .
67 sprintf('%s <br>', __( 'Lithuania: sales@dpd.lt', 'wc_makecommerce_domain' ) )
68 ];
69
70 $options = get_option( 'woocommerce_' . $this->id . '_settings' );
71
72 // Show warning if api key is not already set or the value of it is empty
73 if ( empty( $options['api_key'] ) ) {
74 $this->form_fields['dpd_apikey_warning'] = [
75 'type' => 'title',
76 'title' => '',
77 'description' => sprintf( '<b>%s</b>', __( 'Please be aware that changing the credentials to API key will affect generating labels for all old shipments. Please generate all labels needed for already created shipments before migrating to new API.', 'wc_makecommerce_domain' ) )
78 ];
79 }
80
81 $this->initialize_dpd_api_field();
82 }
83 }
84