{"id":60186,"date":"2025-04-24T08:48:22","date_gmt":"2025-04-24T00:48:22","guid":{"rendered":"https:\/\/fwq.ai\/blog\/60186\/"},"modified":"2025-04-24T08:48:22","modified_gmt":"2025-04-24T00:48:22","slug":"%e4%bf%ae%e6%94%b9ecshop%e8%ae%a9%e5%bc%b9%e5%87%ba%e8%bf%b7%e4%bd%a0%e8%b4%ad%e7%89%a9%e8%bd%a6-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/60186\/","title":{"rendered":"\u4fee\u6539ecshop\u8ba9\u5f39\u51fa\u8ff7\u4f60\u8d2d\u7269\u8f66"},"content":{"rendered":"<p>&nbsp; <span style=\"line-height: 25px\">1. \u66f4\u6539D:\\AppServ\\www\\js\u7684common.js<\/span><br \/> <span style=\"line-height: 25px\">1)\u589e\u52a0\u4e24\u4e2a\u51fd\u6570cancel_gwc\u548c open_gwc\uff0c<\/span><\/p>\n<p> <span style=\"line-height: 25px\">function cancel_gwc()&nbsp;<\/span><br \/> <span style=\"line-height: 25px\">{<\/span><br \/> <span style=\"line-height: 25px\">&nbsp;&nbsp;document.body.removeChild(docEle(&#8216;speDiv&#8217;));<\/span><\/p>\n<p> <span style=\"line-height: 25px\">&nbsp;&nbsp;var i = 0;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp;&nbsp;var sel_obj = document.getElementsByTagName(&#8216;select&#8217;);<\/span><br \/> <span style=\"line-height: 25px\">&nbsp;&nbsp;while (sel_obj[i])<\/span><br \/> <span style=\"line-height: 25px\">&nbsp;&nbsp;{<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp; sel_obj[i].style.visibility = &#8220;&#8221;;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp; i++;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp;&nbsp;}<\/span><br \/> <span style=\"line-height: 25px\">}<\/span><\/p>\n<p> <span style=\"line-height: 25px\">function open_gwc(cartinfo)&nbsp;<\/span><br \/> <span style=\"line-height: 25px\">{<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;var _id = &#8220;speDiv&#8221;;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;var m = &#8220;mask&#8221;;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;if (docEle(_id)) document.removeChild(docEle(_id));<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;if (docEle(m)) document.removeChild(docEle(m));<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;\/\/\u8ba1\u7b97\u4e0a\u5377\u5143\u7d20\u503c<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;var scrollPos;&nbsp;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;if (typeof window.pageYOffset != &#8216;undefined&#8217;)&nbsp;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;{&nbsp;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; scrollPos = window.pageYOffset;&nbsp;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;}&nbsp;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;else if (typeof document.compatMode != &#8216;undefined&#8217; &amp;&amp; document.compatMode != &#8216;BackCompat&#8217;)&nbsp;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;{&nbsp;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; scrollPos = document.documentElement.scrollTop;&nbsp;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;}&nbsp;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;else if (typeof document.body != &#8216;undefined&#8217;)&nbsp;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;{&nbsp;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; scrollPos = document.body.scrollTop;&nbsp;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;}<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;var i = 0;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;var sel_obj = document.getElementsByTagName(&#8216;select&#8217;);<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;while (sel_obj[i])<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;{<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sel_obj[i].style.visibility = &#8220;hidden&#8221;;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i++;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;}<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;<\/span><\/p>\n<p> <span style=\"line-height: 25px\">&nbsp;&nbsp;var newDiv = document.createElement(&#8220;div&#8221;);<\/span><br \/> <span style=\"line-height: 25px\">&nbsp;&nbsp;newDiv.id = _id;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp;&nbsp;newDiv.style.position = &#8220;absolute&#8221;;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp;&nbsp;newDiv.style.zIndex = &#8220;10000&#8221;;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp;&nbsp;newDiv.style.width = &#8220;289px&#8221;;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp;&nbsp;newDiv.style.height = &#8220;120px&#8221;;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp;&nbsp;newDiv.style.top = (parseInt(scrollPos + 400)) + &#8220;px&#8221;;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp;&nbsp;newDiv.style.left = (parseInt(document.body.offsetWidth) &#8211; 200) \/ 2 + &#8220;px&#8221;;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp;&nbsp;newDiv.style.overflow = &#8220;hidden&#8221;;&nbsp;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp;&nbsp;newDiv.style.background = &#8220;#FFF&#8221;;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp;&nbsp;newDiv.style.border = &#8220;0px solid #59B0FF&#8221;;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp;&nbsp;newDiv.style.padding = &#8220;0px&#8221;;<\/span><\/p>\n<p> <span style=\"line-height: 25px\">&nbsp;&nbsp;newDiv.innerHTML = &#8216;&lt;div style=&#8221;text-align:center;height:120px;line-height:25px;width:289px;background:url(\/data\/images\/div_bg.gif) no-repeat 0 0;overflow:hidden;&#8221;&gt;&lt;table width=&#8221;280px&#8221; cellpading=0 cellspacing=0 align=center &gt;&lt;th style=&#8221;height:30px;line-height:30px;text-align:right;&#8221;&gt;&lt;a href=&#8221;javascript:cancel_gwc()&#8221; &gt;&lt;img src=&#8221;\/data\/images\/div_close.gif&#8221; style=&#8221;margin:5px 10px;&#8221;&gt;&lt;\/a&gt;&lt;\/th&gt;&lt;tr&gt;&lt;td align=center &gt;&lt;img src=&#8221;\/data\/images\/div_hs.gif&#8221; align=absmiddle&gt; &lt;font style=&#8221;font-size:15px;font-weight:bold;&#8221;&gt;\u8be5<\/span><span style=\"line-height: 25px\">\u5546\u54c1<\/span><span style=\"line-height: 25px\">\u5df2\u6210\u529f\u653e\u5165<\/span><span style=\"line-height: 25px\">\u8d2d\u7269\u8f66<\/span><span style=\"line-height: 25px\">&lt;\/font&gt;&lt;br&gt;&#8217;+cartinfo +'&lt;br&gt;&lt;a href=&#8221;javascript:cancel_gwc()&#8221;&gt;&lt;&lt;\u7ee7\u7eed<\/span><span style=\"line-height: 25px\">\u8d2d\u7269<\/span><span style=\"line-height: 25px\">&lt;\/a&gt; &lt;a&nbsp;&nbsp;href=&#8221;flow.php&#8221;&gt; &lt;img src=&#8221;\/data\/images\/div_gwc.gif&#8221; align=absmiddle&gt;&lt;\/a&gt;&lt;\/td&gt;&lt;\/tr&gt;&#8217;;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp;&nbsp;newDiv.innerHTML += &#8216;&lt;tr&gt;&lt;td align=center&gt;&lt;\/td&gt;&lt;\/tr&gt;&lt;\/table&gt;&lt;\/div&gt;&#8217;;&nbsp;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp;&nbsp;document.body.appendChild(newDiv);<\/span><\/p>\n<p> <span style=\"line-height: 25px\">2)\u66f4\u6539addToCartResp**e\u672b\u5c3e\u7684switch\uff0c<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp;&nbsp; &nbsp;switch(result.confirm_type)<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp;&nbsp; &nbsp;{<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;case &#8216;1&#8217; :<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; \/*if (confirm(result.message)) location.href = cart_url;*\/<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;open_gwc(result.content)<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; break;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;case &#8216;2&#8217; :<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; \/*if (!confirm(result.message)) location.href = cart_url;*\/<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;open_gwc(result.content)<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; break;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;case &#8216;3&#8217; :<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; \/*location.href = cart_url;*\/<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;open_gwc(result.content)<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; break;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;default :<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; break;<\/span><br \/> <span style=\"line-height: 25px\">&nbsp; &nbsp;&nbsp; &nbsp;}<\/span><\/p>\n<p> <span style=\"line-height: 25px\">}&nbsp;<\/span><\/p>\n<p> <span style=\"line-height: 25px\">2.\u7136\u540e\u6539\u4e00\u4e0bD:\\AppServ\\www\\languages\\zh_cn\u7684common.php<\/span><br \/> <span style=\"line-height: 25px\">\u5c06$_LANG[&#8216;cart_info&#8217;] = &#8216;xxxxxxxx %d \u4ef6\u5546\u54c1\uff0cxxxx %s&#8217;;\u4e2d\u5f15\u53f7\u5185\u7684\u5b57\u6570\u51cf\u5c11<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; 1. \u66f4\u6539D:\\AppServ\\www\\js\u7684common.js 1)\u589e\u52a0\u4e24\u4e2a\u51fd\u6570cancel_gwc\u548c open_gwc\uff0c function cancel_gwc()&nbsp; { &nbsp;&nbsp;document.body.removeChild(docEle(&#8216;speDiv&#8217;)); &nbsp;&nbsp;var i = 0; &nbsp;&nbsp;var sel_obj = document.getElementsByTagName(&#8216;select&#8217;); &nbsp;&nbsp;while (sel_obj[i]) &nbsp;&nbsp;{ &nbsp; &nbsp; sel_obj[i].style.visibility = &#8220;&#8221;; &nbsp; &nbsp; i++; &nbsp;&nbsp;} } function open_gwc(cartinfo)&nbsp; { &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;var _id = &#8220;speDiv&#8221;; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;var m = &#8220;mask&#8221;; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;if (docEle(_id)) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-60186","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/60186","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=60186"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/60186\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=60186"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=60186"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=60186"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}