官方提供的会员等级可以实现商品折扣,但它是针对所有的商品,而我需要的是可以针对某一个商品修改折扣,修改方法如下:
1、修改字段类型
user_price本意是某个商品在某个会员级别修改后的价格,这里把它修改为商品在不同会员级别下的折扣
alter table lab_member_price modify user_price tinyint(3) not null default 0;2、后台修改
languages/zh_cn/admin/goods.php,149行左右,把$_LANG['notice_user_price']修改为:会员价格和折扣,括号内是折扣后的价格,折扣数值范围是1-100
admin/templates/goods_info.htm,570行左右,把set_price_note函数修改为:
function set_price_note(rank_id)
{
var shop_price = parseFloat(document.forms['theForm'].elements['shop_price'].value);
var rank = new Array();
rank[rank_id] = parseInt(document.getElementById('rank_' + rank_id).value);
if (shop_price > 0 && rank[rank_id] && document.getElementById('rank_' + rank_id))
{
var price = parseInt(shop_price * rank[rank_id] + 0.5) / 100;
if (document.getElementById('nrank_' + rank_id))
{
document.getElementById('nrank_' + rank_id).innerHTML = '(' + price + ')';
}
}
else
{
if (document.getElementById('nrank_' + rank_id))
{
document.getElementById('nrank_' + rank_id).innerHTML = '';
}
}
}3、前台修改
goods.php,377行左右,把
$sql = "SELECT rank_id, IFNULL(mp.user_price, r.discount * $shop_price / 100) AS price, r.rank_name, r.discount " .修改为
$sql = "SELECT rank_id, IF(mp.user_price, mp.user_price * $shop_price / 100, $shop_price) AS price, r.rank_name, r.discount " .对整个网站进行搜索,搜索所有的sql语句,搜索条件为:IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]')
把所有的IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]')修改为:IF(mp.user_price, mp.user_price * g.shop_price / 100, g.shop_price)
include/lib_common.php,2344行左右,在"return $final_price"前面添加"$final_price = round($final_price)",意思是四舍五入取整
4、删除一个注册页面
如果没有登陆就进入结算中心,会连接到一个页面,左侧是登陆,右侧是注册,这个注册里的条件不全,将其删除
themes/joyo25/flow.dwt,803行左右,把
全部删除
5.设置购物时发票抬头为必选项,用积分换礼品时不用输入发票
languages/zh_cn/shopping_flow.php,44行左右,添加:$_LANG['no_input_invoice'] = '请输入发票抬头!';
languages/en_us/shopping_flow.php,46行左右,添加:$_LANG['no_input_invoice'] = 'Please enter the invoice title!';
flow.php,1588行左右,在
if ($order['extension_code'] == 'exchange_goods')
{
$order['integral_money'] = 0;
$order['integral'] = $total['exchange_integral'];
}下面添加:
else (empty($_POST['inv_payee']))
{
show_message($_LANG['no_input_invoice'], '', '', 'warning');
}6.批量上传文件csv添加会员折扣字段
languages/zh_cn/admin/goods_batch.php,80行左右,添加:
$_LANG['upload_goods']['registered_member'] = '注册会员折扣';
$_LANG['upload_goods']['bronze_member'] = '铜牌会员折扣';
$_LANG['upload_goods']['silver_member'] = '银牌会员折扣';
$_LANG['upload_goods']['gold_member'] = '金牌会员折扣';
languages/en_us/admin/goods_batch.php,82行左右,添加:
$_LANG['upload_goods']['registered_member'] = 'Registered member discount';
$_LANG['upload_goods']['bronze_member'] = 'bronze member discount';
$_LANG['upload_goods']['silver_member'] = 'silver member discount';
$_LANG['upload_goods']['gold_member'] = 'gold member discount';admin/goods_batch.php,429行左右,把
elseif (in_array($field, array('market_price', 'shop_price')))修改为
elseif (in_array($field, array('market_price', 'shop_price', 'registered_member', 'bronze_member', 'silver_member', 'gold_member')))admin/includes/lib_main.php,256行左右,添加一个函数:
/**
* 取得会员等级id号数组,按用户级别排序
*/
function get_rank_id_list()
{
$rank_id_list = array();
$sql = 'SELECT rank_id, rank_name, min_points FROM ' . $GLOBALS['ecs']->table('user_rank');
$sql .= ' ORDER BY min_points';
$res = $GLOBALS['db']->query($sql);
while ($row = $GLOBALS['db']->fetchRow($res))
{
$rank_id_list[] = $row['rank_id'];
}
return $rank_id_list;
}
admin/goods_batch.php,463行左右,在"$max_id = $db->insert_id() + 1;"之后添加:
$rank_list_in = get_rank_id_list();
$price_list_in = array();
$price_list_in[0] = $field_arr['registered_member'];
$price_list_in[1] = $field_arr['bronze_member'];
$price_list_in[2] = $field_arr['silver_member'];
$price_list_in[3] = $field_arr['gold_member'];
handle_member_price($max_id - 1, $rank_list_in, $price_list_in);
阅读(916) | 评论(0) | 转发(0) |