ecshop2.7.2/2.7.3解决jquery的冲突,两个版本亲测,无误

1.复制一份 transport.js 改名为 transport.org.js 提供给后台使用

2.注释掉js/transport.js里的toJSON功能 行数为497-737行之间。其中将

 

legalParams = "JSON=" + params.toJSONString();

替换为

legalParams = $.evalJSON(params);

然后把

result = result.parseJSON();

修改为

result = $.evalJSON(result);

3.修改js/index.js里的第44行,将

var res = result.parseJSON();

改为:

var res = $.evalJSON(result);

 4.修改js/改common.js,

Ajax.call('flow.php?step=add_to_cart', 'goods=' + goods.toJSONString(), addToCartResponse, 'POST', 'JSON');

 修改为

Ajax.call('flow.php?step=add_to_cart', 'goods=' + $.toJSON(goods), addToCartResponse, 'POST', 'JSON');

然后把

Ajax.call('flow.php?step=add_package_to_cart', 'package_info=' + package_info.toJSONString(), addPackageToCartResponse, 'POST', 'JSON');

 修改为

 Ajax.call('flow.php?step=add_package_to_cart', 'package_info=' + $.toJSON(package_info), addPackageToCartResponse, 'POST', 'JSON');

最后把

Ajax.call('flow.php?step=add_to_cart', 'goods=' + goods.toJSONString(), addToCartResponse, 'POST', 'JSON');

 修改为

 Ajax.call('flow.php?step=add_to_cart', 'goods=' + $.toJSON(goods), addToCartResponse, 'POST', 'JSON');

 5.修改compare.js文件

this.data = cookieValue.parseJSON();

 修改为

this.data = $.evalJSON(cookieValue);

 然后把

var obj = cookieValue.parseJSON();

 修改为

var obj = $.evalJSON(cookieValue);

 最后把

document.setCookie("compareItems", this.data.toJSONString());

 修改为

document.setCookie("compareItems", $.toJSON(this.data));

 6.修改js/global.js文件

function $()

 修改为

function $e()

 然后把

var element = $(element);

 修改为

var element = $e(element);

7.修改后台头部引入transport.js路径 admin/templates/pageheader.htm 第9行改为:

{insert_scripts files="../js/transport.org.js,common.js"}

 8.修改themes/default/library/page_header.lbi文件在

{insert_scripts files='transport.js,utils.js'}

 上面加上如下代码

{insert_scripts files='jquery.js,jquery.json.js'}

 9.修改你的模板下的library/comment_list.lbi。

Ajax.call('comment.php', 'cmt=' + cmt.toJSONString(), commentResponse, 'POST', 'JSON');

 修改为

Ajax.call('comment.php', 'cmt=' + $.toJSON(cmt), commentResponse, 'POST', 'JSON');

10.修改模板compare.dwt。

var obj = document.getCookie("compareItems").parseJSON();

 修改为

var obj = $.evalJSON(document.getCookie("compareItems"));

然后把

document.setCookie("compareItems", obj.toJSONString());

 修改为

document.setCookie("compareItems", $.toJSON(obj));

 11.修改模板flow.dwt

Ajax.call('flow.php?step=add_to_cart', 'goods=' + goods.toJSONString(), collect_to_flow_response, 'POST', 'JSON');

 修改为

Ajax.call('flow.php?step=add_to_cart', 'goods=' + $.toJSON(goods), collect_to_flow_response, 'POST', 'JSON');

然后把

Ajax.call('flow.php?step=add_to_cart', 'goods=' + goods.toJSONString(), fittings_to_flow_response, 'POST', 'JSON');

 修改为

Ajax.call('flow.php?step=add_to_cart', 'goods=' + $.toJSON(goods), fittings_to_flow_response, 'POST', 'JSON');

12.这样就可以了,若果需要使用ajax那么请用修改后的json功能。

相关文件

http://files0.cnitblog.com/zhangbin1126/jquery.json-1.3.js

http://files0.cnitblog.com/zhangbin1126/jquery-1.6.2.min.js      

 



 

posted on 2013-02-07 10:44  E壶茶水  阅读(276)  评论(0)    收藏  举报

导航