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 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line