Ecshop The Ajax event and JSON parsing module in the common/transport.js, it can be said that it also has its own package of tools, which is actually very normal.
But precisely, in encapsulating the JSON various methods while the model of the object is rewritten, this is in conflict with jquery. Because it is well known, jquery expands on a variety of JavaScript objects.
All this is easy to understand, each has its own reason is very natural, but the headache and frustration becomes in our users. In the ecshop forum originally also had a lot of friends raised this question, also proposed a variety of methods, I tried some, bad or even useless, so I had to do it myself.
The idea of a solution is probably shielding Ecshop the extended toJSONString method is replaced with another function.
To take care of the side dishes, write down the details.
One, modify the default JS file
1, first copy of the transport.js renamed to Transport.org.js to provide background use
2, shielding out transport.js Tojson function line number of about 497-737 lines between
by if (! Object.prototype.toJSONString) {begins with code.
Modify the 352 behavior:
Legalparams = “ json=” + $.tojson (params);
Modify the 408 behavior:
result = $.evaljson (result);
Block out the following code (第10-13 line) in Global.js:
Object.prototype.extend = function (object)
{
Return Object.extend.apply (this, [this, Object]);
}
3. Modify the Index.js file 44 to read:
var res = $.evaljson (result);
4. Modify the Common.js file
The 34th line should read:
Ajax.call (‘flow.php?step=add_to_cart’, ‘goods=’ + $.tojson (goods), Addtocartresponse, ‘ post’, ‘ json’);
The No. 850 line should read:
Ajax.call (‘flow.php?step=add_package_to_cart’, ‘package_info=’ + $.tojson (Package_info), Addpackagetocartresponse, ‘ post’, ‘ json’);
The 1056th line should read:
Ajax.call (‘flow.php?step=add_to_cart’, ‘goods=’ + $.tojson (goods), Addtocartresponse, ‘ post’, ‘ json’);
5. Modify the Compare.js file
The 49th line should read:
This.data = $.evaljson (Cookievalue);
The 67th line should read:
var obj = $.evaljson (cookievalue);
The 133th line should read:
Document.setcookie (“compareitems”, $.tojson (This.data));
6. Modify the Global.js file
16th Line Change function name: Functions $e ()
Lines 114th and 126 should read: var element = $e (element);
Second, modify the background call section
7, <!———– Path modification ———–>
Modify background header introduce Transport.js path admin/templates/pageheader.htm 9th line to: {insert_scripts files=”.. /js/transport.org.js,common.js”}
Admin/templates/menu.htm
151 line changed to {insert_scripts files= ":/js/global.js,../js/utils.js,../js/transport.org.js"}
third, modify the foreground template section
8, modify the Themes/default/library/page_header.lbi file in {insert_scripts files=’transport.js,utils.js’} Add the following code above
{insert_scripts files=’jquery.js,jquery.json.js’}
9. <!—– Modify Files —–>
Library/comment_list.lbi
Line 188th:
Ajax.call (‘comment.php’, ‘cmt=’ + $.tojson (CMT), Commentresponse, & lsquo; post’, ‘ json’);
10, COMPARE.DWT
Line 20th:
var obj = $.evaljson (Document.getcookie (“compareItems”));
Line 24th:
Document.setcookie (“compareitems”, $.tojson (obj));
11, FLOW.DWT
Line 138th:
Ajax.call (‘flow.php?step=add_to_cart’, ‘goods=’ + $.tojson (goods), collect _to_flow_response, ‘ post’, ‘ json’);
Line 199th:
Ajax.call (‘flow.php?step=add_to_cart’, ‘goods=’ + $.tojson (goods), Fittings_to_flow_response, ‘ post’, ‘ json’);
12, <!—–jquery files need to be pinned DWT file —-jquery.js file needs to be loaded before Compare.js file loading, otherwise it will error — –>
Brand.dwt
Brand_list.dwt
Category.dwt
Exchange_list.dwt
Search.dwt
Such as:
{* Contains script file *}
{insert_scripts files=’jquery.js,jquery.json.js’}
{insert_scripts files=’common.js,global.js,compare.js’}