class Custom_Price_Observer { public function modifyProductPrice(Varien_Event_Observer $observer) { $product = $observer->getEvent()->getProduct(); $price = $product->getPrice(); // Do some calculation or condition here to modify the price value $product->setPrice($newPrice); } }
class Custom_Order_Observer { public function modifyOrderTotal(Varien_Event_Observer $observer) { $order = $observer->getEvent()->getOrder(); $total = $order->getBaseTotal(); // Do some custom logic to modify the total value $order->setBaseTotal($newTotal); } }Both of these examples are using the Varien_Event_Observer getObject() method in Magento Core library.