ag九游客户端官网|(集团)点击登录

新闻中心

互联网+期间,说建站,谈运营与网络营销

以后地位:首页 > 新闻中心 > EC二次开辟 > ECSHOP限购_限时促销购置,限时日期购置插件

ECSHOP限购_限时促销购置,限时日期购置插件

###

ECSHOP限购_限时促销购置,限时日期购置,商品促销一人限购一件题目的办理教程

ecshop做促销,如每人只限购1件
控制ECSHOP的购置数目,在许多时分是必需的,并且当你有分外的需求的时分,控制数目显得分外紧张。必要在goods表中增长个字段"gc"控制购置数目
起首,你必要在购置的时分,提醒输出框,报告用户,你必需购置几多.其次,购物车中必要修正购置数目的时分,你也必要控制。
1:细致页面中控制.
在flow.php内里addto_cart中,参加以下代码,控制购置.
$gc = $db -> getOne("select gc from ".$ecs->table('goods')." where goods_id = ".$goods ->goods_id);
if ($goods->number%$gc) {
$result['error'] = 1;
$result['message'] = "购置数目必需输出{$gc}的倍数";
}
2:在common.js中增长函数
function addToCart1(goodsId, parentId)
{
var goods        = new Object();
var spec_arr     = new Array();
var fittings_arr = new Array();
var number    = 1;
var t = "number"+goodsId;
number = document.getElementById("number"+goodsId).value;
goods.spec     = spec_arr;
goods.goods_id = goodsId;
goods.number = number;
goods.parent = (typeof(parentId) == "undefined") ? 0 : parseInt(parentId);
Ajax.call('flow.php?step=add_to_cart', 'goods=' + goods.toJS**tring(), addToCartResp**e, 'POST', 'JSON');
}
2:控制列表页面的购置.
在列表页面中,增长一个框.
<form action="javascript:addToCart1({$goods.goods_id})" method="post" name="ECS_FORMBUY{$goods.goods_id}" id="ECS_FORMBUY{$goods.goods_id}" >

购置数目:<input name="number{$goods.goods_id}" type="text" id="number{$goods.goods_id}" value="1" size="4"   class="formBorder"/><br />


<a href="http://www.zhongyuancp.com"><img src="http://www.zhongyuancp.com/static/86945d803ddb6cfb500cf373c67f0ab2.jpg"></a>
<a href="http://www.zhongyuancp.com" id="compareLink"quotes"}','{$goods.type}')"><img src="http://www.zhongyuancp.com/static/86b13989e25b07cc4faaf1e9908fd7d7.jpg"></a></form>
挪用addToCart1函数.
3:保举页面
在common.js中增长函数addToCart2
function addToCart2(goodsId, parentId)
{
var goods        = new Object();
var spec_arr     = new Array();
var fittings_arr = new Array();
var number    = 1;
var t = "number"+goodsId;
number = document.getElementById("number_"+goodsId).value;
goods.spec     = spec_arr;
goods.goods_id = goodsId;
goods.number = number;
goods.parent = (typeof(parentId) == "undefined") ? 0 : parseInt(parentId);
Ajax.call('flow.php?step=add_to_cart', 'goods=' + goods.toJS**tring(), addToCartResp**e, 'POST', 'JSON');
}
在recommend_new.lbi,recommend_best.lbi等页面中,必要增长输出框.挪用次函数.
<form action="javascript:addToCart2({$goods.id})" method="post" name="ECS_FORMBUY_{$goods.id}" id="ECS_FORMBUY_{$goods.id}" >

购置数目:<input name="number_{$goods.id}" type="text" id="number_{$goods.id}" value="1" size="4"   class="formBorder"/><br /><a href="http://www.zhongyuancp.com"><img src="http://www.zhongyuancp.com/static/86945d803ddb6cfb500cf373c67f0ab2.jpg"></a></form>
最初完成了购置数目的控制。

首页
案例中心
关于ag九游
联系ag九游