How to set default order status is complete when the order is created in Magento 1.xCustom cron causing one page checkout deadlocksforce magento order status completeCreate invoice and shipment in magento via cron based on store view and order agehow to manually set order status to “Complete”?Change Order Status to custom status after order is completehow to change the status of the order to pending from complete?how to change magento order status programatically?Magento 2 - Change order status when Credit memo createdMagento 2 How to disable price from orders, customer account and order view if custom module is enabled?Magento 2.2.2 error when setting order status with API

Diagram with cylinder shapes and rectangles

What is the meaning of "prairie-dog" in this sentence?

What does "frozen" mean (e.g. for catcodes)?

What are the consequences for a developed nation to not accept any refugees?

Can we share mixing jug/beaker for developer, fixer and stop bath?

Where are the Wazirs?

Name for an item that is out of tolerance or over a threshold

What is the average number of draws it takes before you can not draw any more cards from the Deck of Many Things?

Tesco's Burger Relish Best Before End date number

Interpretation of non-significant results as "trends"

What are the effects of abstaining from eating a certain flavor?

What does the multimeter dial do internally?

Which is a better conductor, a very thick rubber wire or a very thin copper wire?

What purpose does mercury dichloride have in fireworks?

Passwordless authentication - how and when to invalidate a login code

Calculate the largest palindromic number from the product of two 6-digit numbers (100000 to 999999)

Jimmy needs your help!

What happens if a short can't be covered?

How did the IEC decide to create kibibytes?

Taking my Ph.D. advisor out for dinner after graduation

Gory anime with pink haired girl escaping an asylum

3-way switches no longer serving their purpose

Will Jimmy fall off his platform?

Was it ever illegal to name a pig "Napoleon" in France?



How to set default order status is complete when the order is created in Magento 1.x


Custom cron causing one page checkout deadlocksforce magento order status completeCreate invoice and shipment in magento via cron based on store view and order agehow to manually set order status to “Complete”?Change Order Status to custom status after order is completehow to change the status of the order to pending from complete?how to change magento order status programatically?Magento 2 - Change order status when Credit memo createdMagento 2 How to disable price from orders, customer account and order view if custom module is enabled?Magento 2.2.2 error when setting order status with API






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








0















I have a problem, my shop allows users to buy products with "Manage Stock = No and Qty = 0".



It's work fine, but when the order is created, if the customer buys the product with qty > 0 then order status = complete, but qty < 0, order status is not complete.



How to set default order status is complete when the order is created.



Thanks all.



My code



protected function _getOrderCreateModel() 
return Mage::getSingleton('adminhtml/sales_order_create');


public function createOrder($object)

$this->init($object);
$methodInstance = $this->_getOrderCreateModel()->getQuote()->getPayment()->getMethodInstance();
$methodInstance->getInfoInstance()->setQuote($this->_getOrderCreateModel()->getQuote());
$methodInstance->validate();
$this->_getOrderCreateModel()->getQuote()->setStoreToQuoteRate(1);
$this->_getOrderCreateModel()->getQuote()->setBaseToGlobalRate(1);
$this->_getOrderCreateModel()->getQuote()->setStoreToBaseRate(1);
$this->_getOrderCreateModel()->getQuote()->setBaseToQuoteRate(1);
if ($this->checkRewardPointModule()):
$amt = (-1) * Mage::helper("posrewardpoints")->creditsToMoney($object['pos_credits_credits_used']);
$this->_getOrderCreateModel()->getQuote()->setPosCreditsApplied($object['pos_credits_applied']);
$this->_getOrderCreateModel()->getQuote()->setPosCreditsCreditsUsed($object['pos_credits_credits_used']);
$this->_getOrderCreateModel()->getQuote()->setPosCreditsMoneyUsed($amt);
endif;
$this->_getOrderCreateModel()->saveQuote();
$this->_getOrderCreateModel()->getQuote()->setTotalsCollectedFlag(true);

$order = $this->_getOrderCreateModel()->createOrder();
$order->setData('pos_user_id', $object['pos_user_id']);
if ($object['comments'] != '')
$order->addStatusToHistory($order->getStatus(), $object['comments'], false);
$order->save();

if ($object['order_collected_by'] != '')
$state = $order->getState();
$status = 'order_collected_by';
$isNotified = false;
$order->setState($state);
$order->setStatus($status);
$order->addStatusToHistory($order->getStatus(), $object['order_collected_by'],$isNotified);
$order->save();

$couponCode = $this->_getOrderCreateModel()->getQuote()->getCouponCode();
if (!empty($couponCode))
Mage::helper('PointOfSales/Discount')->deleteCoupon();

$this->_getOrderCreateModel()->getQuote()->setIsActive(false)->save();

$this->affectWarehouse($order);

return $order;










share|improve this question






























    0















    I have a problem, my shop allows users to buy products with "Manage Stock = No and Qty = 0".



    It's work fine, but when the order is created, if the customer buys the product with qty > 0 then order status = complete, but qty < 0, order status is not complete.



    How to set default order status is complete when the order is created.



    Thanks all.



    My code



    protected function _getOrderCreateModel() 
    return Mage::getSingleton('adminhtml/sales_order_create');


    public function createOrder($object)

    $this->init($object);
    $methodInstance = $this->_getOrderCreateModel()->getQuote()->getPayment()->getMethodInstance();
    $methodInstance->getInfoInstance()->setQuote($this->_getOrderCreateModel()->getQuote());
    $methodInstance->validate();
    $this->_getOrderCreateModel()->getQuote()->setStoreToQuoteRate(1);
    $this->_getOrderCreateModel()->getQuote()->setBaseToGlobalRate(1);
    $this->_getOrderCreateModel()->getQuote()->setStoreToBaseRate(1);
    $this->_getOrderCreateModel()->getQuote()->setBaseToQuoteRate(1);
    if ($this->checkRewardPointModule()):
    $amt = (-1) * Mage::helper("posrewardpoints")->creditsToMoney($object['pos_credits_credits_used']);
    $this->_getOrderCreateModel()->getQuote()->setPosCreditsApplied($object['pos_credits_applied']);
    $this->_getOrderCreateModel()->getQuote()->setPosCreditsCreditsUsed($object['pos_credits_credits_used']);
    $this->_getOrderCreateModel()->getQuote()->setPosCreditsMoneyUsed($amt);
    endif;
    $this->_getOrderCreateModel()->saveQuote();
    $this->_getOrderCreateModel()->getQuote()->setTotalsCollectedFlag(true);

    $order = $this->_getOrderCreateModel()->createOrder();
    $order->setData('pos_user_id', $object['pos_user_id']);
    if ($object['comments'] != '')
    $order->addStatusToHistory($order->getStatus(), $object['comments'], false);
    $order->save();

    if ($object['order_collected_by'] != '')
    $state = $order->getState();
    $status = 'order_collected_by';
    $isNotified = false;
    $order->setState($state);
    $order->setStatus($status);
    $order->addStatusToHistory($order->getStatus(), $object['order_collected_by'],$isNotified);
    $order->save();

    $couponCode = $this->_getOrderCreateModel()->getQuote()->getCouponCode();
    if (!empty($couponCode))
    Mage::helper('PointOfSales/Discount')->deleteCoupon();

    $this->_getOrderCreateModel()->getQuote()->setIsActive(false)->save();

    $this->affectWarehouse($order);

    return $order;










    share|improve this question


























      0












      0








      0


      1






      I have a problem, my shop allows users to buy products with "Manage Stock = No and Qty = 0".



      It's work fine, but when the order is created, if the customer buys the product with qty > 0 then order status = complete, but qty < 0, order status is not complete.



      How to set default order status is complete when the order is created.



      Thanks all.



      My code



      protected function _getOrderCreateModel() 
      return Mage::getSingleton('adminhtml/sales_order_create');


      public function createOrder($object)

      $this->init($object);
      $methodInstance = $this->_getOrderCreateModel()->getQuote()->getPayment()->getMethodInstance();
      $methodInstance->getInfoInstance()->setQuote($this->_getOrderCreateModel()->getQuote());
      $methodInstance->validate();
      $this->_getOrderCreateModel()->getQuote()->setStoreToQuoteRate(1);
      $this->_getOrderCreateModel()->getQuote()->setBaseToGlobalRate(1);
      $this->_getOrderCreateModel()->getQuote()->setStoreToBaseRate(1);
      $this->_getOrderCreateModel()->getQuote()->setBaseToQuoteRate(1);
      if ($this->checkRewardPointModule()):
      $amt = (-1) * Mage::helper("posrewardpoints")->creditsToMoney($object['pos_credits_credits_used']);
      $this->_getOrderCreateModel()->getQuote()->setPosCreditsApplied($object['pos_credits_applied']);
      $this->_getOrderCreateModel()->getQuote()->setPosCreditsCreditsUsed($object['pos_credits_credits_used']);
      $this->_getOrderCreateModel()->getQuote()->setPosCreditsMoneyUsed($amt);
      endif;
      $this->_getOrderCreateModel()->saveQuote();
      $this->_getOrderCreateModel()->getQuote()->setTotalsCollectedFlag(true);

      $order = $this->_getOrderCreateModel()->createOrder();
      $order->setData('pos_user_id', $object['pos_user_id']);
      if ($object['comments'] != '')
      $order->addStatusToHistory($order->getStatus(), $object['comments'], false);
      $order->save();

      if ($object['order_collected_by'] != '')
      $state = $order->getState();
      $status = 'order_collected_by';
      $isNotified = false;
      $order->setState($state);
      $order->setStatus($status);
      $order->addStatusToHistory($order->getStatus(), $object['order_collected_by'],$isNotified);
      $order->save();

      $couponCode = $this->_getOrderCreateModel()->getQuote()->getCouponCode();
      if (!empty($couponCode))
      Mage::helper('PointOfSales/Discount')->deleteCoupon();

      $this->_getOrderCreateModel()->getQuote()->setIsActive(false)->save();

      $this->affectWarehouse($order);

      return $order;










      share|improve this question
















      I have a problem, my shop allows users to buy products with "Manage Stock = No and Qty = 0".



      It's work fine, but when the order is created, if the customer buys the product with qty > 0 then order status = complete, but qty < 0, order status is not complete.



      How to set default order status is complete when the order is created.



      Thanks all.



      My code



      protected function _getOrderCreateModel() 
      return Mage::getSingleton('adminhtml/sales_order_create');


      public function createOrder($object)

      $this->init($object);
      $methodInstance = $this->_getOrderCreateModel()->getQuote()->getPayment()->getMethodInstance();
      $methodInstance->getInfoInstance()->setQuote($this->_getOrderCreateModel()->getQuote());
      $methodInstance->validate();
      $this->_getOrderCreateModel()->getQuote()->setStoreToQuoteRate(1);
      $this->_getOrderCreateModel()->getQuote()->setBaseToGlobalRate(1);
      $this->_getOrderCreateModel()->getQuote()->setStoreToBaseRate(1);
      $this->_getOrderCreateModel()->getQuote()->setBaseToQuoteRate(1);
      if ($this->checkRewardPointModule()):
      $amt = (-1) * Mage::helper("posrewardpoints")->creditsToMoney($object['pos_credits_credits_used']);
      $this->_getOrderCreateModel()->getQuote()->setPosCreditsApplied($object['pos_credits_applied']);
      $this->_getOrderCreateModel()->getQuote()->setPosCreditsCreditsUsed($object['pos_credits_credits_used']);
      $this->_getOrderCreateModel()->getQuote()->setPosCreditsMoneyUsed($amt);
      endif;
      $this->_getOrderCreateModel()->saveQuote();
      $this->_getOrderCreateModel()->getQuote()->setTotalsCollectedFlag(true);

      $order = $this->_getOrderCreateModel()->createOrder();
      $order->setData('pos_user_id', $object['pos_user_id']);
      if ($object['comments'] != '')
      $order->addStatusToHistory($order->getStatus(), $object['comments'], false);
      $order->save();

      if ($object['order_collected_by'] != '')
      $state = $order->getState();
      $status = 'order_collected_by';
      $isNotified = false;
      $order->setState($state);
      $order->setStatus($status);
      $order->addStatusToHistory($order->getStatus(), $object['order_collected_by'],$isNotified);
      $order->save();

      $couponCode = $this->_getOrderCreateModel()->getQuote()->getCouponCode();
      if (!empty($couponCode))
      Mage::helper('PointOfSales/Discount')->deleteCoupon();

      $this->_getOrderCreateModel()->getQuote()->setIsActive(false)->save();

      $this->affectWarehouse($order);

      return $order;







      magento-1.9 orders order-status






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jun 28 at 11:08







      TN98

















      asked Jun 28 at 10:46









      TN98TN98

      31010 bronze badges




      31010 bronze badges




















          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%2f280071%2fhow-to-set-default-order-status-is-complete-when-the-order-is-created-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















          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%2f280071%2fhow-to-set-default-order-status-is-complete-when-the-order-is-created-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

          Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

          Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

          Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?