Comments (5)
Hi,
Please try below links where I passed the delivery date in API.
Edit the events.xml file on global state SR/DeliveryDate/etc/events.xml
<?xml version="1.0" encoding="UTF-8"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> <event name="sales_model_service_quote_submit_before"> <observer name="sr_delivery_date" instance="SR\DeliveryDate\Observer\SaveDeliveryDateToOrderObserver"/> </event> <event name="sales_order_load_after"> <observer name="sales_order_load_order_attribute" instance="SR\DeliveryDate\Observer\Sales\OrderLoadAfter" /> </event> </config>
Then edit the SR/DeliveryDate/etc/extension_attributes.xml
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd"> <extension_attributes for="Magento\Checkout\Api\Data\ShippingInformationInterface"> <attribute code="delivery_date" type="string"/> <attribute code="delivery_comment" type="string"/> </extension_attributes> <extension_attributes for="Magento\Sales\Api\Data\OrderInterface"> <attribute code="delivery_date" type="string" /> </extension_attributes> </config>
And After that create a observer file SR\DeliveryDate\Observer\Sales\OrderLoadAfter.php
to get the delivery date.
<?php namespace SR\DeliveryDate\Observer\Sales; use Magento\Framework\Event\ObserverInterface; class OrderLoadAfter implements ObserverInterface { public function execute(\Magento\Framework\Event\Observer $observer) { $order = $observer->getOrder(); $extensionAttributes = $order->getExtensionAttributes(); if ($extensionAttributes === null) { $extensionAttributes = $this->getOrderExtensionDependency(); } $attr = $order->getData('delivery_date'); $extensionAttributes->setDeliveryDate($attr); $order->setExtensionAttributes($extensionAttributes); } private function getOrderExtensionDependency() { $orderExtension = \Magento\Framework\App\ObjectManager::getInstance()->get( '\Magento\Sales\Api\Data\OrderExtension' ); return $orderExtension; } }
from magento2-module-delivery-date.
You can check the my repo on github https://github.com/moinmalek17/magento2-module-delivery-date-with-api
Thanks
from magento2-module-delivery-date.
have API been added?
from magento2-module-delivery-date.
Hi @malafalx91 ,
Please check below link for that https://github.com/moinmalek17/magento2-module-delivery-date-with-api.
Thanks
from magento2-module-delivery-date.
@moinmalek17 I installed your module, I tried to do this GET:
http: // mysite / rest / V1 / orders / 2
but I don't find any reference to the delivery field.
Can you tell me what GET I have to do?
from magento2-module-delivery-date.
Related Issues (19)
- Would you mind adding composer.json HOT 1
- Selected delivery time shows 5.30 hrs greater
- How can I move these custom fields before shipping methods
- datetimepicker field selected date wrong showing
- Can't place an order on Magento 2.3.4
- How to add delivery date selection to Multi-address checkout
- Delivery Date in multi-address checkout
- Typo in the message
- Default Value
- Uncaught TypeError: Unable to process binding "datetimepicker: function(){return true }"
- Auto show delivery date
- try to add two fields but its getting only one fields data in console
- how to make store view match with store
- Unable to process binding "datetimepicker: function(){return true }
- Admin Place Order HOT 3
- Not working
- Date picker Required field HOT 2
- new step HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from magento2-module-delivery-date.