亲测绝对好使
1.在数据库中ecs_goods添加字段is_baoyou,执行语句
- ALTER TABLE `ecs_goods` ADD `is_baoyou` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `is_hot` ;
2.admin/goods.PHP,在
- $is_hot = isset($_POST['is_hot']) ? 1 : 0;
- $is_baoyou = isset($_POST['is_baoyou']) ? 1 : 0;
- "seller_note, goods_weight, goods_number, warn_number, integral, give_integral, is_best, is_new, is_hot, " .
- "seller_note, goods_weight, goods_number, warn_number, integral, give_integral, is_best, is_new, is_hot, is_baoyou, " .
- " '$warn_number', '$_POST[integral]', '$give_integral', '$is_best', '$is_new', '$is_hot', '$is_on_sale', '$is_alone_sale', $is_shipping, ".
- " '$warn_number', '$_POST[integral]', '$give_integral', '$is_best', '$is_new', '$is_hot', '$is_baoyou', '$is_on_sale', '$is_alone_sale', $is_shipping, ".
- "seller_note, goods_weight, goods_number, warn_number, integral, give_integral, is_best, is_new, is_hot, is_real, " .
- "seller_note, goods_weight, goods_number, warn_number, integral, give_integral, is_best, is_new, is_hot, is_baoyou, is_real, " .
- " '$warn_number', '$_POST[integral]', '$give_integral', '$is_best', '$is_new', '$is_hot', 0, '$is_on_sale', '$is_alone_sale', $is_shipping, ".
- " '$warn_number', '$_POST[integral]', '$give_integral', '$is_best', '$is_new', '$is_hot', '$is_baoyou', 0, '$is_on_sale', '$is_alone_sale', $is_shipping, ".
- "is_hot = '$is_hot', " .
- "is_baoyou = '$is_baoyou', " .
- /* 设为新品 */
- elseif ($_POST['type'] == 'new')
- {
- /* 检查权限 */
- admin_priv('goods_manage');
- update_goods($goods_id, 'is_new', '1');
- }
- /* 取消新品 */
- elseif ($_POST['type'] == 'not_new')
- {
- /* 检查权限 */
- admin_priv('goods_manage');
- update_goods($goods_id, 'is_new', '0');
- }
- /* 设为包邮 */
- elseif ($_POST['type'] == 'is_baoyou')
- {
- /* 检查权限 */
- admin_priv('goods_manage');
- update_goods($goods_id, 'is_baoyou', '1');
- }
- /* 取消包邮 */
- elseif ($_POST['type'] == 'not_baoyou')
- {
- /* 检查权限 */
- admin_priv('goods_manage');
- update_goods($goods_id, 'is_baoyou', '0');
- }
- /*------------------------------------------------------ */
- //-- 修改热销推荐状态
- /*------------------------------------------------------ */
- elseif ($_REQUEST['act'] == 'toggle_hot')
- {
- check_authz_json('goods_manage');
- $goods_id = intval($_POST['id']);
- $is_hot = intval($_POST['val']);
- if ($exc->edit("is_hot = '$is_hot', last_update=" .gmtime(), $goods_id))
- {
- clear_cache_files();
- make_json_result($is_hot);
- }
- }
- /*------------------------------------------------------ */
- //-- 修改包邮推荐状态
- /*------------------------------------------------------ */
- elseif ($_REQUEST['act'] == 'toggle_baoyou')
- {
- check_authz_json('goods_manage');
- $goods_id = intval($_POST['id']);
- $is_baoyou = intval($_POST['val']);
- if ($exc->edit("is_baoyou = '$is_baoyou', last_update=" .gmtime(), $goods_id))
- {
- clear_cache_files();
- make_json_result($is_baoyou);
- }
- }
3.admin/includes/lib_goods.php,搜索function goods_list($is_delete, $real_goods=1, $conditions = '')在
- case 'is_new':
- $where .= ' AND is_new=1';
- break;
- case 'is_baoyou':
- $where .= ' AND is_baoyou=1';
- break;
- $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, " .
- $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,在
- <input type="checkbox" name="is_hot" value="1" {if $goods.is_hot}checked="checked"{/if} />{$lang.is_hot}
- <input type="checkbox" name="is_baoyou" value="1" {if $goods.is_baoyou}checked="checked"{/if} />{$lang.is_baoyou}
- <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}
- </td>
- </tr>
后,添加
- <tr>
- <td class="label">{$lang.is_baoyou}</td>
- <td><input type="text" name="is_baoyou" value="{$goods.is_baoyou}" size="20"/>
- </td>
- </tr>
5.admin/templates/goods_list.htm,在
- <th><a href="javascript:listTable.sort('is_hot'); ">{$lang.is_hot}</a>{$sort_is_hot}</th>
- <th><a href="javascript:listTable.sort('is_baoyou'); ">{$lang.is_baoyou}</a>{$sort_is_baoyou}</th>
- <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>
- <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>
在
- <option value="hot">{$lang.hot}</option>
- <option value="not_hot">{$lang.not_hot}</option>
- <option value="baoyou">{$lang.baoyou}</option>
- <option value="not_baoyou">{$lang.baoyou}</option>
6.languages\zh_cn\admin\goods.php
在
- $_LANG['batch_hot_confirm'] = '您确实要把选中的商品设为热销吗?';
- $_LANG['batch_not_hot_confirm'] = '您确实要把选中的商品取消热销吗?';
- $_LANG['batch_baoyou_confirm'] = '您确实要把选中的商品设为包邮吗?';
- $_LANG['batch_not_baoyou_confirm'] = '您确实要把选中的商品取消包邮吗?';
- $_LANG['is_hot'] = '热销';
- $_LANG['is_baoyou'] = '包邮';
- $_LANG['hot'] = '热销';
- $_LANG['not_hot'] = '取消热销';
- $_LANG['baoyou'] = '包邮';
- $_LANG['not_baoyou'] = '取消包邮';
效果如图所示: