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













0















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;










share







New contributor




Meetali Gupta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
























    0















    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;










    share







    New contributor




    Meetali Gupta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      0












      0








      0








      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;










      share







      New contributor




      Meetali Gupta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      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





      share







      New contributor




      Meetali Gupta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share







      New contributor




      Meetali Gupta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share



      share






      New contributor




      Meetali Gupta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 3 mins ago









      Meetali GuptaMeetali Gupta

      1




      1




      New contributor




      Meetali Gupta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Meetali Gupta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Meetali Gupta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          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.









          draft saved

          draft discarded


















          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.









          draft saved

          draft discarded


















          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.




          draft saved


          draft discarded














          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





















































          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







          Popular posts from this blog

          Лель (журнал) Зміст Історія | Редакція | Автори і рубрики | Інтерв'ю, статті, рецензії | Див. також | Посилання | Навігаційне менюперевірена1 змінаСергій Чирков: «Плейбой» і «Пентхауз» у кіосках з'явилися вже після того, як зник «Лель»«Лель», підшивка 10 номерів (1992, 1993)Ніч з «Другом Читача»: казки на ніч для дорослихІнформація про журнал на сервері журналістів у ВР УкраїниНаталія Патрікєєва. Лель. Перший український еротичний журналр

          Тонконіг бульбистий Зміст Опис | Поширення | Екологія | Господарське значення | Примітки | Див. також | Література | Джерела | Посилання | Навігаційне меню1114601320038-241116202404kew-435458Poa bulbosaЭлектронный каталог сосудистых растений Азиатской России [Електронний каталог судинних рослин Азіатської Росії]Малышев Л. Л. Дикие родичи культурных растений. Poa bulbosa L. - Мятлик луковичный. [Малишев Л. Л. Дикі родичи культурних рослин. Poa bulbosa L. - Тонконіг бульбистий.]Мятлик (POA) Сем. Злаки (Мятликовые) [Тонконіг (POA) Род. Злаки (Тонконогові)]Poa bulbosa Linnaeus, Sp. Pl. 1: 70. 1753. 鳞茎早熟禾 lin jing zao shu he (Description from Flora of China) [Poa bulbosa Linnaeus, Sp. Pl. 1: 70. 1753. 鳞茎早熟禾 lin jing zao shu he (Опис від Флора Китаю)]Poa bulbosa L. – lipnice cibulkatá / lipnica cibulkatáPoa bulbosa в базі даних Poa bulbosa на сайті Poa bulbosa в базі даних «Global Biodiversity Information Facility» (GBIF)Poa bulbosa в базі даних «Euro + Med PlantBase» — інформаційному ресурсі для Євро-середземноморського розмаїття рослинPoa bulbosa L. на сайті «Плантариум»

          Best approach to update all entries in a list that is paginated?Best way to add items to a paginated listChoose Your Country: Best Usability approachUpdate list when a user is viewing the list without annoying themWhen would the best day to update your webpage be?What should happen when I add a Row to a paginated, sorted listShould I adopt infinite scrolling or classical pagination?How to show user that page objects automatically updateWhat is the best location to locate the comments section in a list pageBest way to combine filtering and selecting items in a listWhen one of two inputs must be updated to satisfy a consistency criteria, which should you update (if at all)?