ecshop添加类似于精品,新品,热销的模块

亲测绝对好使

1.在数据库中ecs_goods添加字段is_baoyou,执行语句

[sql]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. ALTER TABLE `ecs_goods` ADD `is_baoyou` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `is_hot` ;  

2.admin/goods.PHP,在

[php]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. $is_hot = isset($_POST['is_hot']) ? 1 : 0;  
后,添加
[php]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. $is_baoyou = isset($_POST['is_baoyou']) ? 1 : 0;  
[php]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. "seller_note, goods_weight, goods_number, warn_number, integral, give_integral, is_best, is_new, is_hot, " .  
修改为
[php]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. "seller_note, goods_weight, goods_number, warn_number, integral, give_integral, is_best, is_new, is_hot, is_baoyou, " .  
[php]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. " '$warn_number', '$_POST[integral]', '$give_integral', '$is_best', '$is_new', '$is_hot', '$is_on_sale', '$is_alone_sale', $is_shipping, ".  
修改为
[php]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. " '$warn_number', '$_POST[integral]', '$give_integral', '$is_best', '$is_new', '$is_hot', '$is_baoyou', '$is_on_sale', '$is_alone_sale', $is_shipping, ".  
[php]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. "seller_note, goods_weight, goods_number, warn_number, integral, give_integral, is_best, is_new, is_hot, is_real, " .  
修改为
[php]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. "seller_note, goods_weight, goods_number, warn_number, integral, give_integral, is_best, is_new, is_hot, is_baoyou, is_real, " .  
[php]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. " '$warn_number', '$_POST[integral]', '$give_integral', '$is_best', '$is_new', '$is_hot', 0, '$is_on_sale', '$is_alone_sale', $is_shipping, ".  
修改为
[php]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. " '$warn_number', '$_POST[integral]', '$give_integral', '$is_best', '$is_new', '$is_hot', '$is_baoyou', 0, '$is_on_sale', '$is_alone_sale', $is_shipping, ".  
[php]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. "is_hot = '$is_hot', " .  
后,添加
[php]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. "is_baoyou = '$is_baoyou', " .  
[php]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. /* 设为新品 */  
  2. elseif ($_POST['type'] == 'new')  
  3. {  
  4.     /* 检查权限 */  
  5.     admin_priv('goods_manage');  
  6.     update_goods($goods_id'is_new''1');  
  7. }  
  8.   
  9. /* 取消新品 */  
  10. elseif ($_POST['type'] == 'not_new')  
  11. {  
  12.     /* 检查权限 */  
  13.     admin_priv('goods_manage');  
  14.     update_goods($goods_id'is_new''0');  
  15. }  
后,添加
[php]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. /* 设为包邮 */  
  2. elseif ($_POST['type'] == 'is_baoyou')  
  3. {  
  4.     /* 检查权限 */  
  5.     admin_priv('goods_manage');  
  6.     update_goods($goods_id'is_baoyou''1');  
  7. }  
  8. /* 取消包邮 */  
  9. elseif ($_POST['type'] == 'not_baoyou')  
  10. {  
  11.     /* 检查权限 */  
  12.     admin_priv('goods_manage');  
  13.     update_goods($goods_id'is_baoyou''0');  
  14. }  
[php]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. /*------------------------------------------------------ */  
  2. //-- 修改热销推荐状态  
  3. /*------------------------------------------------------ */  
  4. elseif ($_REQUEST['act'] == 'toggle_hot')  
  5. {  
  6.     check_authz_json('goods_manage');  
  7.   
  8.     $goods_id       = intval($_POST['id']);  
  9.     $is_hot         = intval($_POST['val']);  
  10.   
  11.     if ($exc->edit("is_hot = '$is_hot', last_update=" .gmtime(), $goods_id))  
  12.     {  
  13.         clear_cache_files();  
  14.         make_json_result($is_hot);  
  15.     }  
  16. }  
后,添加
[php]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. /*------------------------------------------------------ */  
  2. //-- 修改包邮推荐状态  
  3. /*------------------------------------------------------ */  
  4. elseif ($_REQUEST['act'] == 'toggle_baoyou')  
  5. {  
  6.     check_authz_json('goods_manage');  
  7.   
  8.     $goods_id       = intval($_POST['id']);  
  9.     $is_baoyou      = intval($_POST['val']);  
  10.   
  11.     if ($exc->edit("is_baoyou = '$is_baoyou', last_update=" .gmtime(), $goods_id))  
  12.     {  
  13.         clear_cache_files();  
  14.         make_json_result($is_baoyou);  
  15.     }  
  16. }  


3.admin/includes/lib_goods.php,搜索function goods_list($is_delete, $real_goods=1, $conditions = '')

[php]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. case 'is_new':  
  2.     $where .= ' AND is_new=1';  
  3.     break;  
后,添加
[php]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. case 'is_baoyou':  
  2.     $where .= ' AND is_baoyou=1';  
  3.     break;  
[php]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. $sql = "SELECT goods_id, goods_name, goods_type, goods_sn, shop_price, is_on_sale, is_best, is_new, is_hot, sort_order, goods_number, integral, " .  
改为
[php]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. $sql = "SELECT goods_id, goods_name, goods_type, goods_sn, shop_price, is_on_sale, is_best, is_new, is_hot, is_baoyou, sort_order, goods_number, integral, " .  

4.admin/templates/goods_info.htm,在

[html]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. <input type="checkbox" name="is_hot" value="1" {if $goods.is_hot}checked="checked"{/if} />{$lang.is_hot}  
后,添加
[html]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. <input type="checkbox" name="is_baoyou" value="1" {if $goods.is_baoyou}checked="checked"{/if} />{$lang.is_baoyou}  
[html]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1.     <br /><label for="auto_thumb"><input type="checkbox" id="auto_thumb" name="auto_thumb" checked="true" value="1" onclick="handleAutoThumb(this.checked)" />{$lang.auto_thumb}</label>{/if}  
  2.   </td>  
  3. </tr>  

后,添加

[html]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1.           <tr>  
  2.             <td class="label">{$lang.is_baoyou}</td>  
  3.             <td><input type="text" name="is_baoyou" value="{$goods.is_baoyou}" size="20"/>  
  4.             </td>  
  5.           </tr>  

5.admin/templates/goods_list.htm,在
[html]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. <th><a href="javascript:listTable.sort('is_hot'); ">{$lang.is_hot}</a>{$sort_is_hot}</th>  
后,添加
[html]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. <th><a href="javascript:listTable.sort('is_baoyou'); ">{$lang.is_baoyou}</a>{$sort_is_baoyou}</th>  
[html]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. <td align="center"><img src="images/{if $goods.is_hot}yes{else}no{/if}.gif" onclick="listTable.toggle(this, 'toggle_hot', {$goods.goods_id})" /></td>  
后,添加
[html]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. <td align="center"><img src="images/{if $goods.is_baoyou}yes{else}no{/if}.gif" onclick="listTable.toggle(this, 'toggle_baoyou', {$goods.goods_id})" /></td>  

[html]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. <option value="hot">{$lang.hot}</option>  
  2. <option value="not_hot">{$lang.not_hot}</option>  
后,添加
[html]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. <option value="baoyou">{$lang.baoyou}</option>  
  2. <option value="not_baoyou">{$lang.baoyou}</option>  

6.languages\zh_cn\admin\goods.php

[php]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. $_LANG['batch_hot_confirm'] = '您确实要把选中的商品设为热销吗?';  
  2. $_LANG['batch_not_hot_confirm'] = '您确实要把选中的商品取消热销吗?';  
后,添加
[php]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. $_LANG['batch_baoyou_confirm'] = '您确实要把选中的商品设为包邮吗?';  
  2. $_LANG['batch_not_baoyou_confirm'] = '您确实要把选中的商品取消包邮吗?';  
[php]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. $_LANG['is_hot'] = '热销';  
后,添加
[php]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. $_LANG['is_baoyou'] = '包邮';  
[php]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. $_LANG['hot'] = '热销';  
  2. $_LANG['not_hot'] = '取消热销';  
后,添加
[php]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. $_LANG['baoyou'] = '包邮';  
  2. $_LANG['not_baoyou'] = '取消包邮';  

效果如图所示:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值