{"id":199173,"date":"2025-05-03T12:47:03","date_gmt":"2025-05-03T04:47:03","guid":{"rendered":"https:\/\/server.hk\/cnblog\/199173\/"},"modified":"2025-05-03T12:47:03","modified_gmt":"2025-05-03T04:47:03","slug":"ecshop%e8%af%a6%e7%bb%86%e9%a1%b5%e5%a2%9e%e5%8a%a0%e8%bf%90%e8%b4%b9%e6%9f%a5%e8%af%a2","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/199173\/","title":{"rendered":"ecshop\u8be6\u7ec6\u9875\u589e\u52a0\u8fd0\u8d39\u67e5\u8be2"},"content":{"rendered":"<p>&nbsp;\u5927\u5bb6\u5728\u6dd8\u5b9d\u4e0a\u770b\u5230\u4ea7\u54c1\u5230\u67d0\u67d0\u5730 \u4f1a\u51fa\u73b0\u76f8\u5e94\u7684\u8fd0\u8d39\uff0c\u82e5\u662fECSHOP\uff0c\u8be5\u5982\u4f55\u589e\u52a0\u8be5\u529f\u80fd\uff0c\u597d\u6a21\u677f\u4e3a\u5927\u5bb6\u5206\u89e3\uff01<\/p>\n<p>&nbsp;<\/p>\n<p>1:flow.php\u589e\u52a0\u4ee5\u4e0b\u4ee3\u7801<\/p>\n<p>elseif ($_REQUEST[&#8216;step&#8217;] == &#8216;show_shipping1&#8217;)<\/p>\n<p>{<span> <\/span><\/p>\n<p>&nbsp; &nbsp;<\/p>\n<p>&nbsp; &nbsp; include_once(&#8216;includes\/cls_json.php&#8217;);<\/p>\n<p>&nbsp; &nbsp; $json = new JSON;<\/p>\n<p>&nbsp; &nbsp; $result = array(&#8216;error&#8217; =&gt; &#8221;, &#8216;content&#8217; =&gt; &#8221;, &#8216;need_insure&#8217; =&gt; 0);<\/p>\n<p><span> <\/span>\/*\u8d2d\u4e70\u5c5e\u6027*\/<\/p>\n<p><span> <\/span>$attr_id &nbsp; &nbsp;= isset($_REQUEST[&#8216;attr&#8217;]) ? explode(&#8216;,&#8217;, $_REQUEST[&#8216;attr&#8217;]) : array();<\/p>\n<p>&nbsp; &nbsp; \/*\u8d2d\u4e70\u6570\u91cf*\/<\/p>\n<p><span> <\/span>$number &nbsp; &nbsp; = (isset($_REQUEST[&#8216;number&#8217;])) ? intval($_REQUEST[&#8216;number&#8217;]) : 1;<\/p>\n<p><span> <\/span>\/*\u5546\u54c1ID*\/<\/p>\n<p><span> <\/span>$goods_id &nbsp; &nbsp; = (isset($_REQUEST[&#8216;goods_id&#8217;])) ? intval($_REQUEST[&#8216;goods_id&#8217;]) : &#8216;0&#8217;;<\/p>\n<p><span> <\/span>\/*\u8ba1\u7b97\u5546\u54c1\u4ef7\u683c*\/<\/p>\n<p><span> <\/span>$shop_price &nbsp;= get_final_price($goods_id, $number, true, $attr_id);<\/p>\n<p>&nbsp; &nbsp; $r = $db -&gt; getRow(&#8220;select * from &#8220;.$ecs-&gt;table(&#8216;goods&#8217;).&#8221; where goods_id = &#8216;$goods_id'&#8221;);<\/p>\n<p>&nbsp; &nbsp; \/*\u53d6\u5f97\u5546\u54c1\u603b\u91cd\u91cf*\/<\/p>\n<p><span> <\/span>$row[&#8216;weight&#8217;] = floatval(($r[&#8216;goods_weight&#8217;]*$number));<\/p>\n<p>&nbsp; &nbsp; \/*\u53d6\u5f97\u5546\u54c1\u603b\u4ef7\u683c*\/<\/p>\n<p><span> <\/span>$row[&#8216;amount&#8217;] = floatval(($shop_price*$number));<\/p>\n<p>&nbsp; &nbsp; \/*\u8d2d\u4e70\u6570\u91cf*\/<\/p>\n<p><span> <\/span>$row[&#8216;number&#8217;] = intval($number);<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp; &nbsp; \/* \u683c\u5f0f\u5316\u91cd\u91cf *\/<\/p>\n<p>&nbsp; &nbsp; $row[&#8216;formated_weight&#8217;] = formated_weight($row[&#8216;weight&#8217;]);<\/p>\n<p>&nbsp; &nbsp;&nbsp;<\/p>\n<p><span> <\/span>\/*\u53d6\u5f97\u533a\u57df*\/<\/p>\n<p>&nbsp; &nbsp; $string = trim($_REQUEST[&#8216;string&#8217;]);<\/p>\n<p><span> <\/span>$ar = explode(&#8220;,&#8221;,$string);<\/p>\n<p>&nbsp; &nbsp; $region &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= array($ar[0], $ar[1], $ar[2], $ar[3]);<\/p>\n<p>&nbsp; &nbsp; \/*\u53d6\u5f97\u533a\u57df\u5bf9\u5e94\u7684\u914d\u9001\u65b9\u5f0f*\/<\/p>\n<p><span> <\/span>$shipping_list &nbsp; &nbsp; = available_shipping_list($region);<\/p>\n<p>&nbsp; &nbsp; $cart_weight_price =$row;<\/p>\n<p>&nbsp; &nbsp; $insure_disabled &nbsp; = true;<\/p>\n<p>&nbsp; &nbsp; $cod_disabled &nbsp; &nbsp; &nbsp;= true;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp; &nbsp; \/\/ \u67e5\u770b\u8d2d\u7269\u8f66\u4e2d\u662f\u5426\u5168\u4e3a\u514d\u8fd0\u8d39\u5546\u54c1\uff0c\u82e5\u662f\u5219\u628a\u8fd0\u8d39\u8d4b\u4e3a\u96f6<\/p>\n<p>&nbsp; &nbsp; $sql = &#8216;SELECT count(*) FROM &#8216; . $ecs-&gt;table(&#8216;cart&#8217;) . &#8221; WHERE `session_id` = &#8216;&#8221; . SESS_ID. &#8220;&#8216; AND `extension_code` != &#8216;package_buy&#8217; AND `is_shipping` = 0&#8221;;<\/p>\n<p>&nbsp; &nbsp; $shipping_count = $db-&gt;getOne($sql);<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp; &nbsp; foreach ($shipping_list AS $key =&gt; $val)<\/p>\n<p>&nbsp; &nbsp; {<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; $shipping_cfg = unserialize_config($val[&#8216;configure&#8217;]);<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; $shipping_fee = ($shipping_count == 0 AND $cart_weight_price[&#8216;free_shipping&#8217;] == 1) ? 0 : shipping_fee($val[&#8216;shipping_code&#8217;], unserialize($val[&#8216;configure&#8217;]),<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; $cart_weight_price[&#8216;weight&#8217;], $cart_weight_price[&#8216;amount&#8217;], $cart_weight_price[&#8216;number&#8217;]);<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; $shipping_list[$key][&#8216;format_shipping_fee&#8217;] = price_format($shipping_fee, false);<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; $shipping_list[$key][&#8216;shipping_fee&#8217;] &nbsp; &nbsp; &nbsp; &nbsp;= $shipping_fee;<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; $shipping_list[$key][&#8216;free_money&#8217;] &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= price_format($shipping_cfg[&#8216;free_money&#8217;], false);<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; $shipping_list[$key][&#8216;insure_formated&#8217;] &nbsp; &nbsp; = strpos($val[&#8216;insure&#8217;], &#8216;%&#8217;) === false ?<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; price_format($val[&#8216;insure&#8217;], false) : $val[&#8216;insure&#8217;];<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; \/* \u5f53\u524d\u7684\u914d\u9001\u65b9\u5f0f\u662f\u5426\u652f\u6301\u4fdd\u4ef7 *\/<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; if ($val[&#8216;shipping_id&#8217;] == $order[&#8216;shipping_id&#8217;])<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; {<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $insure_disabled = ($val[&#8216;insure&#8217;] == 0);<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $cod_disabled &nbsp; &nbsp;= ($val[&#8216;support_cod&#8217;] == 0);<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; }<\/p>\n<p>&nbsp; &nbsp; }<\/p>\n<p><span> <\/span>$smarty -&gt; assign(&#8216;list&#8217;,$shipping_list);<\/p>\n<p><span> <\/span>$result[content] = $smarty-&gt;fetch(&#8216;library\/goods_total.lbi&#8217;);<\/p>\n<p><span> <\/span>\/\/echo $json-&gt;encode($shipping_list);<\/p>\n<p><span> <\/span>echo $json-&gt;encode($result);<\/p>\n<p>&nbsp; &nbsp; exit;<\/p>\n<p>}<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;\u5927\u5bb6\u5728\u6dd8\u5b9d\u4e0a\u770b\u5230\u4ea7\u54c1&#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-199173","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199173","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=199173"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199173\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=199173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=199173"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=199173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}