0

如何为奖励操作添加自定义原因消息?

我创造了 :

  $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();

我喜欢添加类似的东西

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

这将在客户奖励历史记录的原因列中可见(后台)

4

1 回答 1

1

如果reasonRewards 数据库表中已经存在列,那么您只需要使用

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

保存值。

但是如果reason列不存在,则首先reason在数据库中创建一个新列,然后使用上面的代码保存该字段中的值。

于 2014-06-19T15:45:44.670 回答