博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Ecmall优惠券增加按照固定时间过期功能[TianYan教程]
阅读量:7208 次
发布时间:2019-06-29

本文共 2280 字,大约阅读时间需要 7 分钟。

hot3.png

目的:
目前ecmall的优惠券有开始时间和结束时间两种,但是如果商家希望实现满100送20购物券1个月有效,那么商家就得建立12个优惠券时间类型很不方便。因此我们考虑增加一个过期模式,即以优惠券当天为起始时间增加一个固定过期时间。例如发券后30天内使用有效。
11155900_nDsc.jpg
11155900_5v7X.jpg 
具体修改方法
1.增加mysql数据列
---优惠卷增加赠与时间
ALTER TABLE `ecm_user_coupon` ADD `send_time` INT( 10 ) NULL DEFAULT '0'
ALTER TABLE `ecm_coupon` ADD `exptype` TINYINT( 1 ) NULL DEFAULT '0'
ALTER TABLE `ecm_coupon` ADD `all_shop` TINYINT( 1 ) NULL DEFAULT '0'
ALTER TABLE `ecm_coupon` ADD `expday` INT( 10 ) NULL DEFAULT '0'
2.coupon.form.html 增加
<li>
<h3>{$lang.time_limit1}:</h3>
<p><input type="radio" name="exptype" value="0" <!--{if !$coupon.exptype}-->checked<!--{/if}--> />
<input type="text" class="text width2" name="start_time" value="<!--{if $coupon.start_time}-->{$coupon.start_time|date}<!--{else}-->{$today|date}<!--{/if}-->" id="add_time_from" readonly="readonly" />
{$lang.to} <input type="text" class="text width2" name="end_time" value="<!--{if $coupon.end_time}-->{$coupon.end_time|date}<!--{else}-->{$endday|date}<!--{/if}-->" id="add_time_to" readonly="readonly" /><b class="strong">*</b>
</p>
</li>
<li>
<h3>{$lang.time_limit2}:</h3>
<p><input type="radio" name="exptype" value="1"  <!--{if $coupon.exptype}-->checked<!--{/if}-->/>
{$lang.exptype1}<input type="text" class="text width1" name="expday" value="<!--{if $coupon.expday}-->{$coupon.expday}<!--{else}-->30<!--{/if}-->" />{$lang.day}
<b class="strong">*</b>
</p>
</li>
3.coupon.lang.php
'time_limit1' => '使用期限一',
'time_limit2' => '使用期限二',
'expday_drop_confirm' => '删除后所有未用优惠券将全部清空,请确认!',
'view_stat' => '状态',
'stat_ok' => '有效',
'stat_err' => '失效',
4.coupon.app.php
add() edit()数据添加部分修改为
$coupon = array(
'coupon_name' => trim($_POST['coupon_name']),
'coupon_value' => $coupon_value,
'store_id' => $this->_store_id,
'use_times' => $use_times,
'start_time' => $start_time,
'end_time' => $end_time,
'min_amount' => $min_amount, //TianYan
'if_issue'  => trim($_POST['if_issue']) == 1 ? 1 : 0,
'all_shop'  => trim($_POST['all_shop']) == 1 ? 1 : 0, //TianYan
'exptype'  => $exptype, //TianYan20091121
'expday'  =>  $expday, //TianYan20091121
);
5.是优惠券有效验证order.app.php 增加
check_coupon()函数 index()函数增加
if($coupon['exptype']) //TianYan20091121
{
$coupon['end_time'] =  time()+$coupon['expday']*24*60*60;
}
完成
有问题加入Ecmall开发群52492705,联盟成员和已购买插件的等待升级补丁。

转载于:https://my.oschina.net/u/779687/blog/122084

你可能感兴趣的文章
scrapy软连接失效和pip软连接失效
查看>>
IOS开发之OC-Switf 混编 -(OC 引 Swift 文件)
查看>>
JAVA并发之多线程基础(2)
查看>>
服务器返回的常见的http状态码
查看>>
HASHMAP(JDK1.7)最详细原理分析(二)
查看>>
string数组怎么定义
查看>>
我的关于前端一些知识点的理解《一》
查看>>
Asynctask源码分析
查看>>
Promise基础用法
查看>>
[译] Spring 的分布式事务实现-使用和不使用XA — 第三部分
查看>>
区块链软件公司:创新的区块链技术如何改变法律行业的面貌
查看>>
一张时序图让你看懂:脏读、不可重复读
查看>>
js创建对象的几种方法
查看>>
浮点数杂想
查看>>
摧枯拉朽,说说ES6的三把火
查看>>
Java/Android基础-02
查看>>
nginx代理响应报文体不全解决思路
查看>>
前端性能优化 —— 项目瘦身
查看>>
全球人形机器人接连突破 拟人度越来越高
查看>>
vue按需加载
查看>>