How to get the custom order attributes in default order Api response in magento 2.3How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento2 How to get Custom order attributes value in response in rest api v1Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom Optionsget invoice item using order_item_id in magento 2How to get last order id in Magento 2.3?Magento 2.3 REST API Json response format issue
Crossing the line between justified force and brutality
Is exact Kanji stroke length important?
Is there a korbon needed for conversion?
How to write papers efficiently when English isn't my first language?
Roman Numeral Treatment of Suspensions
How did Doctor Strange see the winning outcome in Avengers: Infinity War?
Why didn't Theresa May consult with Parliament before negotiating a deal with the EU?
Implement the Thanos sorting algorithm
Sort a list by elements of another list
Do the temporary hit points from the Battlerager barbarian's Reckless Abandon stack if I make multiple attacks on my turn?
Applicability of Single Responsibility Principle
How do scammers retract money, while you can’t?
Method to test if a number is a perfect power?
Why escape if the_content isnt?
Go Pregnant or Go Home
System.debug(JSON.Serialize(o)) Not longer shows full string
Gears on left are inverse to gears on right?
How long to clear the 'suck zone' of a turbofan after start is initiated?
What happens if you roll doubles 3 times then land on "Go to jail?"
How do I extract a value from a time formatted value in excel?
Return the Closest Prime Number
Detecting if an element is found inside a container
What is the best translation for "slot" in the context of multiplayer video games?
What is paid subscription needed for in Mortal Kombat 11?
How to get the custom order attributes in default order Api response in magento 2.3
How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento2 How to get Custom order attributes value in response in rest api v1Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom Optionsget invoice item using order_item_id in magento 2How to get last order id in Magento 2.3?Magento 2.3 REST API Json response format issue
I have created a new custom order attribute named delivery_date and shown the same in sales order grid but i am not getting the custom attribute in my order Api response.
The error I am getting is Fatal error: Uncaught Error: Call to undefined method MagentoSalesApiDataOrderExtension::setTipAndTrickAttribute()
Please help.
app/code/Amos/CustomOrder/etc/di.xml
<?xml version="1.0"?>
<!--
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
<virtualType name="MagentoSalesModelResourceModelOrderGrid" type="MagentoSalesModelResourceModelGrid">
<arguments>
<argument name="columns" xsi:type="array">
<item name="delivery_date" xsi:type="string">sales_order.delivery_date</item>
<item name="no_of_days" xsi:type="string">sales_order.no_of_days</item>
<item name="no_of_crew" xsi:type="string">sales_order.no_of_crew</item>
</argument>
</arguments>
</virtualType>
</config>
app/code/Amos/CustomOrder/etc/events.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="sales_order_load_after">
<observer name="sales_order_load_delivery_date" instance="MagestoreTipAndTrickObserverSalesOrderLoadAfter" />
</event>
</config>
Amos/CustomOrder/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="MagentoSalesApiDataOrderInterface">
<attribute code="delivery_date" type="string" />
</extension_attributes>
</config>
Amos/CustomOrder/Observer/Sales/OrderLoadAfter.php
<?php
namespace AmosCustomOrderObserverSales;
use MagentoFrameworkEventObserverInterface;
class OrderLoadAfter implements ObserverInterface
public function execute(MagentoFrameworkEventObserver $observer)
$order = $observer->getOrder();
$extensionAttributes = $order->getExtensionAttributes();
if ($extensionAttributes === null)
$extensionAttributes = $this->getOrderExtensionDependency();
$attr = $order->getData('delivery_date');
$extensionAttributes->setTipAndTrickAttribute($attr);
$order->setExtensionAttributes($extensionAttributes);
private function getOrderExtensionDependency()
$orderExtension = MagentoFrameworkAppObjectManager::getInstance()->get(
'MagentoSalesApiDataOrderExtension'
);
return $orderExtension;
magento2 magento2.3 magento-community
New contributor
add a comment |
I have created a new custom order attribute named delivery_date and shown the same in sales order grid but i am not getting the custom attribute in my order Api response.
The error I am getting is Fatal error: Uncaught Error: Call to undefined method MagentoSalesApiDataOrderExtension::setTipAndTrickAttribute()
Please help.
app/code/Amos/CustomOrder/etc/di.xml
<?xml version="1.0"?>
<!--
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
<virtualType name="MagentoSalesModelResourceModelOrderGrid" type="MagentoSalesModelResourceModelGrid">
<arguments>
<argument name="columns" xsi:type="array">
<item name="delivery_date" xsi:type="string">sales_order.delivery_date</item>
<item name="no_of_days" xsi:type="string">sales_order.no_of_days</item>
<item name="no_of_crew" xsi:type="string">sales_order.no_of_crew</item>
</argument>
</arguments>
</virtualType>
</config>
app/code/Amos/CustomOrder/etc/events.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="sales_order_load_after">
<observer name="sales_order_load_delivery_date" instance="MagestoreTipAndTrickObserverSalesOrderLoadAfter" />
</event>
</config>
Amos/CustomOrder/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="MagentoSalesApiDataOrderInterface">
<attribute code="delivery_date" type="string" />
</extension_attributes>
</config>
Amos/CustomOrder/Observer/Sales/OrderLoadAfter.php
<?php
namespace AmosCustomOrderObserverSales;
use MagentoFrameworkEventObserverInterface;
class OrderLoadAfter implements ObserverInterface
public function execute(MagentoFrameworkEventObserver $observer)
$order = $observer->getOrder();
$extensionAttributes = $order->getExtensionAttributes();
if ($extensionAttributes === null)
$extensionAttributes = $this->getOrderExtensionDependency();
$attr = $order->getData('delivery_date');
$extensionAttributes->setTipAndTrickAttribute($attr);
$order->setExtensionAttributes($extensionAttributes);
private function getOrderExtensionDependency()
$orderExtension = MagentoFrameworkAppObjectManager::getInstance()->get(
'MagentoSalesApiDataOrderExtension'
);
return $orderExtension;
magento2 magento2.3 magento-community
New contributor
add a comment |
I have created a new custom order attribute named delivery_date and shown the same in sales order grid but i am not getting the custom attribute in my order Api response.
The error I am getting is Fatal error: Uncaught Error: Call to undefined method MagentoSalesApiDataOrderExtension::setTipAndTrickAttribute()
Please help.
app/code/Amos/CustomOrder/etc/di.xml
<?xml version="1.0"?>
<!--
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
<virtualType name="MagentoSalesModelResourceModelOrderGrid" type="MagentoSalesModelResourceModelGrid">
<arguments>
<argument name="columns" xsi:type="array">
<item name="delivery_date" xsi:type="string">sales_order.delivery_date</item>
<item name="no_of_days" xsi:type="string">sales_order.no_of_days</item>
<item name="no_of_crew" xsi:type="string">sales_order.no_of_crew</item>
</argument>
</arguments>
</virtualType>
</config>
app/code/Amos/CustomOrder/etc/events.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="sales_order_load_after">
<observer name="sales_order_load_delivery_date" instance="MagestoreTipAndTrickObserverSalesOrderLoadAfter" />
</event>
</config>
Amos/CustomOrder/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="MagentoSalesApiDataOrderInterface">
<attribute code="delivery_date" type="string" />
</extension_attributes>
</config>
Amos/CustomOrder/Observer/Sales/OrderLoadAfter.php
<?php
namespace AmosCustomOrderObserverSales;
use MagentoFrameworkEventObserverInterface;
class OrderLoadAfter implements ObserverInterface
public function execute(MagentoFrameworkEventObserver $observer)
$order = $observer->getOrder();
$extensionAttributes = $order->getExtensionAttributes();
if ($extensionAttributes === null)
$extensionAttributes = $this->getOrderExtensionDependency();
$attr = $order->getData('delivery_date');
$extensionAttributes->setTipAndTrickAttribute($attr);
$order->setExtensionAttributes($extensionAttributes);
private function getOrderExtensionDependency()
$orderExtension = MagentoFrameworkAppObjectManager::getInstance()->get(
'MagentoSalesApiDataOrderExtension'
);
return $orderExtension;
magento2 magento2.3 magento-community
New contributor
I have created a new custom order attribute named delivery_date and shown the same in sales order grid but i am not getting the custom attribute in my order Api response.
The error I am getting is Fatal error: Uncaught Error: Call to undefined method MagentoSalesApiDataOrderExtension::setTipAndTrickAttribute()
Please help.
app/code/Amos/CustomOrder/etc/di.xml
<?xml version="1.0"?>
<!--
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
<virtualType name="MagentoSalesModelResourceModelOrderGrid" type="MagentoSalesModelResourceModelGrid">
<arguments>
<argument name="columns" xsi:type="array">
<item name="delivery_date" xsi:type="string">sales_order.delivery_date</item>
<item name="no_of_days" xsi:type="string">sales_order.no_of_days</item>
<item name="no_of_crew" xsi:type="string">sales_order.no_of_crew</item>
</argument>
</arguments>
</virtualType>
</config>
app/code/Amos/CustomOrder/etc/events.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="sales_order_load_after">
<observer name="sales_order_load_delivery_date" instance="MagestoreTipAndTrickObserverSalesOrderLoadAfter" />
</event>
</config>
Amos/CustomOrder/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="MagentoSalesApiDataOrderInterface">
<attribute code="delivery_date" type="string" />
</extension_attributes>
</config>
Amos/CustomOrder/Observer/Sales/OrderLoadAfter.php
<?php
namespace AmosCustomOrderObserverSales;
use MagentoFrameworkEventObserverInterface;
class OrderLoadAfter implements ObserverInterface
public function execute(MagentoFrameworkEventObserver $observer)
$order = $observer->getOrder();
$extensionAttributes = $order->getExtensionAttributes();
if ($extensionAttributes === null)
$extensionAttributes = $this->getOrderExtensionDependency();
$attr = $order->getData('delivery_date');
$extensionAttributes->setTipAndTrickAttribute($attr);
$order->setExtensionAttributes($extensionAttributes);
private function getOrderExtensionDependency()
$orderExtension = MagentoFrameworkAppObjectManager::getInstance()->get(
'MagentoSalesApiDataOrderExtension'
);
return $orderExtension;
magento2 magento2.3 magento-community
magento2 magento2.3 magento-community
New contributor
New contributor
New contributor
asked 3 mins ago
Meetali GuptaMeetali Gupta
1
1
New contributor
New contributor
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Meetali Gupta is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f267717%2fhow-to-get-the-custom-order-attributes-in-default-order-api-response-in-magento%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Meetali Gupta is a new contributor. Be nice, and check out our Code of Conduct.
Meetali Gupta is a new contributor. Be nice, and check out our Code of Conduct.
Meetali Gupta is a new contributor. Be nice, and check out our Code of Conduct.
Meetali Gupta is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f267717%2fhow-to-get-the-custom-order-attributes-in-default-order-api-response-in-magento%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown