{"id":199147,"date":"2025-05-03T10:30:00","date_gmt":"2025-05-03T02:30:00","guid":{"rendered":"https:\/\/server.hk\/cnblog\/199147\/"},"modified":"2025-05-03T10:30:00","modified_gmt":"2025-05-03T02:30:00","slug":"%e4%bf%ae%e6%94%b9ecshop%e5%90%8e%e5%8f%b0%e7%9a%84%e5%95%86%e5%93%81%e5%88%97%e8%a1%a8%e9%87%8c%e6%98%be%e7%a4%ba%e8%af%a5%e5%95%86%e5%93%81%e5%93%81%e7%89%8c","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/199147\/","title":{"rendered":"\u4fee\u6539ECSHOP\u540e\u53f0\u7684\u5546\u54c1\u5217\u8868\u91cc\u663e\u793a\u8be5\u5546\u54c1\u54c1\u724c"},"content":{"rendered":"<p>\u5982\u4f55\u5728<span style=\"font-family: \u5b8b\u4f53, Verdana, Arial;font-size: 12px;line-height: 18px\">\u5728ECSHOP\u540e\u53f0\u7684\u5546\u54c1\u5217\u8868\u4e2d\u4e5f\u663e\u793a\u5546\u54c1\u7684\u54c1\u724c\u201d\u3002<br \/> \u4e0b\u9762\u5c31\u6765\u597d\u6a21\u677f\u8bb2\u4e00\u4e0b\u5982\u4f55\u6765\u4fee\u6539\u3002\u6b64\u65b9\u6cd5\u53ea\u4fdd\u8bc1\u5728ECSHOP2.7.2\u7248\u672c\u4e0b\u6709\u6548\uff0c\u5176\u4ed6\u7248\u672c\u8bf7\u53c2\u7167\u4fee\u6539\u3002<\/span><\/p>\n<p><span style=\"font-family: \u5b8b\u4f53, Verdana, Arial;font-size: 12px;line-height: 18px\">\u7b2c\u4e00\u6b65\uff1a<br \/> \u9996\u5148\u6211\u4eec\u6765\u6253\u5f00\u7a0b\u5e8f\u6587\u4ef6\uff1a \/admin\/includes\/lib_goods.php<\/p>\n<p> \u5b9a\u4f4d\u5230&nbsp;goods_list &nbsp;\u51fd\u6570\u90e8\u5206<\/p>\n<p> \u627e\u5230\u4e0b\u9762\u4ee3\u7801\uff08\u5927\u6982\u5728911\u884c\u5de6\u53f3\uff09 <\/span><\/p>\n<table cellspacing=\"0\" cellpadding=\"5\" style=\"border-right-width: 1px;border-right-style: solid;border-top-width: 1px;border-top-style: solid;background-image: initial;background-attachment: initial;border-left-width: 1px;border-left-style: solid;width: 673px;border-bottom-width: 1px;border-bottom-style: solid;background-position: initial initial;background-repeat: initial initial\">\n<tbody>\n<tr>\n<td><font style=\"border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-width: initial;border-color: initial;list-style-type: none;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">$sql = &#8220;SELECT goods_id, goods_name, goods_type, goods_sn, shop_price, is_on_sale, is_best, is_new, is_hot, sort_order, goods_number, integral, &#8221; .<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8221; (promote_price &gt; 0 AND promote_start_date &lt;= &#8216;$today&#8217; AND promote_end_date &gt;= &#8216;$today&#8217;) AS is_promote &#8220;.<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8221; FROM &#8221; . $GLOBALS[&#8216;ecs&#8217;]-&gt;table(&#8216;goods&#8217;) . &#8221; AS g WHERE is_delete=&#8217;$is_delete&#8217; $where&#8221; .<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8221; ORDER BY $filter[sort_by] $filter[sort_order] &#8220;.<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8221; LIMIT &#8221; . $filter[&#8216;start&#8217;] . &#8220;,$filter[page_size]&#8221;;<\/font><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p> \u5c06\u5b83\u4fee\u6539\u4e3a<\/p>\n<p> <br \/>\n<span style=\"font-family: \u5b8b\u4f53, Verdana, Arial;font-size: 12px;line-height: 18px\"><br \/> <\/span><br \/>\n<span style=\"font-family: \u5b8b\u4f53, Verdana, Arial;font-size: 12px;line-height: 18px\"> <\/p>\n<table cellspacing=\"0\" cellpadding=\"5\" style=\"border-right-width: 1px;border-right-style: solid;border-top-width: 1px;border-top-style: solid;background-image: initial;background-attachment: initial;border-left-width: 1px;border-left-style: solid;width: 673px;border-bottom-width: 1px;border-bottom-style: solid\">\n<tbody>\n<tr>\n<td style=\"font-family: Arial, Verdana, sans-serif;line-height: 22px;font-size: 14px\">\n<p><font style=\"border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-width: initial;border-color: initial;list-style-type: none;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">$sql = &#8220;SELECT goods_id, goods_name, goods_type, goods_sn, shop_price, is_on_sale, is_best, is_new, is_hot, sort_order, goods_number, integral, &#8221; .<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8221; (promote_price &gt; 0 AND promote_start_date &lt;= &#8216;$today&#8217; AND promote_end_date &gt;= &#8216;$today&#8217;) &nbsp;&#8220;.<\/font><\/p>\n<p><font style=\"border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-width: initial;border-color: initial;list-style-type: none;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">\u201cAs is_promote,b.brand_name FROM\u201d.$GLOBAs[&#8216;ecs&#8217;]-&gt;table(&#8216;goods&#8217;).&#8221;AS g&#8221;.<\/font><\/p>\n<p><font style=\"border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-width: initial;border-color: initial;list-style-type: none;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">&#8220;left join&#8221;.$GLOBAs[&#8216;ecs&#8217;]-&gt;table(&#8216;goods&#8217;).&#8221;AS b on g.brand_id=b.brand_id&#8221;.<\/font><\/p>\n<p><font style=\"border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-width: initial;border-color: initial;list-style-type: none;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">&#8220;where is_delete=&#8217;$is_delete&#8217;$where&#8221;<\/font><font style=\"border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-width: initial;border-color: initial;list-style-type: none;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">.<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8221; ORDER BY $filter[sort_by] $filter[sort_order] &#8220;.<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8221; LIMIT &#8221; . $filter[&#8216;start&#8217;] . &#8220;,$filter[page_size]&#8221;;<\/p>\n<p> <\/font><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p> \u7b2c\u4e8c\u6b65\uff1a<\/p>\n<p> \u4fee\u6539 admin\/templates\/goods_list.htm \u6587\u4ef6<\/p>\n<p> \u627e\u5230<\/p>\n<p> <span style=\"border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-width: initial;border-color: initial;list-style-type: none;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">{$goods.goods_name|escape:html}<br \/> <\/span><br \/> \u5728\u5b83\u540e\u9762\u589e\u52a0\u4e00\u884c\u4ee3\u7801\uff1a<\/p>\n<p> <span style=\"border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-width: initial;border-color: initial;list-style-type: none;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">\uff08\u54c1\u724c\uff1a{$goods.brand_name}\uff09<br \/> <\/span><br \/> \u4fee\u6539\u5230\u8fd9\u91cc\uff0c\u4f60\u4f1a\u53d1\u73b0\u54c1\u724c\u662f\u80fd\u663e\u793a\u51fa\u6765\u4e86\uff0c\u4f46\u662f\u641c\u7d22\u529f\u80fd\u91cc\u7684\u6309\u54c1\u724c\u641c\u7d22\u5374\u5931\u6548\u4e86\u3002\u522b\u7740\u6025\uff0c\u7b2c\u4e09\u6b65\u5c31\u662f\u6765\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u7684\u3002<\/p>\n<p> \u7b2c\u4e09\u6b65\uff08\u5f88\u91cd\u8981\uff09\uff1a<\/p>\n<p> \u5411\u4e0a\uff0c\u627e\u5230\u4e0b\u9762\u4ee3\u7801\uff08\u5927\u6982\u5728865\u884c\u5de6\u53f3\uff09<\/p>\n<p> <span style=\"border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-width: initial;border-color: initial;list-style-type: none;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">$where .= &#8221; AND brand_id=&#8217;$filter[brand_id]'&#8221;;<\/p>\n<p> <\/span><span style=\"border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-width: initial;border-color: initial;list-style-type: none;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">\u5c06\u5b83\u4fee\u6539\u4e3a<br \/> <\/span><span style=\"border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-width: initial;border-color: initial;list-style-type: none;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\"><br \/> $where .= &#8221; AND g.brand_id=&#8217;$filter[brand_id]'&#8221;;<\/span><\/span><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u5728\u5728ECSHOP\u540e\u53f0\u7684\u5546\u54c1\u5217&#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-199147","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199147","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=199147"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199147\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=199147"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=199147"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=199147"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}