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

          Can not update quote_id field of “quote_item” table magento 2Magento 2.1 - We can't remove the item. (Shopping Cart doesnt allow us to remove items before becomes empty)Add value for custom quote item attribute using REST apiREST API endpoint v1/carts/cartId/items always returns error messageCorrect way to save entries to databaseHow to remove all associated quote objects of a customer completelyMagento 2 - Save value from custom input field to quote_itemGet quote_item data using quote id and product id filter in Magento 2How to set additional data to quote_item table from controller in Magento 2?What is the purpose of additional_data column in quote_item table in magento2Set Custom Price to Quote item magento2 from controller

          How to solve knockout JS error in Magento 2 Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?(Magento2) knockout.js:3012 Uncaught ReferenceError: Unable to process bindingUnable to process binding Knockout.js magento 2Cannot read property `scopeLabel` of undefined on Product Detail PageCan't get Customer Data on frontend in Magento 2Magento2 Order Summary - unable to process bindingKO templates are not loading in Magento 2.1 applicationgetting knockout js error magento 2Product grid not load -— Unable to process binding Knockout.js magento 2Product form not loaded in magento2Uncaught ReferenceError: Unable to process binding “if: function()return (isShowLegend()) ” magento 2

          Nissan Patrol Зміст Перше покоління — 4W60 (1951-1960) | Друге покоління — 60 series (1960-1980) | Третє покоління (1980–2002) | Четверте покоління — Y60 (1987–1998) | П'яте покоління — Y61 (1997–2013) | Шосте покоління — Y62 (2010- ) | Посилання | Зноски | Навігаційне менюОфіційний український сайтТест-драйв Nissan Patrol 2010 7-го поколінняNissan PatrolКак мы тестировали Nissan Patrol 2016рвиправивши або дописавши її