0

I haven't found the right trigger to nottify my client after the product was confirmed as received.

In other words, I change the Order status to complete, but no email is sent. I've created a new template as usual, but can't figure out how to set the trigger that will send the message automatically when the product I define the order as delivered.

Any tip is appreciated.

1

1 Answer 1

0
protected function _setState($state, $status = false, $comment = '',
$isCustomerNotified = null, $shouldProtectState = false){Mage::dispatchEvent('sales_order_status_before', array('order' => $this, 'state' => $state, 'status' => $status, 'comment' => $comment, 'isCustomerNotified' => $isCustomerNotified, 'shouldProtectState' => $shouldProtectState));
// attempt to set the specified state
if ($shouldProtectState) {
    if ($this->isStateProtected($state)) {
        Mage::throwException(
            Mage::helper('sales')->__('The Order State "%s" must not be set manually.', $state)
        );
    }
}
$this->setData('state', $state);

// add status history
if ($status) {
    if ($status === true) {
        $status = $this->getConfig()->getStateDefaultStatus($state);
    }
    $this->setStatus($status);
    $history = $this->addStatusHistoryComment($comment, false); // no sense to set $status again
    $history->setIsCustomerNotified($isCustomerNotified); // for backwards compatibility }Mage::dispatchEvent('sales_order_status_after', array('order' => $this, 'state' => $state, 'status' => $status, 'comment' => $comment, 'isCustomerNotified' => $isCustomerNotified, 'shouldProtectState' => $shouldProtectState));
return $this;}

define you events and listen to it, override Mage_Sales_Model_Order

3
  • Ok I'll try and I'll let you know if it works... Commented Jul 10, 2016 at 0:33
  • 1
    @CarlosEduardoSantos it it works well? Commented Aug 29, 2016 at 11:22
  • Thanks, It's been a while but it worked like a charm! Commented Jun 3, 2021 at 15:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.