������Դ��רע����ҵԴ�롢��ҵ�̡̳���ҵ�زġ���ҵģ�塢��Ʒ��������Ϊ���վ�������ṩ�����ʵķ���
�û���:
����:
ע��

��ҵԴ�����

VIP

CMS�̳�

վ��ѧԺ

��ο���ECSHOP�Ĺ�������,ecshopij���ض��ķ����

lucyptak.com / 2015-09-28
����ECSHOP�Ĺ����������ںܶ�ʱ���DZ���ģ����ҵ������ر�������ʱ�򣬿��������Եø�����Ҫ����Ҫ��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="javascript:addToCart1({$goods.goods_id})"><img src="images/but_buy.jpg"></a>
<a href="javascript:;" id="compareLink"quotes"}','{$goods.type}')"><img src="images/but_comp.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="javascript:addToCart2({$goods.id})"><img src="images/but_buy.jpg"></a></form>
�������˹��������Ŀ��ơ�
����