Matoeil
Matoeil

Reputation: 7299

custom reason message for magento reward points

How to add a custom reason message for a reward action ?

I have created :

  $customerId = 1303177;
 $points = 10;

 $customer = Mage::getModel('customer/customer')->load($customerId);


 $reward = Mage::getModel('enterprise_reward/reward')
 ->setCustomer($customer)
 ->setWebsiteId(2)
 ->loadByCustomer();

 $reward->setPointsDelta($points)
->setAction(Enterprise_Reward_Model_Reward::REWARD_ACTION_ADMIN)
 ->setComment('Added programmatically')
  ->updateRewardPoints();

i like to add something like

   $reward->setReason('bonus point');

that would be visible in the reason column of the customer reward history ( back office )

Upvotes: 0

Views: 592

Answers (1)

MTM
MTM

Reputation: 919

If reason column already exists in the Rewards database table, then all you need is to use

$reward->setReason('bonus point'); $reward->save();

to save the values.

But if reason column doesn't exist then first create a new column reason in the database and then use the above code to save the values in that field.

Upvotes: 1

Related Questions