I am trying to override a core observer, but nothing I have tried has worked. I am trying to observe the event sales_order_save_before. Here is my config file:

Location: app/code/local/DBCustom/Order/etc/config.xml


And Here is my observer:

Location: app/code/local/DBCustom/Order/Model/Observer.php


 * Class DBCustom_Order_Model_Observer
class DBCustom_Order_Model_Observer {

    public function salesOrderBeforeSave($observer)
        $order = $observer->getEvent()->getOrder();

        if ($order->getPayment()) {
            if ($order->getPayment()->getMethodInstance()->getCode() != 'free') {
                return $this;
        if ($order->canUnhold()) {
            return $this;

        if ($order->isCanceled() || $order->getState() === Mage_Sales_Model_Order::STATE_CLOSED) {
            return $this;
         * Allow forced creditmemo just in case if it wasn't defined before
        if (!$order->hasForcedCanCreditmemo()) {
        return $this;

I have flushed the cache multiple times, but still only goes to the core observer. I have also tried the following naming convention for the observer class as well, and it still didn't work <class>dbcustom_order/observer</class>

The module is active as well, and everything else besides the observers works as intended.

  • Which observer you want to overwrite? – Sohel Rana May 14 at 20:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.