Code Customization Guidelines

Most of this stuff should be trivial for a programmer with experience programming in Magento. If this is your first programming project on Magento, it is not recommended that you attempt to customize core code of MageRewards until you have learned and played with Magento's module creation system.

Void of Warranty

Before you begin you need to know that while it is NOT a violation of your agreement to customize MageRewards core code, it does void your warranty for support and updates on that particular installation of MageRewards.

Although, if you have any questions you should still contact us. Our programmers will be happy to help with any technical questions if we can, and we like hearing what kind of customizations are being done. Obviously we can't be expected to support every custom hack that you do, but we'll do our best to help.

Safely extending MageRewards Classes in Another Module

Event Observers

The best way to extend MageRewards functionality from your own module within Magento is to implement event dispatches. Event observer registrations should be used whenever possible. You can also register to react on an observable event without obstructing the MageRewards execution process.

See here for a list of events that are dispatched by MageRewards.

Object Rewrites

In general you should only do rewrites in local modules, and only if an event observer cannot be used (see above). In your module you can modify your config.xml file and add rewrites to the MageRewards class files. Before the MageRewards files get loaded Magento will look at your rewrites. Your classes should then extend the class name they're rewriting. For example, if you're going to rewrite the rewards/points class (TBT_Rewards_Model_Points)

                   <points >[MyPackage_MyModule]_Model_Rewards_Points</points >

[MyPackage_MyModule]_Model_Rewards_Points should be the name of your class and that class should be extending the MageRewards class that you're rewriting. In the example, you'd be extending TBT_Rewards_Model_Points.

You can see the rewrites we do of Magento's classes here  Object Rewrites.

Other Customizations

Modifying Core MageRewards Class Files

You should  only be modifying core class definitions if you want a quick and dirty change and don't care about updating MageRewards or Magento in the future. If this is not the case, you should be rewriting and extending MageRewards classes in another module (see below).

To modify a class file, first copy the class file to the app/code/local folder in the exact same path as it is found in the app/code/community folder (starting with TBT/Rewards/... etc). Once that's done, you can make your required adjustments without changing the class name(s). Files in the app/code/local folder overwrite files in the app/code/community and app/code/core folder respectively so the effect is the same as modifying the core class.

Still need help? Get Help Get Help