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

Is `x >> pure y` equivalent to `liftM (const y) x`

Escape a backup date in a file name

Integer addition + constant, is it a group?

Is exact Kanji stroke length important?

Inappropriate reference requests from Journal reviewers

How to pronounce the slash sign

What happens if you roll doubles 3 times then land on "Go to jail?"

Is there a problem with hiding "forgot password" until it's needed?

Two monoidal structures and copowering

Customer Requests (Sometimes) Drive Me Bonkers!

Purchasing a ticket for someone else in another country?

Is there a korbon needed for conversion?

How do we know the LHC results are robust?

Detecting if an element is found inside a container

Trouble understanding the speech of overseas colleagues

Pre-amplifier input protection

How can a function with a hole (removable discontinuity) equal a function with no hole?

Why are there no referendums in the US?

You cannot touch me, but I can touch you, who am I?

Sequence of Tenses: Translating the subjunctive

Applicability of Single Responsibility Principle

Why didn't Theresa May consult with Parliament before negotiating a deal with the EU?

Roman Numeral Treatment of Suspensions

Why escape if the_content isnt?



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 5 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

          Nidaros erkebispedøme

          Birsay

          Was Woodrow Wilson really a Liberal?Was World War I a war of liberals against authoritarians?Founding Fathers...