Skip to content

Commit

Permalink
feat: add sunday cut-off time (#827)
Browse files Browse the repository at this point in the history
  • Loading branch information
joerivanveen authored Mar 13, 2024
1 parent ee59c0d commit d0cfc65
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Helper/Checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ public function getBoolConfig(string $carrier, string $key): bool
*/
public function getTimeConfig(string $carrier, string $key): string
{
$timeAsString = str_replace(',', ':', $this->getCarrierConfig($key, $carrier));
$timeAsString = str_replace(',', ':', (string) $this->getCarrierConfig($key, $carrier));
$timeComponents = explode(':', $timeAsString ?? '');
if (count($timeComponents) >= 3) {
[$hours, $minutes] = $timeComponents;
Expand Down
4 changes: 4 additions & 0 deletions Model/Quote/Checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ private function getDeliveryData(): array
$carrierPath,
'general/saturday_cutoff_time'
),
'sundayCutoffTime' => $this->helper->getTimeConfig(
$carrierPath,
'general/sunday_cutoff_time'
),
] : []
);
}
Expand Down
5 changes: 1 addition & 4 deletions Model/Source/DropOffDays.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ public function __construct(\Magento\Framework\Locale\ListsInterface $localeList
*/
public function toOptionArray()
{
$weekdays = $this->_localeLists->getOptionWeekdays();
unset($weekdays[0]);

return $weekdays;
return $this->_localeLists->getOptionWeekdays();
}
}
13 changes: 10 additions & 3 deletions etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -323,12 +323,19 @@
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="saturday_cutoff_time" translate="label comment" type="time" sortOrder="298" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Monday delivery cut-off time</label>
<label>Saturday cut-off time</label>
<depends>
<field id="monday_delivery_active">1</field>
</depends>
<tooltip>If a request is made before this time on Saturday, Monday will be shown as the next possible delivery date.</tooltip>
</field>
<tooltip>If a request is made before this time on Saturday Monday will be shown as the next possible delivery date. This is ignored when Sunday is a drop-off day.</tooltip>
</field>
<field id="sunday_cutoff_time" translate="label comment" type="time" sortOrder="298" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Sunday cut-off time</label>
<depends>
<field id="monday_delivery_active">1</field>
</depends>
<tooltip>If a request is made before this time on Sunday and Sunday is a drop-off day, Monday will be shown as the next possible delivery date.</tooltip>
</field>
</group>
<group id="delivery" translate="label comment" type="text" sortOrder="300" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Delivery settings</label>
Expand Down
4 changes: 4 additions & 0 deletions i18n/nl_NL.csv
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ From price,Vanaf prijs
Enable sameday delivery,Zelfde dag bezorgd inschakelen
Sameday delivery fee,Zelfde dag bezorgd kosten
Sameday cut-off time,Zelfde dag laatste bestelmoment
Saturday cut-off time,Zaterdag laatste bestelmoment
Sunday cut-off time,Zondag laatste bestelmoment
Track number,Track nummer
Track status,Track status
Track action,Track actie
Expand Down Expand Up @@ -182,6 +184,8 @@ days,dagen
Hide days,Dagen verbergen
Cut-off time,Het laatste bestelmoment
"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.","Als een bestelling tussen vrijdag na, en maandag voor, het opgegeven bestelmoment wordt gedaan dan zal dinsdag worden getoond als eerstvolgende afleverdag."
"If a request is made before this time on Saturday Monday will be shown as the next possible delivery date. This is ignored when Sunday is a drop-off day.","Als een bestelling voor dit tijdstip op zaterdag wordt gedaan dan zal maandag worden getoond als eerstvolgende afleverdag. Dit wordt genegeerd wanneer zondag een verzenddag is."
"If a request is made before this time on Sunday and Sunday is a drop-off day, Monday will be shown as the next possible delivery date.","Als een bestelling voor dit tijdstip op zondag wordt gedaan en zondag is een afleverdag dan zal maandag worden getoond als eerstvolgende afleverdag."
Drop-off days,Verzenddagen
Saturday active,Zaterdag actief
Saturday title,Zaterdag titel
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"postinstall": "node postinstall.js"
},
"dependencies": {
"@myparcel/delivery-options": "^5.14",
"@myparcel/delivery-options": "^5.16",
"custom-event-polyfill": "^1.0.7",
"object-path": "^0.11.5"
},
Expand Down
6 changes: 3 additions & 3 deletions view/frontend/web/js/vendor/myparcel.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ __metadata:
languageName: node
linkType: hard

"@myparcel/delivery-options@npm:^5.14":
version: 5.14.1
resolution: "@myparcel/delivery-options@npm:5.14.1"
"@myparcel/delivery-options@npm:^5.16":
version: 5.16.0
resolution: "@myparcel/delivery-options@npm:5.16.0"
dependencies:
"@fortawesome/free-solid-svg-icons": "npm:^5.15.4"
"@myparcel/js-sdk": "npm:^2.0.3"
Expand All @@ -176,7 +176,7 @@ __metadata:
vue-async-computed: "npm:^3.9.0"
vue-click-outside: "npm:^1.1.0"
vue-fa: "npm:^2.0.1"
checksum: 0966e5652910bd7cdfc3e1f1241a619eda122d9b29e5febb5f1491737ffe9771b4efa78ee420c16ea5c58c87cb006ee1f8b15ee4bb386ea49990898748e2c16a
checksum: 0d7a58d1e8ab134ee65f5dc08e4bed2f16f54df37cf2c0492cd889d32c8b4986fc9905b81d9deeac0aa641af38a10bc7c906eccd4ae2e7487d42161f4cdc0965
languageName: node
linkType: hard

Expand Down Expand Up @@ -225,7 +225,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@myparcel/magento@workspace:."
dependencies:
"@myparcel/delivery-options": "npm:^5.14"
"@myparcel/delivery-options": "npm:^5.16"
"@myparcel/eslint-config": "npm:^3.6.1"
"@myparcel/semantic-release-config": "npm:^4.0.0"
"@types/knockout": "npm:^3.4.72"
Expand Down

0 comments on commit d0cfc65

Please sign in to comment.