Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6738215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:20:25+00:00 2026-05-26T11:20:25+00:00

On Magento, I am developing a commission module which I need to pay my

  • 0

On Magento, I am developing a commission module which I need to pay my agents when the sales is completed and not when the order is placed.

Ideally I would want to capture it when the order state turns into ‘complete’ but I have not found an observer to do this ?

I could add this to the shipment observer but a order can have multiple shipment and hence not right.

Alternatively I could always fire a cron job to calculate the order for last hour but again does not seem the right way.

Any suggestions on what is the right way to do this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T11:20:26+00:00Added an answer on May 26, 2026 at 11:20 am

    Use the observer “sales_order_save_commit_after” or “sales_order_invoice_pay” then you can get the order status and depending on the status you do what you want. Here is an example:

    // for event sales_order_save_commit_after
    public function commissionCalculationOnComplete($observer)
    {
        $order = $observer->getOrder();
        if($order->getState() == Mage_Sales_Model_Order::STATE_COMPLETE){
        // do your order complete stuff
        }
    }
    

    or

    // Event sales_order_invoice_pay
    public function triggerProvisionCalculation ($observer)
    {
        $invoice = $observer->getEvent()->getInvoice();
        switch ($invoice->getState()) {
            case Mage_Sales_Model_Order_Invoice::STATE_PAID :
                //do your stuff
                break;
        }
        return $this;
    }
    

    You will have to check that you don’t do the calculation twice, because this method is triggered each time an order is saved.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While I was developing with Magento, I found out that I don't need to
In Magento on each products detail page I would like to list which categories
Does anyone have any good resources for developing Magento Modules that integrate with their
I'm developing an online store with Magento. The site will be high traffic and
I've recently started work on developing a site using Magento. All of my files
I have come across a bizarre error in the Magento shop I'm developing and
The Magento backend allows you to disable module output per site. I've done some
I have a Magento site in which there are about 20-25 extensions installed, among
I'm developing a magento theme; but my customer asked me a particular modification: he
i am developing a widget. For that i have to add images to the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.