{"id":199208,"date":"2025-05-03T12:41:56","date_gmt":"2025-05-03T04:41:56","guid":{"rendered":"https:\/\/server.hk\/cnblog\/199208\/"},"modified":"2025-05-03T12:41:56","modified_gmt":"2025-05-03T04:41:56","slug":"ecshop%e5%95%86%e5%93%81%e8%af%a6%e6%83%85%e9%a1%b5%e5%8a%a8%e6%80%81%e5%ba%93%e5%ad%98%e8%b0%83%e7%94%a8","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/199208\/","title":{"rendered":"ecshop\u5546\u54c1\u8be6\u60c5\u9875\u52a8\u6001\u5e93\u5b58\u8c03\u7528"},"content":{"rendered":"<p>ECShop 2.7.2\u7248\u672c\u63d0\u4f9b\u4e86\u4e00\u4e2a\u65b0\u7684\u7279\u6027\uff1a\u8d27\u54c1\u3002   \u5177\u6709\u4e0d\u540c\u5c5e\u6027\u7684\u5546\u54c1\u7c7b\u578b\u53ef\u4ee5\u6839\u636e\u4e0d\u540c\u5c5e\u6027\u5f55\u5165\u76f8\u5e94\u7684\u8d27\u53f7\u4ee5\u53ca\u5e93\u5b58\u6570\u91cf\uff0c\u8fd9\u5bf9\u4e8e\u4e00\u4e9b\u5546\u5bb6\u662f\u5f88\u6709\u7528\u5904\u4e86\uff0c\u7279\u522b\u662f\u5728ERP\u4e2d\uff0c\u6709\u7740\u4e25\u683c\u5e93\u5b58\u63a7\u5236\u9700\u6c42\u7684\u73af\u5883\u4e0b\u3002   \u4f46\u662f\u524d\u53f0\u90e8\u5206\u5374\u8fd8\u6ca1\u6709\u8ddf\u4e0a\u8fd9\u4e00\u65b0\u7279\u6027\u7684\u6b65\u4f10\uff0c\u9009\u62e9\u4e86\u4e0d\u540c\u5c5e\u6027\u7684\u65f6\u5019\u5e93\u5b58\u4f9d\u7136\u662f\u5546\u54c1\u7684\u603b\u5e93\u5b58\uff0c\u867d\u7136\u70b9\u51fb\u8d2d\u4e70\u7684\u65f6\u5019\u662f\u6839\u636e\u8d27\u54c1\u7684\u5e93\u5b58\u6765\u5224\u65ad\u7684\u3002   \u6240\u4ee5\u8fd9\u4e00\u70b9\u4e0a\u662f\u6ca1\u6709\u8db3\u591f\u597d\u7684\u7528\u6237\u4f53\u9a8c\uff0c\u6211\u4eec\u6709\u5fc5\u8981\u6539\u5584\uff0c\u4e3aECShop\u5546\u54c1\u8be6\u60c5\u9875\u6dfb\u52a0\u52a8\u6001\u5e93\u5b58\u52a8\u6001\u8d27\u53f7\u7684\u529f\u80fd\u3002   &nbsp;   \u4e3b\u8981\u662f\u901a\u8fc7\u539f\u6709\u7684json\u6765\u5b9e\u73b0   \u5728goods.php\u7684   if (!empty($_REQUEST[&#8216;act&#8217;]) &amp;&amp; $_REQUEST[&#8216;act&#8217;] == \u2018price\u2019)   \u8fd9\u4e00\u5904\u7406\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u8c03\u7528\u8d27\u54c1\u5e93\u5b58\/\u8d27\u53f7\u7684\u8bed\u53e5   \u901a\u8fc7js\u52a8\u6001\u66f4\u65b0\u5230ecshop\u5546\u54c1\u8be6\u60c5\u9875\u9762\u4e0a\u53bb\u3002   \u5177\u4f53\u8bed\u53e5\uff1a<br \/>\n<span> <\/span>\/\/$goods_tinfo = $GLOBALS[&#8216;db&#8217;]-&gt;getRow($sql);<br \/>\n<span> <\/span>$goods_tinfo = get_goods_info($goods_id);   &nbsp;<br \/>\n<span> <\/span>$goods_sn = $goods_tinfo[&#8216;goods_sn&#8217;];<br \/>\n<span> <\/span>$sql = &#8220;SELECT * FROM &#8221; .$GLOBALS[&#8216;ecs&#8217;]-&gt;table(&#8216;products&#8217;). &#8221; WHERE goods_id = &#8216;$goods_id&#8217; LIMIT 0, 1&#8243;;   &nbsp; &nbsp; $prod = $GLOBALS[&#8216;db&#8217;]-&gt;getRow($sql);   &nbsp; &nbsp; if (is_spec($attr_id) &amp;&amp; !empty($prod))   &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; $product_info = get_products_info($goods_id, $attr_id);   &nbsp; &nbsp; }<br \/>\n<span> <\/span>   &nbsp; &nbsp; if ($product_info[&#8216;product_number&#8217;])   &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; $res[&#8216;stock&#8217;] = $product_info[&#8216;product_number&#8217;];   &nbsp; &nbsp; }else{<br \/>\n<span> <\/span>$res[&#8216;stock&#8217;] = $goods_tinfo[&#8216;goods_number&#8217;];<br \/>\n<span> <\/span>}<br \/>\n<span> <\/span><br \/>\n<span> <\/span>if ($product_info[&#8216;product_sn&#8217;])<br \/>\n<span> <\/span>{   &nbsp; &nbsp; &nbsp; &nbsp; $res[&#8216;goods_sn&#8217;] = $product_info[&#8216;product_sn&#8217;];   &nbsp; &nbsp; }else{<br \/>\n<span> <\/span>$res[&#8216;goods_sn&#8217;] = $goods_tinfo[&#8216;goods_sn&#8217;];<br \/>\n<span> <\/span>}<br \/>\n<span> <\/span><br \/>\n<span> <\/span>if ($product_info[&#8216;product_weight&#8217;])<br \/>\n<span> <\/span>{   &nbsp; &nbsp; &nbsp; &nbsp; $res[&#8216;goods_pweight&#8217;] = $product_info[&#8216;product_weight&#8217;].&#8217; \u5343\u514b(kg)&#8217;;   &nbsp; &nbsp; }else{<br \/>\n<span> <\/span>$res[&#8216;goods_pweight&#8217;] = $goods_tinfo[&#8216;goods_weight&#8217;];<br \/>\n<span> <\/span>}<br \/>\n<span> <\/span>\/\/$res[&#8216;goods_pweight&#8217;] = $product_info[&#8216;product_weight&#8217;];<br \/>\n<span> <\/span>$res[&#8216;ecs_shopprice&#8217;] = price_format($shop_price);   \u63d2\u5165\u5728die($json-&gt;encode($res)); \u524d <\/p>\n","protected":false},"excerpt":{"rendered":"<p>ECShop 2.7.2\u7248\u672c\u63d0\u4f9b&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-199208","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199208","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=199208"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199208\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=199208"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=199208"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=199208"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}