ecshop中can't jquery.parsejson to JSON这个错误怎么解决

ecshop更换百度ueditor插件,亲测无任何错误,解决了各种错误
ecshop更换百度ueditor插件已经修复了之前出现的各种错误,百度ueditor的确非常好用但是和ecshop的兼容性总是不那么友好,更换会出现比如添加商品时关联相关文章、关联商品、配件及添加文章资讯时出现关联商品提示Can't
JSON!错误,这个问题也TMD让我搞了很久才解决,之前我使用的是kindeditor,kindeditor虽然也很好用,但是没有远程图片自动保存到本地服务器的功能,为了用这个功能,我tm有换回了默认的fckeditor,添加了一个远程图片本地化插件,结果fckeditor功能还是tmd太烂了,很多图片没有办法保存决定放弃。又回来研究百度ueditor,ueditor到是既可以将远程图片自动保存到本地服务器,又可以多张图片上传,功能很齐全了,想要的都有了,但问题一大堆,网上看了很多教程,没有一个可以完美使用,而且都是一篇文章被传了又传,没有根本的解决问题,草啊~!今天终于全部解决了各种js、jQuery兼容性及后台的各种问题,分享出来,希望能给需要的朋友帮助。某网站卖250块大洋,本网站免费分享,大家多多支持。
插件使用说明:首先下载完整的插件程序,下载地址:
/thread-381-1-1.html
ecshop更换百度ueditor插件相关信息如下:
ecshop版本:ecshop2.7.3
编码格式:UTF-8
ueditor版本:1.4.3
1、打开admin/includes/lib_main.php文件
(1)找到:(大约在306-323行左右)
function create_html_editor($input_name, $input_value =
& & global
& & $editor = new
FCKeditor($input_name);
$editor-&BasePath& &=
'../includes/fckeditor/';
& & $editor-&ToolbarSet =
$editor-&Width&
$editor-&Height&
$editor-&Value&
& & $FCKeditor =
$editor-&CreateHtml();
$smarty-&assign('FCKeditor', $FCKeditor);
将这段代码修改为:
function create_html_editor($input_name, $input_value =
& & global
& & $editor = new
FCKeditor($input_name);
$editor-&BasePath& &=
'../includes/fckeditor/';
& & $editor-&ToolbarSet =
$editor-&Width&
$editor-&Height&
$editor-&Value&
& & $FCKeditor =
$editor-&CreateHtml();
$smarty-&assign('FCKeditor', $FCKeditor);
将这段代码修改为:
function create_html_editor($input_name, $input_value =
& & global
$kindeditor="&
$smarty-&assign('FCKeditor', $kindeditor);
(2)继续打开admin/templates/pageheader.htm,找到以下代码:
{insert_scripts
files="../js/transport.js,common.js"}
{insert_scripts
files="../js/utils.js"}&
(3)把整个ueditor文件夹复制到您网站根目录下includes文件夹里面.
到此,百度ueditor已经可以使用了,可以添加商品,但是还有一些比如关联商品、关联文章时会报错,下面解决ajax和jQuery相关的兼容性问题。
备注:如需修改上传图片、视频、文件等保存路径,请打开includes/ueditor/php/config.json修改即可,默认保存路径是/images/upload/,可以修改为你想要的路径,的人也可以不用改。
2、把admin/js/jquery.js,admin/js/jquery.json.js,admin/js/selectzone_bd.js,admin/js/transport_bd.js复制到你网站的admin/js/目录下
3、复制一份admin/templates/pageheader.htm,将他命名为pageheader_bd.htm文件,然后打开这个文件
{insert_scripts
files="../js/utils.js"}&
将这段代码修改为:
{insert_scripts
files="jquery.js,jquery.json.js,transport_bd.js,common.js"}
4、打开admin/templates/article_info.htm文件
{include file="pageheader.htm"}
{insert_scripts
files="../js/utils.js,selectzone.js,validator.js"}
将这段代码修改为:
{include file="pageheader_bd.htm"}
{insert_scripts
files="../js/utils.js,selectzone_bd.js,validator.js"}
5、打开admin/templates/goods_info.htm文件
{include file="pageheader.htm"}
{insert_scripts
files="../js/utils.js,selectzone.js,colorselector.js"}
将这段代码修改为:
{include file="pageheader_bd.htm"}
{insert_scripts
files="../js/utils.js,selectzone_bd.js,colorselector.js"}
6、打开admin/templates/topic_edit.htm文件
{include file="pageheader.htm"}
{insert_scripts
files="../js/utils.js,selectzone.js,colorselector_topic.js"}
将这段代码修改为:
{include file="pageheader_bd.htm"}
{insert_scripts
files="../js/utils.js,selectzone_bd.js,colorselector_topic.js"}
7、打开admin/article.php文件
找到:(大约在20行左右)
require_once(ROOT_PATH .
"includes/fckeditor/fckeditor.php");
将这段代码修改为:
//require_once(ROOT_PATH .
"includes/fckeditor/fckeditor.php");
8、打开admin/goods.php文件
找到:(大约在107行左右)
& & include_once(ROOT_PATH .
'includes/fckeditor/fckeditor.php'); // 包含 html editor
将这段代码修改为:
& & //include_once(ROOT_PATH .
'includes/fckeditor/fckeditor.php'); // 包含 html editor
9、打开admin/magazine_list.php文件
(1)找到:(大约在61行左右,第一次出现的地方)
&&&include_once(ROOT_PATH.'includes/fckeditor/fckeditor.php');
// 包含 html editor 类文件
将这段代码修改为:
&&&//include_once(ROOT_PATH.'includes/fckeditor/fckeditor.php');
// 包含 html editor 类文件
(2)找到:(大约在83行左右,第二次出现的地方)
include_once(ROOT_PATH.'includes/fckeditor/fckeditor.php'); // 包含
html editor 类文件
将这段代码修改为:
//include_once(ROOT_PATH.'includes/fckeditor/fckeditor.php'); // 包含
html editor 类文件
10、打开admin/topic.php文件
找到:(大约在75行左右)
include_once(ROOT_PATH.'includes/fckeditor/fckeditor.php'); // 包含
html editor 类文件
将这段代码修改为:
//include_once(ROOT_PATH.'includes/fckeditor/fckeditor.php'); // 包含
html editor 类文件
我的更多文章:
( 10:13:41)( 09:31:06)( 15:14:35)( 21:06:18)( 12:11:23)
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。ecshop加入购物车js报错分析解决
所属栏目: 时间: 来源: 作者: 点击:
问题分析:点击加入购物车没反应,用浏览器调试一看,点一下报一个错误,错误代码如下:Uncaught transport.js/parseResult() error: can't parse to JSON.& 相信很多跟我一样的菜鸟都碰到这个问题了,而且官网的模板同样有这个错误,各种百度、google你懂的,都是相互转载的东西,问题也没得到解决。后来终于找到一个大神的帖子,问题解决了。& & 方法如下:按照错误提示打开“\includes\lib_common.php”文件,对应的959行,将代码:$price&=&number_format($price,&2,&'.',&'');修改为:$price&=&number_format((double)$price,&2,&'.',&'');OK问题解决!
请站长喝杯咖啡?
站长一直坚持白天工作、晚上熬夜更新素材,付出了巨大的精力和时间,其中的辛酸难以言述。坚持免积分、免登录、无任何限制下载!如果本站素材对你有用,不妨考虑请站长喝杯咖啡鼓励一下!
你应该也喜欢这些吧
给个评价吧
学习最多的
最近更新的
2014全新改版上线
2013全新改版上线Ecshop与Jquery冲突的完美解决方案
ECShop把AJAX事件和JSON解析的模块放在common/transport.js之中,可以说它也有自己封装的一套工具,这其实是很正常的。
但恰恰的,在封装JSON各种方法的同时对object的模型进行了重写,这个就跟jQuery冲突了。因为众所周知的,jQuery对各种JavaScript对象进行了扩展。
这一切其实都很容易理解,各有各的理由十分自然,但头痛和无奈的就变得在我们这些使用者身上了。在ECShop论坛上原来也有很多朋友提出了这个问题,也提出了各种各样的方法,我尝试了一些,不好或者甚至无用,所以只好自己动手了。
解决思路大概就是屏蔽ECshop扩展的toJSONString方法,用别的函数代替。
为了照顾下小菜们,就写详细点吧。
1、首先复制一份 transport.js 改名为 transport.org.js 提供给后台使用
2、屏蔽掉transport.js里的toJSON功能,
注释掉行数大概在497-737行之间的内容
由if ( ! Object.prototype.toJSONString) { 开头的代码。
修改352行为:
&legalParams = "JSON=" + $.toJSON(params);
修改408行为:
result = $.evalJSON(result);
屏蔽掉global.js里的如下代码(第10-13行):
Object.prototype.extend = function(object)
& return Object.extend.apply(this, [this,
3、修改index.js文件44行改为:
var res = $.evalJSON(result);
4、修改common.js文件
第34行改为:
Ajax.call('flow.php?step=add_to_cart', 'goods=' + $.toJSON(goods),
addToCartResponse, 'POST', 'JSON');
第850行改为:
Ajax.call('flow.php?step=add_package_to_cart', 'package_info=' +
$.toJSON(package_info), addPackageToCartResponse, 'POST',
第1056行改为:
Ajax.call('flow.php?step=add_to_cart', 'goods=' + $.toJSON(goods),
addToCartResponse, 'POST', 'JSON');
5、修改compare.js文件
第49行改为:
&this.data = $.evalJSON(cookieValue);
第67行改为:
&var obj = $.evalJSON(cookieValue);
第133行改为:
&document.setCookie("compareItems",
$.toJSON(this.data));
6、修改global.js文件
第16行改函数名 :function $e()
第114和126行都改为:&&&
var element = $e(element);
7、&!———&路径修改———&&
修改后台头部引入transport.js路径 admin/templates/pageheader.htm 第9行改为:
{insert_scripts files="../js/transport.org.js,common.js"}
admin/templates/menu.htm
151行改成 {insert_scripts
files="../js/global.js,../js/utils.js,../js/transport.org.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=' + $.toJSON(cmt),
commentResponse, 'POST', 'JSON');
10、compare.dwt
var obj = $.evalJSON(document.getCookie("compareItems"));
document.setCookie("compareItems", $.toJSON(obj));
11、flow.dwt
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=' +
$.toJSON(goods), fittings_to_flow_response, 'POST', 'JSON');
12、&!—&jquery文件需置顶的dwt文件—-jquery.js文件需要在compare.js文件加载前加载,否则会报错—&&
brand_list.dwt
category.dwt
exchange_list.dwt
search.dwt
{* 包含脚本文件 *}
{insert_scripts files='jquery.js,jquery.json.js'}
{insert_scripts files='common.js,global.js,compare.js'}
transport.js 文件中
$.evalJSON(result);要用到jquery.json.js,有用到parseResult()方法的地方需要载入jquery.js
和jquery.json.js。解决transport.js/parseResult() error:
can't parse to JSON. when calling method:
[nsIDOMEventListener::handleEvent]问题。
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。5647人阅读
1、IE下run()没有权限;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ecshop提示 &transport.js& /run() error:没有权限
transport.js下的run方法
xhr.open(transferMode, url, asyn); 发送请求时提示没权限,解决方法跟下面一样。
2、调试得到ajax请求返回的数据为&&字符串;ecshop提示&&transport.js& /parseResult() error: can't parse to JSON.
现在我遇到这种情况,是因为url路径问题引起的。
common.js 下面的addToCart 方法
Ajax.call('flow.php?step=add_to_cart', 'goods=' + goods.toJSONString(), addToCartResponse, 'POST', 'JSON');
这样写就是OK的。
addToCartResponse()这个方法
var cart_url = 'flow.php?step=cart';
暂时IE、Firefox,Chrome下面没有问题。
好像跟一级域名和二级域名还有关系,一级域名下面没有问题,www二级域名下面有问题。关系太深了,不想继续研究了,把一级域名转到二级域名下,解决了就行了。
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:659482次
积分:7266
积分:7266
排名:第2163名
原创:118篇
转载:173篇
评论:48条
(1)(1)(8)(1)(7)(6)(4)(11)(11)(12)(8)(12)(5)(7)(10)(4)(11)(7)(8)(30)(11)(7)(25)(75)(9)

我要回帖

更多关于 .parsejson用法 的文章

 

随机推荐