Skip to content

Commit

Permalink
feat: add carrier dpd (#786)
Browse files Browse the repository at this point in the history
* feat: add carrier dpd
  • Loading branch information
wthijmen authored Dec 1, 2023
1 parent b0b158b commit e87fe71
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Block/Sales/NewShipmentForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use MyParcelNL\Sdk\src\Model\Carrier\CarrierDHLEuroplus;
use MyParcelNL\Sdk\src\Model\Carrier\CarrierDHLForYou;
use MyParcelNL\Sdk\src\Model\Carrier\CarrierDHLParcelConnect;
use MyParcelNL\Sdk\src\Model\Carrier\CarrierDPD;
use MyParcelNL\Sdk\src\Model\Carrier\CarrierFactory;
use MyParcelNL\Sdk\src\Model\Carrier\CarrierPostNL;
use MyParcelNL\Sdk\src\Model\Consignment\AbstractConsignment;
Expand All @@ -17,6 +18,7 @@ class NewShipmentForm
CarrierDHLForYou::class,
CarrierDHLEuroplus::class,
CarrierDHLParcelConnect::class,
CarrierDPD::class,
];

public const PACKAGE_TYPE_HUMAN_MAP = [
Expand Down
3 changes: 3 additions & 0 deletions Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use MyParcelNL\Sdk\src\Model\Carrier\CarrierDHLEuroplus;
use MyParcelNL\Sdk\src\Model\Carrier\CarrierDHLForYou;
use MyParcelNL\Sdk\src\Model\Carrier\CarrierDHLParcelConnect;
use MyParcelNL\Sdk\src\Model\Carrier\CarrierDPD;
use MyParcelNL\Sdk\src\Model\Carrier\CarrierPostNL;
use MyParcelNL\Sdk\src\Model\Consignment\AbstractConsignment;
use MyParcelNL\Sdk\src\Model\Consignment\DropOffPoint;
Expand All @@ -25,12 +26,14 @@ class Data extends AbstractHelper
public const XML_PATH_DHLFORYOU_SETTINGS = 'myparcelnl_magento_dhlforyou_settings/';
public const XML_PATH_DHLEUROPLUS_SETTINGS = 'myparcelnl_magento_dhleuroplus_settings/';
public const XML_PATH_DHLPARCELCONNECT_SETTINGS = 'myparcelnl_magento_dhlparcelconnect_settings/';
public const XML_PATH_DPD_SETTINGS = 'myparcelnl_magento_dpd_settings/';
public const DEFAULT_WEIGHT = 1000;
public const CARRIERS_XML_PATH_MAP = [
CarrierPostNL::NAME => self::XML_PATH_POSTNL_SETTINGS,
CarrierDHLForYou::NAME => self::XML_PATH_DHLFORYOU_SETTINGS,
CarrierDHLEuroplus::NAME => self::XML_PATH_DHLEUROPLUS_SETTINGS,
CarrierDHLParcelConnect::NAME => self::XML_PATH_DHLPARCELCONNECT_SETTINGS,
CarrierDPD::NAME => self::XML_PATH_DPD_SETTINGS,
];

/**
Expand Down
57 changes: 57 additions & 0 deletions etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,63 @@
</field>
</group>
</section>
<section id="myparcelnl_magento_dpd_settings" translate="label" type="text" sortOrder="200" showInDefault="1" showInWebsite="1" showInStore="1">
<label>DPD settings</label>
<tab>myparcelnl_magento</tab>
<resource>MyParcelNL_Magento::myparcelnl_magento</resource>
<group id="general" translate="label comment" type="text" sortOrder="270" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Basic settings</label>
<field id="allow_show_delivery_date" translate="label comment" type="select" sortOrder="275" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Show delivery date</label>
<tooltip>Show a delivery date in the checkout.</tooltip>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="deliverydays_window" translate="label comment" type="select" sortOrder="276" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Number of days</label>
<depends>
<field id="allow_show_delivery_date">1</field>
</depends>
<source_model>MyParcelNL\Magento\Model\Source\NumberOfDays</source_model>
<tooltip>Amount of days in the future customers can choose from in the checkout.</tooltip>
</field>
<field id="cutoff_time" translate="label comment" type="time" sortOrder="280" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Cutoff time</label>
<tooltip>If a request is made for the delivery options between Friday after, and Monday before, cut-off time then Tuesday will be shown as the next possible delivery date.</tooltip>
</field>
<field id="dropoff_days" translate="label comment" type="multiselect" sortOrder="285" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Drop-off days</label>
<source_model>MyParcelNL\Magento\Model\Source\DropOffDays</source_model>
<tooltip>Select the days that you send the orders.</tooltip>
<can_be_empty>1</can_be_empty>
</field>
<field id="dropoff_delay" translate="label comment" type="select" sortOrder="290" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Drop-off-delay</label>
<tooltip>This options allows you to set the number of days it takes you to pick, pack and hand in your parcels at PostNL when ordered before the cutoff time.</tooltip>
<source_model>MyParcelNL\Magento\Model\Source\DropOffDelayDays</source_model>
</field>
</group>
<group id="delivery" translate="label comment" type="text" sortOrder="300" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Delivery settings</label>
<field id="active" translate="label comment" type="select" sortOrder="305" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Delivery enabled</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
</group>
<group id="pickup" translate="label comment" type="text" sortOrder="400" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Pickup at DHL location</label>
<field id="active" translate="label comment" type="select" sortOrder="405" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Pickup active</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="fee" translate="label comment" type="text" sortOrder="410" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Pickup fee</label>
<tooltip>Enter an amount that is either positive or negative. For example, do you want to give a discount for using this function or do you want to charge extra for this delivery option.</tooltip>
<depends>
<field id="active">1</field>
</depends>
</field>
</group>
</section>
<section id="sales_email">
<group id="track" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1">
<label>MyParcel Track</label>
Expand Down
20 changes: 20 additions & 0 deletions etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,26 @@
</pickup>
</myparcelnl_magento_dhlparcelconnect_settings>

<myparcelnl_magento_dpd_settings>
<default_options>
</default_options>
<general>
<deliverydays_window>3</deliverydays_window>
<cutoff_time>15,30,00</cutoff_time>
<dropoff_days>1,2,3,4,5</dropoff_days>
<monday_delivery_active>0</monday_delivery_active>
<saturday_cutoff_time>14,30,00</saturday_cutoff_time>
<dropoff_delay>0</dropoff_delay>
</general>
<delivery>
<active>1</active>
</delivery>
<pickup>
<active>1</active>
<fee>0</fee>
</pickup>
</myparcelnl_magento_dpd_settings>

<sales_email>
<track>
<enabled>1</enabled>
Expand Down
1 change: 1 addition & 0 deletions i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ myparcelnl_magento_dhlforyou_settings/delivery/only_recipient, DHL For You deliv
myparcelnl_magento_dhlforyou_settings/delivery/only_recipient/signature, DHL For You delivery with only recipient and signature
myparcelnl_magento_dhleuroplus_settings/delivery, DHL Europlus delivery
myparcelnl_magento_dhlparcelconnect_settings/delivery, DHL Parcel Connect delivery
myparcelnl_magento_dpd_settings/delivery, DPD delivery
myparcelnl_magento_error_no_shipments_to_process, No MyParcel shipments to process.
no_account_settings, No account settings found. Press the import button in general configuration to fetch account settings.
manage_drop_off_point, Manage your default drop-off point in the
Expand Down
1 change: 1 addition & 0 deletions i18n/nl_NL.csv
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ myparcelnl_magento_dhlforyou_settings/delivery/only_recipient, DHL For You bezor
myparcelnl_magento_dhlforyou_settings/delivery/only_recipient/signature, DHL For You bezorging met alleen ontvanger en handtekening
myparcelnl_magento_dhleuroplus_settings/delivery, DHL Europlus bezorging
myparcelnl_magento_dhlparcelconnect_settings/delivery, DHL Parcel Connect bezorging
myparcenl_magento_dpd_settings/delivery, DPD bezorging
myparcelnl_magento_error_no_shipments_to_process, Geen MyParcel zendingen om te verwerken.
Version and support,Versie en support
General settings,Algemene instellingen
Expand Down
5 changes: 5 additions & 0 deletions view/adminhtml/web/template/grid/order_massaction.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@
name="mypa_carrier" value="dhlparcelconnect">
<label class="admin__field-label" for="mypa_carrier_dhlparcelconnect" trans="DHL Parcel Connect"></label>
</div>
<div class="admin__field admin__field-option">
<input type="radio" class="admin__control-radio" id="mypa_carrier_dpd"
name="mypa_carrier" value="dpd">
<label class="admin__field-label" for="mypa_carrier_dpd" trans="DPD"></label>
</div>
</div>
</div>
</div>
Expand Down
2 changes: 2 additions & 0 deletions view/frontend/web/js/view/delivery-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ define(
'myparcelnl_magento_dhlforyou_settings/delivery/only_recipient/same_day_delivery': 'config.carrierSettings.dhlforyou.priceSameDayDeliveryAndOnlyRecipient',
'myparcelnl_magento_dhleuroplus_settings/delivery': 'config.carrierSettings.dhleuroplus.priceStandardDelivery',
'myparcelnl_magento_dhlparcelconnect_settings/delivery': 'config.carrierSettings.dhlparcelconnect.priceStandardDelivery',
'myparcelnl_magento_dpd_settings/delivery': 'config.carrierSettings.dpd.priceStandardDelivery',
'myparcelnl_magento_dpd_settings/pickup': 'config.carrierSettings.dpd.pricePickup',
},

/**
Expand Down

0 comments on commit e87fe71

Please sign in to comment.