将 [magento] 优惠券代码限制为特定客户列表?
关于如何限制特定客户列表使用优惠券代码有什么想法吗?
背景:我的公司正在进行促销活动,我们已经通过电子邮件向 2000 多个高价值客户列表发送了折扣代码。我们不希望所有客户都能够使用该代码,而只是我们列表中的客户。问题是优惠券代码已经发布在一些流行的论坛和其他地方,所以除非我们采取措施阻止它,否则我们会收到一堆不打算获取代码的人的订单。
我正在尝试进行一些紧急损害控制 - 我想我必须在某个地方进行代码修改,但我仍在环顾四周,无法找出最佳位置。我的文件中有一份客户列表。
Any ideas on how to restrict the coupon code to be used by a specific list of customers?
Background: My company is doing a promo, and we already emailed a discount code out to a list of 2000+ highly valuable customers. We don't want ALL of our customers to be able to use the code, just the ones in our list. And the problem is that the coupon code has already been posted on some popular forums, and other places, so unless we do something to prevent it, we'll get a bunch of orders from folks that weren't intended to get the code.
I am trying to do some emergency damage control - I figure I am gonna have to make a code modification somewhere, but I am still looking around, can't figure out the best place. I have a list of customers in a file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以创建一个观察者来观察
salesrule_validator_process
(应用购物车规则时会触发此事件),该观察者必须检查两件事:应用的规则是您想要限制给客户的规则列表:
如果满足第一个条件,则检查客户是否已登录,并且电子邮件是其中的电子邮件之一您的列表:
您应该重构此代码以使其干燥,而且我还没有不做一个实际的 if 条件,但你明白了。
此外,您还必须更改消息“优惠券已成功应用”。
告诉我您是否需要更多详细信息。
You could create an observer observing
salesrule_validator_process
(this event is triggered when a shopping cart rule is applied) which would have to check 2 things:the rule applied is the rule you wanna restrict to your customers list:
if the first condition is met, then check that the customer is logged in and that is email is one of the emails in your list:
you should refactor this code to queep it DRY, and also I haven't make an actual if condition, but you get the picture.
also you'll have to change the message "coupon has been succesfully applied".
tell me if you need more details.
Sdek 你可以像 Osdave 解释的那样创建观察者。或者,如果您有已收到促销代码和信息的客户列表你不愿意让他们使用那个促销。
您可以执行以下操作
这应该可以满足您想要完成的任务。
Sdek u can create the oberver like Osdave explained. Or if u have a list of customers who have received the Promo code & ur not willing to let them use that promo.
u can do as follows
This should fulfill what ur trying to accomplish.
也许您可以使用客户折扣
Perhaps you could use customer discounts