Get order collection by order id in Magento 2? Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Element 'css', attribute 'order': The attribute 'order' is not allowedMagento 2: Plugin class does not existHow to install extension using composer - Magento EE 2.2 ( Production )Magento2 does n't get the order collection from OrderCollectionFactoryGet Product id in magento2Send Order Shipment Email to CC AddressError during compilation in magento 2.2.2Magento 2, Cannot `getCollection()` from model factoryError in collectionsDeclaration error during compile

How does the math work when buying airline miles?

Co-worker has annoying ringtone

Is it possible for SQL statements to execute concurrently within a single session in SQL Server?

How would a mousetrap for use in space work?

How to pronounce 伝統色

Why does it sometimes sound good to play a grace note as a lead in to a note in a melody?

Lagrange four-squares theorem --- deterministic complexity

How to write capital alpha?

Semigroups with no morphisms between them

Is it fair for a professor to grade us on the possession of past papers?

Maximum summed subsequences with non-adjacent items

Drawing spherical mirrors

Did Mueller's report provide an evidentiary basis for the claim of Russian govt election interference via social media?

How to run automated tests after each commit?

How fail-safe is nr as stop bytes?

How many time has Arya actually used Needle?

What happened to Thoros of Myr's flaming sword?

Putting class ranking in CV, but against dept guidelines

Most bit efficient text communication method?

If Windows 7 doesn't support WSL, then what is "Subsystem for UNIX-based Applications"?

Why can't I install Tomboy in Ubuntu Mate 19.04?

Why do early math courses focus on the cross sections of a cone and not on other 3D objects?

In musical terms, what properties are varied by the human voice to produce different words / syllables?

Antipodal Land Area Calculation



Get order collection by order id in Magento 2?



Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Element 'css', attribute 'order': The attribute 'order' is not allowedMagento 2: Plugin class does not existHow to install extension using composer - Magento EE 2.2 ( Production )Magento2 does n't get the order collection from OrderCollectionFactoryGet Product id in magento2Send Order Shipment Email to CC AddressError during compilation in magento 2.2.2Magento 2, Cannot `getCollection()` from model factoryError in collectionsDeclaration error during compile



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








3















I am trying to get order collection by order id in Magento 2.



Here is my code:



$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$orders = $objectManager->create('MagentoSalesModelOrder')->getCollection()->load($oid);

echo $custLastName= $orders->getCustomerLastname();


But its is giving fatal error:



 Call to undefined method MagentoSalesModelResourceModelOrderCollection::getCustomerLastname()









share|improve this question

















  • 1





    use $orders = $objectManager->create('MagentoSalesModelOrder')->load($oid);

    – bang.nguyen47
    Apr 3 at 6:58











  • This method does not return customer information. So I need collection of it that provides customer information as well

    – Arshad Hussain
    Apr 3 at 7:00











  • check my answer just remove getCollection

    – Rk Rathod
    Apr 3 at 7:06

















3















I am trying to get order collection by order id in Magento 2.



Here is my code:



$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$orders = $objectManager->create('MagentoSalesModelOrder')->getCollection()->load($oid);

echo $custLastName= $orders->getCustomerLastname();


But its is giving fatal error:



 Call to undefined method MagentoSalesModelResourceModelOrderCollection::getCustomerLastname()









share|improve this question

















  • 1





    use $orders = $objectManager->create('MagentoSalesModelOrder')->load($oid);

    – bang.nguyen47
    Apr 3 at 6:58











  • This method does not return customer information. So I need collection of it that provides customer information as well

    – Arshad Hussain
    Apr 3 at 7:00











  • check my answer just remove getCollection

    – Rk Rathod
    Apr 3 at 7:06













3












3








3








I am trying to get order collection by order id in Magento 2.



Here is my code:



$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$orders = $objectManager->create('MagentoSalesModelOrder')->getCollection()->load($oid);

echo $custLastName= $orders->getCustomerLastname();


But its is giving fatal error:



 Call to undefined method MagentoSalesModelResourceModelOrderCollection::getCustomerLastname()









share|improve this question














I am trying to get order collection by order id in Magento 2.



Here is my code:



$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$orders = $objectManager->create('MagentoSalesModelOrder')->getCollection()->load($oid);

echo $custLastName= $orders->getCustomerLastname();


But its is giving fatal error:



 Call to undefined method MagentoSalesModelResourceModelOrderCollection::getCustomerLastname()






magento2.2 order-collection






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Apr 3 at 6:55









Arshad HussainArshad Hussain

4571928




4571928







  • 1





    use $orders = $objectManager->create('MagentoSalesModelOrder')->load($oid);

    – bang.nguyen47
    Apr 3 at 6:58











  • This method does not return customer information. So I need collection of it that provides customer information as well

    – Arshad Hussain
    Apr 3 at 7:00











  • check my answer just remove getCollection

    – Rk Rathod
    Apr 3 at 7:06












  • 1





    use $orders = $objectManager->create('MagentoSalesModelOrder')->load($oid);

    – bang.nguyen47
    Apr 3 at 6:58











  • This method does not return customer information. So I need collection of it that provides customer information as well

    – Arshad Hussain
    Apr 3 at 7:00











  • check my answer just remove getCollection

    – Rk Rathod
    Apr 3 at 7:06







1




1





use $orders = $objectManager->create('MagentoSalesModelOrder')->load($oid);

– bang.nguyen47
Apr 3 at 6:58





use $orders = $objectManager->create('MagentoSalesModelOrder')->load($oid);

– bang.nguyen47
Apr 3 at 6:58













This method does not return customer information. So I need collection of it that provides customer information as well

– Arshad Hussain
Apr 3 at 7:00





This method does not return customer information. So I need collection of it that provides customer information as well

– Arshad Hussain
Apr 3 at 7:00













check my answer just remove getCollection

– Rk Rathod
Apr 3 at 7:06





check my answer just remove getCollection

– Rk Rathod
Apr 3 at 7:06










2 Answers
2






active

oldest

votes


















4














Just Remove getCollection :-



$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$orders = $objectManager->create('MagentoSalesModelOrder')->load($oid);

echo $custLastName= $orders->getCustomerLastname();





share|improve this answer























  • It worked. Thanks

    – Arshad Hussain
    Apr 3 at 7:18


















1














The Following code will easily get Customer details, Billing, Shipping and order totals



 $orderId = 1222;
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$order = $objectManager->create('MagentoSalesModelOrderRepository')->get($orderId);

/*get customer details*/

$custLastName= $orders->getCustomerLastname();
$custFirsrName= $orders->getCustomerFirstname();
$ipaddress=$order->getRemoteIp();
$customer_email=$order->getCustomerEmail();
$customerid=$order->getCustomerId();

/* get Billing details */
$billingaddress=$order->getBillingAddress();
$billingcity=$billingaddress->getCity();
$billingstreet=$billingaddress->getStreet();
$billingpostcode=$billingaddress->getPostcode();
$billingtelephone=$billingaddress->getTelephone();
$billingstate_code=$billingaddress->getRegionCode();

/* get shipping details */

$shippingaddress=$order->getShippingAddress();
$shippingcity=$shippingaddress->getCity();
$shippingstreet=$shippingaddress->getStreet();
$shippingpostcode=$shippingaddress->getPostcode();
$shippingtelephone=$shippingaddress->getTelephone();
$shippingstate_code=$shippingaddress->getRegionCode();

/* get total */

$tax_amount=$order->getTaxAmount();
$total=$order->getGrandTotal();





share|improve this answer























    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
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f268468%2fget-order-collection-by-order-id-in-magento-2%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    4














    Just Remove getCollection :-



    $objectManager = MagentoFrameworkAppObjectManager::getInstance();
    $orders = $objectManager->create('MagentoSalesModelOrder')->load($oid);

    echo $custLastName= $orders->getCustomerLastname();





    share|improve this answer























    • It worked. Thanks

      – Arshad Hussain
      Apr 3 at 7:18















    4














    Just Remove getCollection :-



    $objectManager = MagentoFrameworkAppObjectManager::getInstance();
    $orders = $objectManager->create('MagentoSalesModelOrder')->load($oid);

    echo $custLastName= $orders->getCustomerLastname();





    share|improve this answer























    • It worked. Thanks

      – Arshad Hussain
      Apr 3 at 7:18













    4












    4








    4







    Just Remove getCollection :-



    $objectManager = MagentoFrameworkAppObjectManager::getInstance();
    $orders = $objectManager->create('MagentoSalesModelOrder')->load($oid);

    echo $custLastName= $orders->getCustomerLastname();





    share|improve this answer













    Just Remove getCollection :-



    $objectManager = MagentoFrameworkAppObjectManager::getInstance();
    $orders = $objectManager->create('MagentoSalesModelOrder')->load($oid);

    echo $custLastName= $orders->getCustomerLastname();






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Apr 3 at 7:05









    Rk RathodRk Rathod

    1,469214




    1,469214












    • It worked. Thanks

      – Arshad Hussain
      Apr 3 at 7:18

















    • It worked. Thanks

      – Arshad Hussain
      Apr 3 at 7:18
















    It worked. Thanks

    – Arshad Hussain
    Apr 3 at 7:18





    It worked. Thanks

    – Arshad Hussain
    Apr 3 at 7:18













    1














    The Following code will easily get Customer details, Billing, Shipping and order totals



     $orderId = 1222;
    $objectManager = MagentoFrameworkAppObjectManager::getInstance();
    $order = $objectManager->create('MagentoSalesModelOrderRepository')->get($orderId);

    /*get customer details*/

    $custLastName= $orders->getCustomerLastname();
    $custFirsrName= $orders->getCustomerFirstname();
    $ipaddress=$order->getRemoteIp();
    $customer_email=$order->getCustomerEmail();
    $customerid=$order->getCustomerId();

    /* get Billing details */
    $billingaddress=$order->getBillingAddress();
    $billingcity=$billingaddress->getCity();
    $billingstreet=$billingaddress->getStreet();
    $billingpostcode=$billingaddress->getPostcode();
    $billingtelephone=$billingaddress->getTelephone();
    $billingstate_code=$billingaddress->getRegionCode();

    /* get shipping details */

    $shippingaddress=$order->getShippingAddress();
    $shippingcity=$shippingaddress->getCity();
    $shippingstreet=$shippingaddress->getStreet();
    $shippingpostcode=$shippingaddress->getPostcode();
    $shippingtelephone=$shippingaddress->getTelephone();
    $shippingstate_code=$shippingaddress->getRegionCode();

    /* get total */

    $tax_amount=$order->getTaxAmount();
    $total=$order->getGrandTotal();





    share|improve this answer



























      1














      The Following code will easily get Customer details, Billing, Shipping and order totals



       $orderId = 1222;
      $objectManager = MagentoFrameworkAppObjectManager::getInstance();
      $order = $objectManager->create('MagentoSalesModelOrderRepository')->get($orderId);

      /*get customer details*/

      $custLastName= $orders->getCustomerLastname();
      $custFirsrName= $orders->getCustomerFirstname();
      $ipaddress=$order->getRemoteIp();
      $customer_email=$order->getCustomerEmail();
      $customerid=$order->getCustomerId();

      /* get Billing details */
      $billingaddress=$order->getBillingAddress();
      $billingcity=$billingaddress->getCity();
      $billingstreet=$billingaddress->getStreet();
      $billingpostcode=$billingaddress->getPostcode();
      $billingtelephone=$billingaddress->getTelephone();
      $billingstate_code=$billingaddress->getRegionCode();

      /* get shipping details */

      $shippingaddress=$order->getShippingAddress();
      $shippingcity=$shippingaddress->getCity();
      $shippingstreet=$shippingaddress->getStreet();
      $shippingpostcode=$shippingaddress->getPostcode();
      $shippingtelephone=$shippingaddress->getTelephone();
      $shippingstate_code=$shippingaddress->getRegionCode();

      /* get total */

      $tax_amount=$order->getTaxAmount();
      $total=$order->getGrandTotal();





      share|improve this answer

























        1












        1








        1







        The Following code will easily get Customer details, Billing, Shipping and order totals



         $orderId = 1222;
        $objectManager = MagentoFrameworkAppObjectManager::getInstance();
        $order = $objectManager->create('MagentoSalesModelOrderRepository')->get($orderId);

        /*get customer details*/

        $custLastName= $orders->getCustomerLastname();
        $custFirsrName= $orders->getCustomerFirstname();
        $ipaddress=$order->getRemoteIp();
        $customer_email=$order->getCustomerEmail();
        $customerid=$order->getCustomerId();

        /* get Billing details */
        $billingaddress=$order->getBillingAddress();
        $billingcity=$billingaddress->getCity();
        $billingstreet=$billingaddress->getStreet();
        $billingpostcode=$billingaddress->getPostcode();
        $billingtelephone=$billingaddress->getTelephone();
        $billingstate_code=$billingaddress->getRegionCode();

        /* get shipping details */

        $shippingaddress=$order->getShippingAddress();
        $shippingcity=$shippingaddress->getCity();
        $shippingstreet=$shippingaddress->getStreet();
        $shippingpostcode=$shippingaddress->getPostcode();
        $shippingtelephone=$shippingaddress->getTelephone();
        $shippingstate_code=$shippingaddress->getRegionCode();

        /* get total */

        $tax_amount=$order->getTaxAmount();
        $total=$order->getGrandTotal();





        share|improve this answer













        The Following code will easily get Customer details, Billing, Shipping and order totals



         $orderId = 1222;
        $objectManager = MagentoFrameworkAppObjectManager::getInstance();
        $order = $objectManager->create('MagentoSalesModelOrderRepository')->get($orderId);

        /*get customer details*/

        $custLastName= $orders->getCustomerLastname();
        $custFirsrName= $orders->getCustomerFirstname();
        $ipaddress=$order->getRemoteIp();
        $customer_email=$order->getCustomerEmail();
        $customerid=$order->getCustomerId();

        /* get Billing details */
        $billingaddress=$order->getBillingAddress();
        $billingcity=$billingaddress->getCity();
        $billingstreet=$billingaddress->getStreet();
        $billingpostcode=$billingaddress->getPostcode();
        $billingtelephone=$billingaddress->getTelephone();
        $billingstate_code=$billingaddress->getRegionCode();

        /* get shipping details */

        $shippingaddress=$order->getShippingAddress();
        $shippingcity=$shippingaddress->getCity();
        $shippingstreet=$shippingaddress->getStreet();
        $shippingpostcode=$shippingaddress->getPostcode();
        $shippingtelephone=$shippingaddress->getTelephone();
        $shippingstate_code=$shippingaddress->getRegionCode();

        /* get total */

        $tax_amount=$order->getTaxAmount();
        $total=$order->getGrandTotal();






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Apr 3 at 7:12









        ARUNPRABAKARAN MARUNPRABAKARAN M

        498113




        498113



























            draft saved

            draft discarded
















































            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%2f268468%2fget-order-collection-by-order-id-in-magento-2%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

            Marja Vauras Lähteet | Aiheesta muualla | NavigointivalikkoMarja Vauras Turun yliopiston tutkimusportaalissaInfobox OKSuomalaisen Tiedeakatemian varsinaiset jäsenetKasvatustieteiden tiedekunnan dekaanit ja muu johtoMarja VaurasKoulutusvienti on kestävyys- ja ketteryyslaji (2.5.2017)laajentamallaWorldCat Identities0000 0001 0855 9405n86069603utb201588738523620927

            Which is better: GPT or RelGAN for text generation?2019 Community Moderator ElectionWhat is the difference between TextGAN and LM for text generation?GANs (generative adversarial networks) possible for text as well?Generator loss not decreasing- text to image synthesisChoosing a right algorithm for template-based text generationHow should I format input and output for text generation with LSTMsGumbel Softmax vs Vanilla Softmax for GAN trainingWhich neural network to choose for classification from text/speech?NLP text autoencoder that generates text in poetic meterWhat is the interpretation of the expectation notation in the GAN formulation?What is the difference between TextGAN and LM for text generation?How to prepare the data for text generation task

            Is this part of the description of the Archfey warlock's Misty Escape feature redundant?When is entropic ward considered “used”?How does the reaction timing work for Wrath of the Storm? Can it potentially prevent the damage from the triggering attack?Does the Dark Arts Archlich warlock patrons's Arcane Invisibility activate every time you cast a level 1+ spell?When attacking while invisible, when exactly does invisibility break?Can I cast Hellish Rebuke on my turn?Do I have to “pre-cast” a reaction spell in order for it to be triggered?What happens if a Player Misty Escapes into an Invisible CreatureCan a reaction interrupt multiattack?Does the Fiend-patron warlock's Hurl Through Hell feature dispel effects that require the target to be on the same plane as the caster?What are you allowed to do while using the Warlock's Eldritch Master feature?