在style.css里添加下面样式
.goods_cut {
background: url("../images/plus.gif") no-repeat scroll 0 0 transparent
border: 0 none
cursor: pointer
display: block
float: left
font-size: 0
height: 15px
line-height: 0margin: 8px 3px 0
width: 15px
}
input.goodsBuyBox, input.number {
border: 1px solid #DDDDDD
float: left
font-size: 10px
height: 18px
line-height: 18px
margin: 5px 6px 0
padding: 0
text-align: center
width: 32px
}
.goods_add {
background: url("../images/plus.gif") no-repeat scroll 0 -15px transparent
border: 0 none
cursor: pointer
display: block
float: left
font-size: 0
height: 15px
line-height: 0
margin: 8px 3px 0
width: 15px
}
在flow.dwt里,看各自的模板去修改,总之要找到这串代码:
<input type="text" name="goods_number[{$goods.rec_id}]" ……
下面是脚本,放进flow.dwt里
<script language="javascript" type="text/javascript">
function goods_cut($val){
var num_val=document.getElementById('number'+$val)
var new_num=num_val.value
if(isNaN(new_num)){alert('请输入数字')return false}
var Num = parseInt(new_num)
if(Num>1)Num=Num-1
num_val.value=Num
document.getElementById('updatecart').click()
}
function goods_add($val){
var num_val=document.getElementById('number'+$val)
var new_num=num_val.value
if(isNaN(new_num)){alert('请输入数字')return false}
var Num = parseInt(new_num)
Num=Num+1
num_val.value=Num
document.getElementById('updatecart').click()
}
</script>
找到
<input type="text" name="goods_number[{$goods.rec_id}]"
搜索不到你就搜goods_number就行了
替换为:
<span class="goods_cut" onclick="goods_cut('{$goods.rec_id}')"></span>
<input type="text" name="goods_number[{$goods.rec_id}]" id="number{$goods.rec_id}" value="{$goods.goods_number}" size="4" class="number" onblur="if(isNaN(this.value)){alert('请输入数字')return false}else{document.getElementById('updatecart').click()}" title="{$lang.goods_number_tip}"/>
<span class="goods_add" onclick="goods_add('{$goods.rec_id}')"></span>
找到
<input name="submit" type="submit" value="{$lang.update_cart}" class="btn_s3"/>
其实就是更新购物车的按钮
添加一个id=“updatecart”
<input name="submit" type="submit" id="updatecart" value="{$lang.update_cart}" class="btn_s3"/>
新建css文件夹如:<link href="css/style.css" rel="stylesheet" type="text/css" />
会自动解释为
<link href="themes/default/css/style.css" rel="stylesheet" type="text/css" />
假设你需要修改的模板文件为index.dwt,你想在这个文件中载入同目录下的CSS文件common.css,操作步骤:打开index.dwt这个模板文件,然后将下面代码加入到</head>前:<link href="common.css" rel="stylesheet" type="text/css" />
ecshop自带的样式代码为:<link href="{$ecs_css_path}" rel="stylesheet" type="text/css" />