MageRewards Points Transfer Observer Implementation Example

In this example, we are observing the rewards_transfer_save_after and logging the new model's ID.

Here's what you'd need to add to your module's app/code/local/Mynamespace/Mymodule/etc/config.xml:

<global>
 <events>
  <rewards_transfer_save_after>
   <observers>
    <mymodulekey_rewards_observer_saveafter>
     <type>singleton</type>
     <class>mymodulekey/observer</class>
     <method>afterTransferSave</method>
    </mymodulekey_rewards_observer_saveafter>
   </observers>
  </rewards_transfer_save_after>
 </events>
</global><br>

Here's how your class app/code/local/Mynamespace/Mymodule/Model/Observer.php class would look like:

class Mynamespace_Mymodule_Model_Observer extends Varien_Object {
 public function afterTransferSave($obj) {
 $points_transfer = $obj->getEvent()->getRewardsTransfer();
 Mage::log("The points transfer with the id {$points_transfer->getId()} was just saved.");
 return $this;
 }
}<br>

Still need help? Get Help Get Help