Example #1
0
 public function customerSaveAfter($observer)
 {
     $customer = $observer->getEvent()->getCustomer();
     $customerReward = Mage::getModel('customerreward/customer')->loadByCustomerId($customer->getId());
     if (!$customerReward->getId()) {
         return $this;
     }
     $is_notification = Mage::app()->getRequest()->getParam('is_notification') ? 1 : 0;
     $balance_change = Mage::app()->getRequest()->getParam('change_balance');
     if ($customerReward->getIsNotification() != $is_notification) {
         $customerReward->setIsNotification($is_notification)->save();
     }
     if ($balance_change) {
         $balanChange = new Varien_Object();
         $balanChange->setBalanceChange((int) $balance_change);
         Mage::helper('customerreward/action')->addTransaction('admin', $customer, $balanChange, array('notice' => Mage::helper('customerreward')->__('Change by admin')));
     }
     return $this;
 }