魔幻精灵

文章 分类 评论
275 7 14

站点介绍

魔幻精灵网

ECSHOP同时使用多个红包

魔幻精灵 2018-05-15 2493 0条评论 网站知识

首页 / 正文

问题描述:ECSHOP设置了3种订单红包,满100元(送10元红包)、500元(送30元红包)、1000元(送50元红包
问题情况:当用户订单为1100元时,红包发放情况为:发10元红包11个、发30元红包2个、发50元红包1个
解决描述:100>订单金额<500时只发一个10元红包。500>订单金额<1000时只发一个30元红包,1000>订单金额只发一个50元。ECSHOP插件网提供全网独家完美解决方案如下:
打开includes\lib_order.php文件,搜索如下代码:

    /* 按订单发的红包 */
    $sql = "SELECT FLOOR('$amount' / min_amount) * type_money " .
            "FROM " . $GLOBALS['ecs']->table('bonus_type') .
            " WHERE send_type = '" . SEND_BY_ORDER . "' " .
            " AND send_start_date <= '$today' " .
            "AND send_end_date >= '$today' " .
            "AND min_amount ";
    $order_total = floatval($GLOBALS['db']->getOne($sql));

很显然凡是比较最低订单金额大的订单,都会导致发放数个红包,我们其实只要发的是最大的红包那个就可以了,目前最新ECSHOP3.0版本依旧存在此问题官网尚未解决。所以我们完善将以上代码修改如下

    /* 按订单发的红包 */
    $sql = "SELECT FLOOR('$amount' / min_amount) * type_money " .
            "FROM " . $GLOBALS['ecs']->table('bonus_type') .
            " WHERE send_type = '" . SEND_BY_ORDER . "' " .
            " AND send_start_date <= '$today' " .
            "AND send_end_date >= '$today' " .
            "AND min_amount > 0 AND min_amount <= '$amount' ORDER BY min_amount DESC LIMIT 1 ";
    $order_total = floatval($GLOBALS['db']->getOne($sql));

就是说订单额度的红包发放条件,取一个即可。
再搜索如下代码

    /* 查询按订单发的红包 */
    $sql = "SELECT type_id, type_money, NULLLOOR('$amount' / min_amount), 1) AS number " .
            "FROM " . $GLOBALS['ecs']->table('bonus_type') .
            "WHERE send_type = '" . SEND_BY_ORDER . "' " .
            "AND send_start_date <= '$order_time' " .
            "AND send_end_date >= '$order_time' " .
    $list = array_merge($list, $GLOBALS['db']->getAll($sql));

将以上代码修改如下

    /* 查询按订单发的红包 */
    $sql = "SELECT type_id, type_money, IFNULL(FLOOR('$amount' / min_amount), 1) AS number " .
            "FROM " . $GLOBALS['ecs']->table('bonus_type') .
            "WHERE send_type = '" . SEND_BY_ORDER . "' " .
            "AND send_start_date <= '$order_time' " .
            "AND send_end_date >= '$order_time' " .
            "AND min_amount > 0 AND min_amount <= '$amount' ORDER BY min_amount DESC LIMIT 1 ";
    $list = array_merge($list, $GLOBALS['db']->getAll($sql));

本文原创地址:https://www.ecshop.vc/article-309.html
版权所有 © 转载时必须以链接形式注明出处!


评论(0)

最新评论

  • tam compact

    My partner and I absolutely love your blog and find many of your post's to be exactly I'm looking for. Would you offer guest writers to write content available for you? I wouldn't mind writing a post or elaborating on a lot of the subjects you write about here. Again, awesome site!

  • ae888

    Excellent beat ! I would like to apprentice while you amend your website, how could i subscribe for a blog website? The account aided me a acceptable deal. I had been a little bit acquainted of this your broadcast provided bright clear concept

  • mbee.com.vn

    Simply want to say your article is as astounding. The clarity in your post is just cool and i can assume you're an expert on this subject. Fine with your permission let me to grab your RSS feed to keep up to date with forthcoming post. Thanks a million and please keep up the enjoyable work.

  • Life insurance

    Hi there, You've done a fantastic job. I will certainly digg it and personally suggest to my friends. I am confident they'll be benefited from this web site.

  • vách vệ sinh

    You've made some good points there. I looked on the web to find out more about the issue and found most people will go along with your views on this site.

  • tam compact

    Hi, I do think this is an excellent web site. I stumbledupon it ;) I am going to revisit once again since i have saved as a favorite it. Money and freedom is the best way to change, may you be rich and continue to help others.

  • PG เว็บตรงไม่ผ่านเอเย่นต์

    เดิมพันบาคาร่ามันที่สล็อต666เล่นคาสิโน 777เดิมพันออนไลน์ทดลอง เล่น สล็อต pgสล็อต เครดิตฟรจัดคาสิโนออนไลน์777แทงpgสล็อตวัดใจสล็อต ออนไลน์จัดสล็อต เว็บตรง แตก ง่ายวัดใจสล็อต เว็บ ตรง แตก ง่ายวัดใจสล็อต pg เว็บ ตรงเดิมพันу9สล็อตเทรดซุปเปอร์ สล็อต 666เดิมพันบาคาร่า ออนไลน์ ufa99เดิมพันสล็อตxo168จัดสล็อต ออนไลน์ sabai55แทงสล็อต 68วัดดวงสล็อต ฝาก20รับ100 เว็บตรงวัดใจสล็อต เว็บแท้วัดโคตรเทพnoname auto สล็อตเดิมพันออนไลน์โหลด สล็อต666วัดmgw สล็อต

  • Charlene

    Simply wish to say your article is as surprising. The clarity in your post is just cool and i can assume you are an expert on this subject. Fine with your permission allow me to grab your feed to keep up to date with forthcoming post. Thanks a million and please carry on the gratifying work.

  • đăng nhập ae888

    There's certainly a lot to know about this topic. I love all of the points you made.

  • dp595.com

    Great blog you've got here.. It's difficult to find quality writing like yours these days. I really appreciate individuals like you! Take care!!

日历

2024年12月

1234567
891011121314
15161718192021
22232425262728
293031    

标签云

文章目录

推荐关键字:

配色方案