dongyu4554 2014-10-20 07:51
浏览 37
已采纳

为Magento购物车添加免费礼品

I am making a magento webshop for clothes. and i have 3 different coupons. so if the customers enter one of this coupons, they get different "gifts" .

E.G. Client nathaniel enters coupon d8f8sadf8 and his cart price higher then 50€, then he gets a free wristband.

OR

Client max enters coupon 2931209f and his cart price is higher then 50€, then he gets a free wristband AND 5% discount to his cart price.

I was trying to make it with cart price rules, but nothing realy works.

has anyone ever made something like this? If you know an extension which does this, i would also be happy.

  • 写回答

1条回答 默认 最新

  • drsxzut183207938 2014-10-20 10:56
    关注

    You will have to write a module for this.

    The logic is simple. Whenever a coupon is applied, the event salesrule_validator_process is dispatched by Magento. Your module should listen to this event using an observer.

    From the observer, you can get the quote object using which you can get the rule details including the coupon code. Now you can programmatically add the product you wish to the cart. If you are not familiar with this, use Google to research about each tasks I said and do it. Trust me, you will love it :-)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 对于这个复杂问题的解释说明
  • ¥50 三种调度算法报错 有实例
  • ¥15 关于#python#的问题,请各位专家解答!
  • ¥200 询问:python实现大地主题正反算的程序设计,有偿
  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败