http://www.ecshop520.com/ecshop-ercikaifa/396.html
ecshop商品页购买数量加减按钮ecshop购物车页加减按钮插件
默认模版为例详细教程:
ECSHOP教程http://www.ecshop520.com
找到flow.php里的如下代码
ECSHOP免费模板http://www.ecshop520.com
elseif ($_REQUEST['step'] == 'update_cart') { if (isset($_POST['goods_number']) && is_array($_POST['goods_number'])) { flow_update_cart($_POST['goods_number']); } show_message($_LANG['update_cart_notice'], $_LANG['back_to_cart'], 'flow.php'); exit; }修改成:
ECSHOP二次开发http://www.ecshop520.com
转载请注明:文章转载自ECSHOP教程网http://www.ecshop520.com
elseif ($_REQUEST['step'] == 'update_cart') { if (isset($_POST['goods_number']) && is_array($_POST['goods_number'])) { flow_update_cart($_POST['goods_number']); } show_message($_LANG['update_cart_notice'], $_LANG['back_to_cart'], 'flow.php'); exit; }打开:goods.dwt
{* 包含脚本文件 *}
{insert_scripts files='common.js'}下面这段:
本站文章除注明转载外,均为ECSHOP教程网http://www.ecshop520.com原创或编译。
<script type="text/javascript">
function $id(element) {
return document.getElementById(element);
}
//切屏--是按钮,_v是内容平台,_h是内容库
function reg(str){
var bt=$id(str+"_b").getElementsByTagName("h2");
for(var i=0;i<bt.length;i++){
bt[i].subj=str;
bt[i].pai=i;
bt[i].style.cursor="pointer";
bt[i].οnclick=function(){
$id(this.subj+"_v").innerHTML=$id(this.subj+"_h").getElementsByTagName("blockquote")[this.pai].innerHTML;
for(var j=0;j<$id(this.subj+"_b").getElementsByTagName("h2").length;j++){
var _bt=$id(this.subj+"_b").getElementsByTagName("h2")[j];
var ison=j==this.pai;
_bt.className=(ison?"":"h2bg");
}
}
}
$id(str+"_h").className="none";
$id(str+"_v").innerHTML=$id(str+"_h").getElementsByTagName("blockquote")[0].innerHTML;
}
</script> ECSHOP教程网http://www.ecshop520.com
修改成:
www.ecshop520.com
<script type="text/javascript">
function $id(element) {
return document.getElementById(element);
}
//切屏--是按钮,_v是内容平台,_h是内容库
function reg(str){
var bt=$id(str+"_b").getElementsByTagName("h2");
for(var i=0;i<bt.length;i++){
bt[i].subj=str;
bt[i].pai=i;
bt[i].style.cursor="pointer";
bt[i].οnclick=function(){
$id(this.subj+"_v").innerHTML=$id(this.subj+"_h").getElementsByTagName("blockquote")[this.pai].innerHTML;
for(var j=0;j<$id(this.subj+"_b").getElementsByTagName("h2").length;j++){
var _bt=$id(this.subj+"_b").getElementsByTagName("h2")[j];
var ison=j==this.pai;
_bt.className=(ison?"":"h2bg");
}
}
}
$id(str+"_h").className="none";
$id(str+"_v").innerHTML=$id(str+"_h").getElementsByTagName("blockquote")[0].innerHTML;
}
function del(){
var num = document.getElementById("number");
var n = parseInt(num.value);
if(n-1<=0){
alert("必须选择一个商品");
}else{
num.value = n-1;
}
}
function add(){
var num = document.getElementById("number");
var n = parseInt(num.value);
num.value = n+1;
}
</script> ECSHOP二次开发http://www.ecshop520.com
搜索:
ECSHOP插件http://www.ecshop520.com
<dd> <strong>{$lang.number}:</strong> <input name="number" type="text" id="number" value="1" size="4" οnblur="changePrice()" style="border:1px solid #ccc; "/> </dd>修改成:
ECSHOP模板制作教程http://www.ecshop520.com
<table>
<tr>
<td valign="middle" height="40" width="80" align="right"><font class="shop">{$lang.number}:</font> </td>
<td valign="middle"><img src="images/jian.gif" style="display:block;" οnclick="del()" /> </td>
<td><input name="number" type="text" id="number" value="1" size="4" οnblur="changePrice()" style="border:1px solid #ccc; height:25px; width:30px; text-align:center; "/></td>
<td><img src="images/jia.gif" style="display:block;" οnclick="add()" /> </td>
</tr>
</table> 转载请注明:文章转载自ECSHOP教程网http://www.ecshop520.com
打开:style.css文件,底部下面添加
.goods_cut { background: url("./images/yy.gif") no-repeat scroll 0 0 transparent; border: 0 none; cursor: pointer; display: block; float: left; font-size: 0; height: 15px; line-height: 0;margin: 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/yy.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; } .goods_number_tit{ display: block; background:none; width:60px; height:25px; line-height:22px; float: left; }图片放到模板目录:
新手如果没有修改过模板直接覆盖下面附件就可以:
ecshop商品页购买数量加减按钮ecshop购物车页加减按钮插件:
下载
http://www.ecshop520.com/ecshop-maifei/398.html ECSHOP二次开发http://www.ecshop520.com
二.购物车页面
打开:flow.dwt
1.
{* 包含脚本文件 *}
{insert_scripts files='common.js,shopping_flow.js'} 本站文章除注明转载外,均为ECSHOP教程网http://www.ecshop520.com原创或编译。
下面添加:
<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> 转载请注明:文章转载自ECSHOP教程网http://www.ecshop520.com
2.搜索:
ECSHOP模板制作教程http://www.ecshop520.com
<input type="text" name="goods_number[{$goods.rec_id}]" id="goods_number_{$goods.rec_id}" value="{$goods.goods_number}" size="4" class="inputBg" style="text-align:center " οnkeydοwn="showdiv(this)"/>修改成:
本站文章除注明转载外,均为ECSHOP教程网http://www.ecshop520.com原创或编译。
<span class="goods_cut" οnclick="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"
οnblur="if(isNaN(this.value)){alert('请输入数字');return
false}else{document.getElementById('updatecart').click();}"
title="{$lang.goods_number_tip}"/>
<span class="goods_add" οnclick="goods_add('{$goods.rec_id}');"></span> www.ecshop520.com
3.搜索:
$lang.update_cart也是就这段:
ECSHOP教程http://www.ecshop520.com
本站文章除注明转载外,均为ECSHOP教程网http://www.ecshop520.com原创或编译。
<input name="submit" type="submit" class="bnt_blue_1" value="{$lang.update_cart}" />修改成:
ECSHOP教程网http://www.ecshop520.com
<input name="submit" type="submit" id="updatecart" value="{$lang.update_cart}" class="btn_s3"/> www.ecshop520.com
4.打开:style.css文件,底部下面添加
.goods_cut { background: url("./images/yy.gif") no-repeat scroll 0 0 transparent; border: 0 none; cursor: pointer; display: block; float: left; font-size: 0; height: 15px; line-height: 0;margin: 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/yy.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; } .goods_number_tit{ display: block; background:none; width:60px; height:25px; line-height:22px; float: left; }5.图片放到模板目录:
新手使用的是默认模板可以直接覆盖下面附件:
ecshop购物车加减插件下载:
http://www.ecshop520.com/ecshop-maifei/397.html