{"id":199168,"date":"2025-05-03T12:49:07","date_gmt":"2025-05-03T04:49:07","guid":{"rendered":"https:\/\/server.hk\/cnblog\/199168\/"},"modified":"2025-05-03T12:49:07","modified_gmt":"2025-05-03T04:49:07","slug":"ecshop%e5%95%86%e5%93%81%e5%88%97%e8%a1%a8%e9%a1%b5%e9%9d%a2%e5%a2%9e%e5%8a%a0%e6%8c%89%e9%94%80%e9%87%8f%e6%8e%92%e5%ba%8f%ef%bc%81","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/199168\/","title":{"rendered":"ecshop\u5546\u54c1\u5217\u8868\u9875\u9762\u589e\u52a0\u6309\u9500\u91cf\u6392\u5e8f\uff01"},"content":{"rendered":"<p>ecshop<span style=\"line-height: 20px\">\u5546\u54c1\u5217\u8868\u9875\u9762\u7684\u6309\u4e0a\u67b6\u65f6\u95f4\u3001\u4ef7\u683c\u3001\u66f4\u65b0\u65f6\u95f4\u662f\u9ed8\u8ba4\u7684\uff0c\u73b0\u5728\u9700\u8981\u6dfb\u52a0\u7684\u662f\u6309\u9500\u91cf\u6392\u884c\uff0c\u4f46\u662f\u5728\u5546\u54c1\u8868\u91cc\u9762\u6ca1\u6709\u9500\u91cf\u7684\u5b57\u6bb5,\u597d\u6a21\u677f\u641c\u96c6\u6574\u7406\u63d0\u4f9b\u5982\u4e0b\u529e\u6cd5\uff1a<\/span><\/p>\n<p><span style=\"line-height: 20px\"> <\/span><\/p>\n<p style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 10px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\"><strong>STEP1\uff1a\u5728\u8868\u201c<span style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">ecs_goods<\/span>\u201d\u6dfb\u52a0\u5b57\u6bb5\uff1asalesnum\uff08\u6ce8\uff1a\u81ea\u5b9a\u4e49\u5b57\u6bb5\u540d\uff09<\/strong><\/p>\n<p style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 10px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\"><strong>STEP2\uff1a\u6253\u5f00\u6839\u76ee\u5f55\u4e0b\u6587\u4ef6\uff1a<span style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">flow.php<\/span><\/strong><\/p>\n<p style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 10px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">\u627e\u5230\u4e0b\u9762\u7684\u4ee3\u7801\uff1a<\/p>\n<blockquote style=\"margin-top: 5px;margin-right: 0px;margin-bottom: 5px;margin-left: 0px;padding-top: 8px;padding-right: 12px;padding-bottom: 8px;padding-left: 36px;background-image: url(http:\/\/www.pksafe.cn\/wp-content\/themes\/poetry\/img\/blockquote.gif);background-attachment: initial;border-top-width: 1px;border-right-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-top-style: dashed;border-right-style: dashed;border-bottom-style: dashed;border-left-style: dashed;background-position: 3px 3px;background-repeat: no-repeat no-repeat\">\n<p style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 10px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">\/* \u63d2\u5165\u8ba2\u5355\u5546\u54c1 *\/<br \/> &nbsp;&nbsp;&nbsp; $sql = \u201cINSERT INTO \u201d . $ecs-&gt;table(\u2019order_goods\u2019) . \u201c( \u201d .<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u201corder_id, goods_id, goods_name, goods_sn, product_id, goods_number, market_price, \u201c.<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u201cgoods_price, goods_attr, is_real, extension_code, parent_id, is_gift, goods_attr_id) \u201c.<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u201d SELECT \u2018$new_order_id\u2019, goods_id, goods_name, goods_sn, product_id, goods_number, market_price, \u201c.<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u201cgoods_price, goods_attr, is_real, extension_code, parent_id, is_gift, goods_attr_id\u201d.<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u201d FROM \u201d .$ecs-&gt;table(\u2019cart\u2019) .<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u201d WHERE session_id = \u2018\u201d.SESS_ID.\u201d\u2018 AND rec_type = \u2018$flow_type\u2019\u201d;<br \/> &nbsp;&nbsp;&nbsp; $db-&gt;query($sql);<\/p>\n<\/blockquote>\n<p style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 10px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">\u5728\u8fd9\u6bb5\u4ee3\u7801\u7684\u4e0b\u9762\uff0c\u6dfb\u52a0\u5982\u4e0b\u4ee3\u7801\uff1a<\/p>\n<blockquote style=\"margin-top: 5px;margin-right: 0px;margin-bottom: 5px;margin-left: 0px;padding-top: 8px;padding-right: 12px;padding-bottom: 8px;padding-left: 36px;background-image: url(http:\/\/www.pksafe.cn\/wp-content\/themes\/poetry\/img\/blockquote.gif);background-attachment: initial;border-top-width: 1px;border-right-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-top-style: dashed;border-right-style: dashed;border-bottom-style: dashed;border-left-style: dashed;background-position: 3px 3px;background-repeat: no-repeat no-repeat\">\n<p style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 10px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">\/* \u63d2\u5165\u5546\u54c1\u8868\u7684salesnum \u5b57\u6bb5\uff0c\u7edf\u8ba1\u9500\u91cf\u6392\u884c *\/ <\/p>\n<p style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 10px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">$sql = &#8220;update &#8221; .$GLOBALS[&#8216;ecs&#8217;]-&gt;table(&#8216;goods&#8217;) . &#8221; AS a, &#8220;.$GLOBALS[&#8216;ecs&#8217;]-&gt;table(&#8216;cart&#8217;) . &#8221; AS b &#8220;.<\/p>\n<p style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 10px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">&nbsp; &nbsp; &nbsp; &nbsp; &#8221; set a.salesnum= a.salesnum + b.goods_number&#8221;.<\/p>\n<p style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 10px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#8221; WHERE a.goods_id=b.goods_id AND b.session_id = &#8216;&#8221;.SESS_ID.&#8221;&#8216; AND b.rec_type = &#8216;$flow_type'&#8221;;<\/p>\n<p style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 10px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">&nbsp;<\/p>\n<p style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 10px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">$db-&gt;query($sql);<\/p>\n<\/p>\n<\/blockquote>\n<p style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 10px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\"><strong>STEP3\uff1a\u6253\u5f00\u6587\u4ef6\uff1a<span style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">default\\library\\goods_list.lbi<\/span>\uff0c\u627e\u5230\u4e0b\u9762\u7684\u4ee3\u7801\uff1a<\/strong><\/p>\n<blockquote style=\"margin-top: 5px;margin-right: 0px;margin-bottom: 5px;margin-left: 0px;padding-top: 8px;padding-right: 12px;padding-bottom: 8px;padding-left: 36px;background-image: url(http:\/\/www.pksafe.cn\/wp-content\/themes\/poetry\/img\/blockquote.gif);background-attachment: initial;border-top-width: 1px;border-right-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-top-style: dashed;border-right-style: dashed;border-bottom-style: dashed;border-left-style: dashed;background-position: 3px 3px;background-repeat: no-repeat no-repeat\">\n<p style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 10px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">&lt;a href=\u201dcategory.php?category={$category}&amp;display={$pager.display}&amp;brand={$brand_id}&amp;price_min={$price_min}&amp;price_max={$price_max}&amp;filter_attr={$filter_attr}&amp;page={$pager.page}&amp;sort=last_update&amp;order=&lt;!\u2013 {if $pager.sort == \u2018last_update\u2019 &amp;&amp; $pager.order == \u2018DESC\u2019} \u2013&gt;ASC&lt;!\u2013 {else} \u2013&gt;DESC&lt;!\u2013 {\/if} \u2013&gt;#goods_list\u201d&gt;&lt;img src=\u201dimages\/last_update_&lt;!\u2013 {if $pager.sort == \u2018last_update\u2019} \u2013&gt;{$pager.order}&lt;!\u2013 {else} \u2013&gt;default&lt;!\u2013 {\/if} \u2013&gt;.gif\u201d alt=\u201d{$lang.sort.last_update}\u201d&gt;&lt;\/a&gt;<\/p>\n<\/blockquote>\n<p style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 10px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">\u5728\u4e0a\u9762\u90a3\u6bb5\u4ee3\u7801\u7684\u4e0b\u9762\u6dfb\u52a0\uff1a<\/p>\n<blockquote style=\"margin-top: 5px;margin-right: 0px;margin-bottom: 5px;margin-left: 0px;padding-top: 8px;padding-right: 12px;padding-bottom: 8px;padding-left: 36px;background-image: url(http:\/\/www.pksafe.cn\/wp-content\/themes\/poetry\/img\/blockquote.gif);background-attachment: initial;border-top-width: 1px;border-right-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-top-style: dashed;border-right-style: dashed;border-bottom-style: dashed;border-left-style: dashed;background-position: 3px 3px;background-repeat: no-repeat no-repeat\">\n<p style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 10px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">&lt;a href=\u201dcategory.php?category={$category}&amp;display={$pager.display}&amp;brand={$brand_id}&amp;price_min={$price_min}&amp;price_max={$price_max}&amp;filter_attr={$filter_attr}&amp;page={$pager.page}&amp;sort=salesnum&amp;order=&lt;!\u2013 {if $pager.sort == \u2019salesnum\u2019 &amp;&amp; $pager.order == \u2018DESC\u2019} \u2013&gt;ASC&lt;!\u2013 {else} \u2013&gt;DESC&lt;!\u2013 {\/if} \u2013&gt;#goods_list\u201d&gt;&lt;img src=\u201dimages\/sales_&lt;!\u2013 {if $pager.sort == \u2019salesnum\u2019} \u2013&gt;{$pager.order}&lt;!\u2013 {else} \u2013&gt;default&lt;!\u2013 {\/if} \u2013&gt;.gif\u201d alt=\u201d\u6309\u9500\u91cf\u6392\u884c\u201d&gt;&lt;\/a&gt;<\/p>\n<\/blockquote>\n<p style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 10px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">\u4e24\u6bb5\u4ee3\u7801\u7684\u533a\u522b\uff0c\u81ea\u5df1\u53bb\u5206\u6790\u770b\u770b\u5427\u3002<\/p>\n<p style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 10px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\"><strong>STEP4\uff1a\u6253\u5f00\u6587\u4ef6\uff1a<span style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">category.php<\/span>\uff0c\u627e\u5230\u5982\u4e0b\u4ee3\u7801\uff1a<\/strong><\/p>\n<blockquote style=\"margin-top: 5px;margin-right: 0px;margin-bottom: 5px;margin-left: 0px;padding-top: 8px;padding-right: 12px;padding-bottom: 8px;padding-left: 36px;background-image: url(http:\/\/www.pksafe.cn\/wp-content\/themes\/poetry\/img\/blockquote.gif);background-attachment: initial;border-top-width: 1px;border-right-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-top-style: dashed;border-right-style: dashed;border-bottom-style: dashed;border-left-style: dashed;background-position: 3px 3px;background-repeat: no-repeat no-repeat\">\n<p style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 10px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">$sort&nbsp; = (isset($_REQUEST[&#8216;sort&#8217;])&nbsp; &amp;&amp; in_array(trim(strtolower($_REQUEST[&#8216;sort&#8217;])), array(\u2019goods_id\u2019, \u2019shop_price\u2019, \u2018last_update\u2019)))<\/p>\n<p style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 10px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">\u4fee\u6539\u4e3a\uff1a<\/p>\n<p style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 10px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">$sort&nbsp; = (isset($_REQUEST[&#8216;sort&#8217;])&nbsp; &amp;&amp; in_array(trim(strtolower($_REQUEST[&#8216;sort&#8217;])), array(\u2019goods_id\u2019, \u2019shop_price\u2019, \u2018last_update\u2019,\u2019salesnum\u2019)))<\/p>\n<\/blockquote>\n<p style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 10px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">&nbsp;<\/p>\n<p style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 10px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>ecshop\u5546\u54c1\u5217\u8868\u9875\u9762\u7684\u6309\u4e0a\u67b6&#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-199168","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199168","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=199168"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199168\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=199168"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=199168"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=199168"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}