observer to change status after invoicingHow to define the order status after creating an invoiceHow to change order status after it has been invoicedProblems related to magento invoicingmain.CRITICAL: Plugin class doesn't existMagento 2 - Change Order status after invoicingMagento 2: How to override newsletter Subscriber modelChange order status after order placed regardless payment methodChange invoice status in DBMagento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsOrder status doesn't change to “Complete” after shipping and invoicing

Expected Waiting Time in a Queue with exponential distribution

Dangerous workplace travelling

Does XQuartz work on macOS Mojave?

Is there a word that describes the unjustified use of a more complex word?

Nested loops to process groups of pictures

Why did WWI include Japan?

Has the United States ever had a non-Christian President?

Why would a military not separate its forces into different branches?

Endgame puzzle: How to avoid stalemate and win?

Mug and wireframe entirely disappeared

Why symmetry transformations have to commute with Hamiltonian?

Gerrymandering Puzzle - Rig the Election

Find magical solution to magical equation

Start job from another SQL server instance

To kill a cuckoo

Correct way of drawing empty, half-filled and fully filled circles?

Does "Captain Marvel" contain spoilers for "Avengers: Infinity War"?

History of the kernel of a homomorphism?

Prove that a definite integral is an infinite sum

A factorization game

How to pass hash as password to ssh server

Where to draw the line between quantum mechanics theory and its interpretation(s)?

Voltage Balun 1:1

Is there precedent or are there procedures for a US president refusing to concede to an electoral defeat?



observer to change status after invoicing


How to define the order status after creating an invoiceHow to change order status after it has been invoicedProblems related to magento invoicingmain.CRITICAL: Plugin class doesn't existMagento 2 - Change Order status after invoicingMagento 2: How to override newsletter Subscriber modelChange order status after order placed regardless payment methodChange invoice status in DBMagento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsOrder status doesn't change to “Complete” after shipping and invoicing






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








4















I would like to know what is the correct method for change status of order when i create the invoice.
I created an observer on the basis of what I saw on the internet :



class statutafterinvoice implements ObserverInterface


/**
* Message manager
*
* @var MagentoFrameworkMessageManagerInterface
*/
protected $messageManager;

/**
* Constructor
*
* @param MagentoFrameworkMessageManagerInterface $messageManager Message Manager
*
* @return void
*/
public function __construct(
)
//$this->messageManager = $messageManager;


/**
* Display a custom message when customer log in
*
* @param MagentoFrameworkEventObserver $observer Observer
*
* @return void
*/
public function execute(MagentoFrameworkEventObserver $observer)

$methode = $observer->getEvent()->getInvoice()->getOrder()->getPayment()->getMethodInstance()->getCode();
if($methode=="xxx_bvr")
$observer->getEvent()->getInvoice()->getOrder()->setStatus('attente_paiement', true);







and here is my 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_invoice_save_after">
<observer name="bvr_statut_after_invoice" instance="AcmeBVRObserverstatutafterinvoice"/>
</event>
</config>


this code dont't work.



do you know the solution for change the status when i invoice the order?
i thank you very much










share|improve this question






















  • What is the state of your order status ?

    – Steve Pham
    Apr 5 '18 at 3:37

















4















I would like to know what is the correct method for change status of order when i create the invoice.
I created an observer on the basis of what I saw on the internet :



class statutafterinvoice implements ObserverInterface


/**
* Message manager
*
* @var MagentoFrameworkMessageManagerInterface
*/
protected $messageManager;

/**
* Constructor
*
* @param MagentoFrameworkMessageManagerInterface $messageManager Message Manager
*
* @return void
*/
public function __construct(
)
//$this->messageManager = $messageManager;


/**
* Display a custom message when customer log in
*
* @param MagentoFrameworkEventObserver $observer Observer
*
* @return void
*/
public function execute(MagentoFrameworkEventObserver $observer)

$methode = $observer->getEvent()->getInvoice()->getOrder()->getPayment()->getMethodInstance()->getCode();
if($methode=="xxx_bvr")
$observer->getEvent()->getInvoice()->getOrder()->setStatus('attente_paiement', true);







and here is my 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_invoice_save_after">
<observer name="bvr_statut_after_invoice" instance="AcmeBVRObserverstatutafterinvoice"/>
</event>
</config>


this code dont't work.



do you know the solution for change the status when i invoice the order?
i thank you very much










share|improve this question






















  • What is the state of your order status ?

    – Steve Pham
    Apr 5 '18 at 3:37













4












4








4








I would like to know what is the correct method for change status of order when i create the invoice.
I created an observer on the basis of what I saw on the internet :



class statutafterinvoice implements ObserverInterface


/**
* Message manager
*
* @var MagentoFrameworkMessageManagerInterface
*/
protected $messageManager;

/**
* Constructor
*
* @param MagentoFrameworkMessageManagerInterface $messageManager Message Manager
*
* @return void
*/
public function __construct(
)
//$this->messageManager = $messageManager;


/**
* Display a custom message when customer log in
*
* @param MagentoFrameworkEventObserver $observer Observer
*
* @return void
*/
public function execute(MagentoFrameworkEventObserver $observer)

$methode = $observer->getEvent()->getInvoice()->getOrder()->getPayment()->getMethodInstance()->getCode();
if($methode=="xxx_bvr")
$observer->getEvent()->getInvoice()->getOrder()->setStatus('attente_paiement', true);







and here is my 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_invoice_save_after">
<observer name="bvr_statut_after_invoice" instance="AcmeBVRObserverstatutafterinvoice"/>
</event>
</config>


this code dont't work.



do you know the solution for change the status when i invoice the order?
i thank you very much










share|improve this question














I would like to know what is the correct method for change status of order when i create the invoice.
I created an observer on the basis of what I saw on the internet :



class statutafterinvoice implements ObserverInterface


/**
* Message manager
*
* @var MagentoFrameworkMessageManagerInterface
*/
protected $messageManager;

/**
* Constructor
*
* @param MagentoFrameworkMessageManagerInterface $messageManager Message Manager
*
* @return void
*/
public function __construct(
)
//$this->messageManager = $messageManager;


/**
* Display a custom message when customer log in
*
* @param MagentoFrameworkEventObserver $observer Observer
*
* @return void
*/
public function execute(MagentoFrameworkEventObserver $observer)

$methode = $observer->getEvent()->getInvoice()->getOrder()->getPayment()->getMethodInstance()->getCode();
if($methode=="xxx_bvr")
$observer->getEvent()->getInvoice()->getOrder()->setStatus('attente_paiement', true);







and here is my 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_invoice_save_after">
<observer name="bvr_statut_after_invoice" instance="AcmeBVRObserverstatutafterinvoice"/>
</event>
</config>


this code dont't work.



do you know the solution for change the status when i invoice the order?
i thank you very much







magento2 invoice






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Sep 8 '16 at 12:26









straussstrauss

1761417




1761417












  • What is the state of your order status ?

    – Steve Pham
    Apr 5 '18 at 3:37

















  • What is the state of your order status ?

    – Steve Pham
    Apr 5 '18 at 3:37
















What is the state of your order status ?

– Steve Pham
Apr 5 '18 at 3:37





What is the state of your order status ?

– Steve Pham
Apr 5 '18 at 3:37










1 Answer
1






active

oldest

votes


















0














Order states.



After order has been placed, it gets New state. At that point, you can Hold it, Ship it, Invoice it or Cancel it, thereby assigning your order Hold, Processing, Processing, or Cancelled state, respectively. Once you ship and invoice, your order receives Completed state.



Now, each of these states can have a separate status, that you can define yourself if System -> Order statuses. In your case, if you want the order to say Dispatched, after you are finished shipping and invoicing, you would add Dispatched order status and assign it to Complete order state. Same goes for any other order states.



Option 1: Normally when an invoice is created (and no shipment is created) it sets the state to processing and the status to the default status (or some other status if that is set in the payment method).



Option 2: If the shipment is already created or if we are talking about virtual products (gift cards or downloadable products or other virtual products) the state switches to complete and the status to de selected default status (by default also complete).



Link ref :- How to define the order status after creating an invoice






share|improve this answer

























  • On magento 1.7.0.2, i have created an observer which it changed the status of order when i invoiced the order and i I would do the same again on magento2!!!

    – strauss
    Sep 8 '16 at 12:53











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%2f135367%2fobserver-to-change-status-after-invoicing%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Order states.



After order has been placed, it gets New state. At that point, you can Hold it, Ship it, Invoice it or Cancel it, thereby assigning your order Hold, Processing, Processing, or Cancelled state, respectively. Once you ship and invoice, your order receives Completed state.



Now, each of these states can have a separate status, that you can define yourself if System -> Order statuses. In your case, if you want the order to say Dispatched, after you are finished shipping and invoicing, you would add Dispatched order status and assign it to Complete order state. Same goes for any other order states.



Option 1: Normally when an invoice is created (and no shipment is created) it sets the state to processing and the status to the default status (or some other status if that is set in the payment method).



Option 2: If the shipment is already created or if we are talking about virtual products (gift cards or downloadable products or other virtual products) the state switches to complete and the status to de selected default status (by default also complete).



Link ref :- How to define the order status after creating an invoice






share|improve this answer

























  • On magento 1.7.0.2, i have created an observer which it changed the status of order when i invoiced the order and i I would do the same again on magento2!!!

    – strauss
    Sep 8 '16 at 12:53















0














Order states.



After order has been placed, it gets New state. At that point, you can Hold it, Ship it, Invoice it or Cancel it, thereby assigning your order Hold, Processing, Processing, or Cancelled state, respectively. Once you ship and invoice, your order receives Completed state.



Now, each of these states can have a separate status, that you can define yourself if System -> Order statuses. In your case, if you want the order to say Dispatched, after you are finished shipping and invoicing, you would add Dispatched order status and assign it to Complete order state. Same goes for any other order states.



Option 1: Normally when an invoice is created (and no shipment is created) it sets the state to processing and the status to the default status (or some other status if that is set in the payment method).



Option 2: If the shipment is already created or if we are talking about virtual products (gift cards or downloadable products or other virtual products) the state switches to complete and the status to de selected default status (by default also complete).



Link ref :- How to define the order status after creating an invoice






share|improve this answer

























  • On magento 1.7.0.2, i have created an observer which it changed the status of order when i invoiced the order and i I would do the same again on magento2!!!

    – strauss
    Sep 8 '16 at 12:53













0












0








0







Order states.



After order has been placed, it gets New state. At that point, you can Hold it, Ship it, Invoice it or Cancel it, thereby assigning your order Hold, Processing, Processing, or Cancelled state, respectively. Once you ship and invoice, your order receives Completed state.



Now, each of these states can have a separate status, that you can define yourself if System -> Order statuses. In your case, if you want the order to say Dispatched, after you are finished shipping and invoicing, you would add Dispatched order status and assign it to Complete order state. Same goes for any other order states.



Option 1: Normally when an invoice is created (and no shipment is created) it sets the state to processing and the status to the default status (or some other status if that is set in the payment method).



Option 2: If the shipment is already created or if we are talking about virtual products (gift cards or downloadable products or other virtual products) the state switches to complete and the status to de selected default status (by default also complete).



Link ref :- How to define the order status after creating an invoice






share|improve this answer















Order states.



After order has been placed, it gets New state. At that point, you can Hold it, Ship it, Invoice it or Cancel it, thereby assigning your order Hold, Processing, Processing, or Cancelled state, respectively. Once you ship and invoice, your order receives Completed state.



Now, each of these states can have a separate status, that you can define yourself if System -> Order statuses. In your case, if you want the order to say Dispatched, after you are finished shipping and invoicing, you would add Dispatched order status and assign it to Complete order state. Same goes for any other order states.



Option 1: Normally when an invoice is created (and no shipment is created) it sets the state to processing and the status to the default status (or some other status if that is set in the payment method).



Option 2: If the shipment is already created or if we are talking about virtual products (gift cards or downloadable products or other virtual products) the state switches to complete and the status to de selected default status (by default also complete).



Link ref :- How to define the order status after creating an invoice







share|improve this answer














share|improve this answer



share|improve this answer








edited Apr 13 '17 at 12:54









Community

1




1










answered Sep 8 '16 at 12:40









ArjunArjun

1,929826




1,929826












  • On magento 1.7.0.2, i have created an observer which it changed the status of order when i invoiced the order and i I would do the same again on magento2!!!

    – strauss
    Sep 8 '16 at 12:53

















  • On magento 1.7.0.2, i have created an observer which it changed the status of order when i invoiced the order and i I would do the same again on magento2!!!

    – strauss
    Sep 8 '16 at 12:53
















On magento 1.7.0.2, i have created an observer which it changed the status of order when i invoiced the order and i I would do the same again on magento2!!!

– strauss
Sep 8 '16 at 12:53





On magento 1.7.0.2, i have created an observer which it changed the status of order when i invoiced the order and i I would do the same again on magento2!!!

– strauss
Sep 8 '16 at 12:53

















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%2f135367%2fobserver-to-change-status-after-invoicing%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

Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

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

Magento 2.3: How do i solve this, Not registered handle, on custom form?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?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form