Issue in pragmatically create orders in magento 2Programmatically 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?

Solving "Resistance between two nodes on a grid" problem in Mathematica

What are the best books to study Neural Networks from a purely mathematical perspective?

Are the terms "stab" and "staccato" synonyms?

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?

BitNot does not flip bits in the way I expected

Is it true that real estate prices mainly go up?

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

How to create a hard link to an inode (ext4)?

What Happens when Passenger Refuses to Fly Boeing 737 Max?

Making a sword in the stone, in a medieval world without magic

Replacing Windows 7 security updates with anti-virus?

Should QA ask requirements to developers?

Why would one plane in this picture not have gear down yet?

Finding algorithms of QGIS commands?

What to do when during a meeting client people start to fight (even physically) with each others?

Placing subfig vertically

If the Captain's screens are out, does he switch seats with the co-pilot?

How strictly should I take "Candidates must be local"?

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

What is the meaning of triple curly braces in phtml template files? When and how do we use them?

In the late 1940’s to early 1950’s what technology was available that could melt a LOT of ice?

Time travel short story where dinosaur doesn't taste like chicken

Single word request: Harming the benefactor



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?













0















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


























    0















    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
























      0












      0








      0








      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 2 mins ago









      MujahidhMujahidh

      1,39512036




      1,39512036




















          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

          Nidaros erkebispedøme

          Birsay

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