Issue in pragmatically create orders in magento 2Programmatically create new orders from multiple existing...

Is "history" a male-biased word ("his+story")?

Can't find the Shader/UVs tab

Subset counting for even numbers

How do anti-virus programs start at Windows boot?

Do f-stop and exposure time perfectly cancel?

Do I really need to have a scientific explanation for my premise?

Does splitting a potentially monolithic application into several smaller ones help prevent bugs?

What is the chance of making a successful appeal to dismissal decision from a PhD program after failing the qualifying exam in the 2nd attempt?

How do I deal with a powergamer in a game full of beginners in a school club?

2×2×2 rubik's cube corner is twisted!

Should QA ask requirements to developers?

What do you call the air that rushes into your car in the highway?

Aliens englobed the Solar System: will we notice?

Should I take out a loan for a friend to invest on my behalf?

Is it true that real estate prices mainly go up?

Are babies of evil humanoid species inherently evil?

Why the color red for the Republican Party

MTG: Can I kill an opponent in response to lethal activated abilities, and not take the damage?

Offered promotion but I'm leaving. Should I tell?

Can you reject a postdoc offer after the PI has paid a large sum for flights/accommodation for your visit?

PTIJ: Why can't I eat anything?

What are some noteworthy "mic-drop" moments in math?

Why does the negative sign arise in this thermodynamic relation?

Am I not good enough for you?



Issue in pragmatically create orders in magento 2


Programmatically create new orders from multiple existing ordersHow to retrieve Customer ID on Create Order pagemagento programatically order createAdd order pragmatically REST APIManually create order Magento2Create orders programmatically 2.2.4magento 2.2.4 : Create orders programmaticalyMagento 2.2 Create Order for customer from frontend As Sales RepHow to speed up creating orders programmatically in Magento 2?Magento 2 How to disable price from orders, customer account and order view if custom module is enabled?













1















I want to create orders pragmatically by getting the data from xml.
Reading data from xml part is done.
when creating order steps i am getting this error.




Parse error: syntax error, unexpected '$quote' (T_VARIABLE) in




Below is my code lines



<?php
namespace Eight25mediaMpowerSyncControllerAdminhtmlmpowersync;

use MagentoBackendAppActionContext;

class Testorderimport extends MagentoBackendAppAction
{
.........
protected $quote;
protected $quoteManagement;
........
public function __construct(
Context $context,
......
MagentoQuoteModelQuoteFactory $quote,
MagentoQuoteModelQuoteManagement $quoteManagement,
......
) {
parent::__construct($context);
.......
$this->quote = $quote;
$this->quoteManagement = $quoteManagement;
.......
}

public function execute(){
......some code here.....
$websiteId = $this->_storeManager->getWebsite()->getWebsiteId();
$customer = $this->customer;
if ($websiteId) {
$customer->setWebsiteId($websiteId);
}
$customer->loadByEmail($email);
$customer_id = $customer->getId();
if(!$customer->getId()){
//create customer
}

$store = $this->_storeManager->getStore();
$quote = $this->quote->create();
$quote->setStore($store);

$customer = $this->customerRepository->getById($customer_id);
$quote->setCurrency($order_currency_code);
$quote->assignCustomer($customer);
......some code here.....


I am getting this error $quote->assignCustomer($customer) here in this line.



May be some one faced the same issue you before, any help would be great for me to short it out or else suggest me a tutorial.



I tried Magecamp, mageplaza,webkul tutorials.









share



























    1















    I want to create orders pragmatically by getting the data from xml.
    Reading data from xml part is done.
    when creating order steps i am getting this error.




    Parse error: syntax error, unexpected '$quote' (T_VARIABLE) in




    Below is my code lines



    <?php
    namespace Eight25mediaMpowerSyncControllerAdminhtmlmpowersync;

    use MagentoBackendAppActionContext;

    class Testorderimport extends MagentoBackendAppAction
    {
    .........
    protected $quote;
    protected $quoteManagement;
    ........
    public function __construct(
    Context $context,
    ......
    MagentoQuoteModelQuoteFactory $quote,
    MagentoQuoteModelQuoteManagement $quoteManagement,
    ......
    ) {
    parent::__construct($context);
    .......
    $this->quote = $quote;
    $this->quoteManagement = $quoteManagement;
    .......
    }

    public function execute(){
    ......some code here.....
    $websiteId = $this->_storeManager->getWebsite()->getWebsiteId();
    $customer = $this->customer;
    if ($websiteId) {
    $customer->setWebsiteId($websiteId);
    }
    $customer->loadByEmail($email);
    $customer_id = $customer->getId();
    if(!$customer->getId()){
    //create customer
    }

    $store = $this->_storeManager->getStore();
    $quote = $this->quote->create();
    $quote->setStore($store);

    $customer = $this->customerRepository->getById($customer_id);
    $quote->setCurrency($order_currency_code);
    $quote->assignCustomer($customer);
    ......some code here.....


    I am getting this error $quote->assignCustomer($customer) here in this line.



    May be some one faced the same issue you before, any help would be great for me to short it out or else suggest me a tutorial.



    I tried Magecamp, mageplaza,webkul tutorials.









    share

























      1












      1








      1








      I want to create orders pragmatically by getting the data from xml.
      Reading data from xml part is done.
      when creating order steps i am getting this error.




      Parse error: syntax error, unexpected '$quote' (T_VARIABLE) in




      Below is my code lines



      <?php
      namespace Eight25mediaMpowerSyncControllerAdminhtmlmpowersync;

      use MagentoBackendAppActionContext;

      class Testorderimport extends MagentoBackendAppAction
      {
      .........
      protected $quote;
      protected $quoteManagement;
      ........
      public function __construct(
      Context $context,
      ......
      MagentoQuoteModelQuoteFactory $quote,
      MagentoQuoteModelQuoteManagement $quoteManagement,
      ......
      ) {
      parent::__construct($context);
      .......
      $this->quote = $quote;
      $this->quoteManagement = $quoteManagement;
      .......
      }

      public function execute(){
      ......some code here.....
      $websiteId = $this->_storeManager->getWebsite()->getWebsiteId();
      $customer = $this->customer;
      if ($websiteId) {
      $customer->setWebsiteId($websiteId);
      }
      $customer->loadByEmail($email);
      $customer_id = $customer->getId();
      if(!$customer->getId()){
      //create customer
      }

      $store = $this->_storeManager->getStore();
      $quote = $this->quote->create();
      $quote->setStore($store);

      $customer = $this->customerRepository->getById($customer_id);
      $quote->setCurrency($order_currency_code);
      $quote->assignCustomer($customer);
      ......some code here.....


      I am getting this error $quote->assignCustomer($customer) here in this line.



      May be some one faced the same issue you before, any help would be great for me to short it out or else suggest me a tutorial.



      I tried Magecamp, mageplaza,webkul tutorials.









      share














      I want to create orders pragmatically by getting the data from xml.
      Reading data from xml part is done.
      when creating order steps i am getting this error.




      Parse error: syntax error, unexpected '$quote' (T_VARIABLE) in




      Below is my code lines



      <?php
      namespace Eight25mediaMpowerSyncControllerAdminhtmlmpowersync;

      use MagentoBackendAppActionContext;

      class Testorderimport extends MagentoBackendAppAction
      {
      .........
      protected $quote;
      protected $quoteManagement;
      ........
      public function __construct(
      Context $context,
      ......
      MagentoQuoteModelQuoteFactory $quote,
      MagentoQuoteModelQuoteManagement $quoteManagement,
      ......
      ) {
      parent::__construct($context);
      .......
      $this->quote = $quote;
      $this->quoteManagement = $quoteManagement;
      .......
      }

      public function execute(){
      ......some code here.....
      $websiteId = $this->_storeManager->getWebsite()->getWebsiteId();
      $customer = $this->customer;
      if ($websiteId) {
      $customer->setWebsiteId($websiteId);
      }
      $customer->loadByEmail($email);
      $customer_id = $customer->getId();
      if(!$customer->getId()){
      //create customer
      }

      $store = $this->_storeManager->getStore();
      $quote = $this->quote->create();
      $quote->setStore($store);

      $customer = $this->customerRepository->getById($customer_id);
      $quote->setCurrency($order_currency_code);
      $quote->assignCustomer($customer);
      ......some code here.....


      I am getting this error $quote->assignCustomer($customer) here in this line.



      May be some one faced the same issue you before, any help would be great for me to short it out or else suggest me a tutorial.



      I tried Magecamp, mageplaza,webkul tutorials.







      orders custom magento2.2.2 programmatically





      share












      share










      share



      share










      asked 5 mins ago









      MujahidhMujahidh

      1,40012036




      1,40012036






















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


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f265605%2fissue-in-pragmatically-create-orders-in-magento-2%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
















          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%2f265605%2fissue-in-pragmatically-create-orders-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

          “%fieldName is a required field.”, in Magento2 REST API Call for GET Method Type The Next...

          How to change City field to a dropdown in Checkout step Magento 2Magento 2 : How to change UI field(s)...

          變成蝙蝠會怎樣? 參考資料 外部連結 导航菜单Thomas Nagel, "What is it like to be a...