diff --git a/Observer/CheckoutLayoutModifier.php b/Observer/CheckoutLayoutModifier.php new file mode 100644 index 0000000..d531ed2 --- /dev/null +++ b/Observer/CheckoutLayoutModifier.php @@ -0,0 +1,58 @@ +getSubject(); + /** @var array $jsLayout */ + $jsLayout = &$subject->getJsLayout(); + + $nameInLayout = 'delivery_date'; + // Copy element + $originalElement = $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children'] + ['shippingAddress']['children']['shippingAdditional']['children'][$nameInLayout]; + + // Remove original element from layout + unset( + $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children'] + ['shippingAddress']['children']['shippingAdditional']['children'][$nameInLayout] + ); + + $originalElement['config']['template'] = 'MageWorx_DeliveryDateCheckout/container'; + + // Remove DD comments + unset($originalElement['children']['comment_container']); + + // Update Date component + $originalElement['children']['datetime_container']['children']['delivery_day']['config']['template'] = + 'MageWorx_DeliveryDateCheckout/form/field'; + + // Update Time component + $originalElement['children']['datetime_container']['children']['delivery_time']['config']['template'] = + 'MageWorx_DeliveryDateCheckout/form/field'; + + $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children'] + ['shippingMethods']['children']['shipping_method_additional_data']['children'][$nameInLayout] = + $originalElement; + } +} diff --git a/composer.json b/composer.json new file mode 100755 index 0000000..74b88cd --- /dev/null +++ b/composer.json @@ -0,0 +1,21 @@ +{ + "name": "mageworx/module-deliverydate-checkout-compatibility", + "description": "Delivery Date and MageWorx Checkout Compatibility Extension", + "require": { + "magento/module-ui" : ">=100.1.0 < 102", + "mageworx/module-checkout" : ">=1.0.0", + "mageworx/module-deliverydate" : ">=1.8.6" + }, + "type": "magento2-module", + "version": "1.0.0", + "license": [ + "OSL-3.0", + "AFL-3.0" + ], + "autoload": { + "files": [ "registration.php" ], + "psr-4": { + "MageWorx\\DeliveryDateCheckout\\": "" + } + } +} diff --git a/etc/frontend/events.xml b/etc/frontend/events.xml new file mode 100644 index 0000000..3e124b8 --- /dev/null +++ b/etc/frontend/events.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/etc/module.xml b/etc/module.xml new file mode 100755 index 0000000..ccc5259 --- /dev/null +++ b/etc/module.xml @@ -0,0 +1,15 @@ + + + + + + + + + + diff --git a/registration.php b/registration.php new file mode 100755 index 0000000..6c8cb43 --- /dev/null +++ b/registration.php @@ -0,0 +1,11 @@ + +
+ + + +
diff --git a/view/frontend/web/template/form/field.html b/view/frontend/web/template/form/field.html new file mode 100644 index 0000000..8c620e4 --- /dev/null +++ b/view/frontend/web/template/form/field.html @@ -0,0 +1,41 @@ +
+
+ + + + +
+ + + + +
+ + + + + +
+