{"id":59106,"date":"2025-04-23T11:14:20","date_gmt":"2025-04-23T03:14:20","guid":{"rendered":"https:\/\/fwq.ai\/blog\/59106\/"},"modified":"2025-04-23T11:14:20","modified_gmt":"2025-04-23T03:14:20","slug":"%e5%9c%a8ecshop%e5%95%86%e5%93%81%e5%88%97%e8%a1%a8%e9%a1%b5%e6%98%be%e7%a4%ba%e6%af%8f%e4%b8%aa%e5%95%86%e5%93%81%e7%9a%84%e8%af%84%e8%ae%ba%e7%ad%89%e7%ba%a7%e5%92%8c%e8%af%84","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/59106\/","title":{"rendered":"\u5728ECSHOP\u5546\u54c1\u5217\u8868\u9875\u663e\u793a\u6bcf\u4e2a\u5546\u54c1\u7684\u8bc4\u8bba\u7b49\u7ea7\u548c\u8bc4"},"content":{"rendered":"<p><strong>\u95ee\u9898\u63cf\u8ff0\uff1a<br \/> <\/strong>\u6211\u60f3\u8ba9\u5546\u54c1\u5217\u8868\u9875\uff08category.php\uff09\u7684\u6bcf\u4e2a\u5546\u54c1\u7684\u4e0b\u9762\u663e\u793a\u8be5\u5546\u54c1\u7684\u8bc4\u8bba\u6570\u91cf\u4ee5\u53ca\u8bc4\u8bba\u7b49\u7ea7\uff0c\u8be5\u5982\u4f55\u64cd\u4f5c\u5462\uff1f\uff1f<\/p>\n<p> <strong>\u6548\u679c\u56fe\u793a\uff1a<br \/> <\/strong><img decoding=\"async\" src=\"https:\/\/www.ldhost.cn\/helphmb\/uploads\/allimg\/c101102\/12XFT4643K0-242U.jpg\" class=\"aligncenter\" title=\"\u5728ECSHOP\u5546\u54c1\u5217\u8868\u9875\u663e\u793a\u6bcf\u4e2a\u5546\u54c1\u7684\u8bc4\u8bba\u7b49\u7ea7\u548c\u8bc4\u63d2\u56fe\" alt=\"\u5728ECSHOP\u5546\u54c1\u5217\u8868\u9875\u663e\u793a\u6bcf\u4e2a\u5546\u54c1\u7684\u8bc4\u8bba\u7b49\u7ea7\u548c\u8bc4\u63d2\u56fe\" \/><\/p>\n<p> <strong>\u89e3\u51b3\u65b9\u6cd5\uff1a<br \/> \u7b2c\u4e00\u6b65\uff1a<br \/> <\/strong>\u9996\u5148\u4fee\u6539category.php <span>\u6587\u4ef6<\/span>\uff0c\u5b9a\u4f4d\u5230 category_get_goods() \u51fd\u6570\u90e8\u5206<br \/> \u627e\u5230 <\/p>\n<table cellspacing=\"0\" cellpadding=\"5\" style=\"border-right: #cccccc 1px solid;border-top: #cccccc 1px solid;background: #f7f7f7;border-left: #cccccc 1px solid;width: 90%;border-bottom: #cccccc 1px solid\">\n<tbody>\n<tr>\n<td>$sql = &#8216;SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, &#8216; .<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8220;IFNULL(mp.user_price, g.shop_price * &#8216;$_SESSION[discount]&#8217;) AS shop_price, g.promote_price, g.goods_type, &#8221; .<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8216;g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb , g.goods_img &#8216; .<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8216;FROM &#8216; . $GLOBALS[&#8216;ecs&#8217;]-&gt;table(&#8216;goods&#8217;) . &#8216; AS g &#8216; .<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8216;LEFT JOIN &#8216; . $GLOBALS[&#8216;ecs&#8217;]-&gt;table(&#8216;member_price&#8217;) . &#8216; AS mp &#8216; .<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8220;ON mp.goods_id = g.goods_id AND mp.user_rank = &#8216;$_SESSION[user_rank]&#8217; &#8221; .<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8220;WHERE $where $ext ORDER BY $sort $order&#8221;;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p> \u5c06\u4e4b\u4fee\u6539\u4e3a <\/p>\n<table cellspacing=\"0\" cellpadding=\"5\" style=\"border-right: #cccccc 1px solid;border-top: #cccccc 1px solid;background: #f7f7f7;border-left: #cccccc 1px solid;width: 90%;border-bottom: #cccccc 1px solid\">\n<tbody>\n<tr>\n<td><font><font>$sql = &#8216;SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, &#8216; .<br \/> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &#8220;IFNULL(mp.user_price, g.shop_price * &#8216;$_SESSION[discount]&#8217;) AS shop_price, g.promote_price, g.goods_type, &#8221; .<br \/> &nbsp;&nbsp;<\/font><font>&#8221; IFNULL(AVG(r.comment_rank),0) AS comment_rank,IF(r.comment_rank,count(*),0) AS&nbsp;&nbsp;comment_count, &#8220;.<\/font><br \/> <font>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &#8216;g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb , g.goods_img &#8216; .<br \/> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&#8216;FROM &#8216; . $GLOBALS[&#8216;ecs&#8217;]-&gt;table(&#8216;goods&#8217;) . &#8216; AS g &#8216; .<br \/> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&#8216;LEFT JOIN &#8216; . $GLOBALS[&#8216;ecs&#8217;]-&gt;table(&#8216;member_price&#8217;) . &#8216; AS mp &#8216; .<br \/> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &#8220;ON mp.goods_id = g.goods_id AND mp.user_rank = &#8216;$_SESSION[user_rank]&#8217; &#8221; .<br \/> &nbsp; &nbsp;&nbsp;&nbsp;<\/font><font>&#8216; LEFT JOIN&nbsp;&nbsp;&#8216;. $GLOBALS[&#8216;ecs&#8217;]-&gt;table(&#8216;comment&#8217;) .&#8217; AS r &#8216;.<br \/> &nbsp; &nbsp;&#8216;ON r.id_value = g.goods_id AND comment_type = 0 AND r.parent_id = 0 AND r.status = 1 &#8216; .<br \/> <\/font><font>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&#8220;WHERE $where $ext <\/font><font>group by g.goods_id<\/font><\/font><font> ORDER BY $sort $order&#8221;;<\/font><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p> \u7136\u540e\u7ee7\u7eed\u627e\u5230 <\/p>\n<table cellspacing=\"0\" cellpadding=\"5\" style=\"border-right: #cccccc 1px solid;border-top: #cccccc 1px solid;background: #f7f7f7;border-left: #cccccc 1px solid;width: 90%;border-bottom: #cccccc 1px solid\">\n<tbody>\n<tr>\n<td>$arr[$row[&#8216;goods_id&#8217;]][&#8216;url&#8217;]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = build_uri(&#8216;goods&#8217;, array(&#8216;gid&#8217;=&gt;$row[&#8216;goods_id&#8217;]), $row[&#8216;goods_name&#8217;]);<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p> \u5728\u5b83\u4e0b\u9762\u589e\u52a0\u51e0\u884c\u4ee3\u7801 <\/p>\n<table cellspacing=\"0\" cellpadding=\"5\" style=\"border-right: #cccccc 1px solid;border-top: #cccccc 1px solid;background: #f7f7f7;border-left: #cccccc 1px solid;width: 90%;border-bottom: #cccccc 1px solid\">\n<tbody>\n<tr>\n<td><font>$row[&#8216;comment_rank&#8217;]&nbsp; = ceil($row[&#8216;comment_rank&#8217;]) == 0 ? 5 : ceil($row[&#8216;comment_rank&#8217;]);<br \/> $arr[$row[&#8216;goods_id&#8217;]][&#8216;comment_rank&#8217;]=$row[&#8216;comment_rank&#8217;];<br \/> $arr[$row[&#8216;goods_id&#8217;]][&#8216;comment_count&#8217;]=$row[&#8216;comment_count&#8217;];<\/font><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p> <br \/>\n<strong>\u7b2c\u4e8c\u6b65(\u4ee5\u5b98\u65b9\u9ed8\u8ba4\u6a21\u677f\u4e3a\u4f8b)\uff1a<\/strong><br \/>\n<br \/> \u4fee\u6539 htemes\/default\/library\/goods_list.lbi \u6587\u4ef6<br \/>\n<br \/> \u627e\u5230<br \/>\n <\/p>\n<table cellspacing=\"0\" cellpadding=\"5\" style=\"border-right: #cccccc 1px solid;border-top: #cccccc 1px solid;background: #f7f7f7;border-left: #cccccc 1px solid;width: 90%;border-bottom: #cccccc 1px solid\">\n<tbody>\n<tr>\n<td>&lt;a href=&#8221;javascript:collect({$goods.goods_id});&#8221; class=&#8221;f6&#8243;&gt;{$lang.btn_collect}&lt;\/a&gt;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p> \u5728\u5b83\u4e0a\u9762\u589e\u52a0<br \/>\n <\/p>\n<table cellspacing=\"0\" cellpadding=\"5\" style=\"border-right: #cccccc 1px solid;border-top: #cccccc 1px solid;background: #f7f7f7;border-left: #cccccc 1px solid;width: 90%;border-bottom: #cccccc 1px solid\">\n<tbody>\n<tr>\n<td><span style=\"color: #ff0000\">&lt;img src=&#8221;images\/stars{$goods.comment_rank}.gif&#8221;&nbsp;&nbsp;style=&#8221;width:78px;height:15px;&#8221; \/&gt;&lt;br&gt;&nbsp;&nbsp;<br \/> \u8bc4\u8bba\u6570\uff1a{$goods.comment_count}&lt;br&gt;<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p> <br \/>\n<strong>\u7ed3\u675f\u8bed\uff1a<br \/> <\/strong>\u5927\u5bb6\u90fd\u77e5\u9053ECSHOP\u7cfb\u7edf\u6709\u7f13\u5b58\u673a\u5236\uff0c\u5982\u679c\u67d0\u4e2a\u5546\u54c1\u6709\u4e86\u65b0\u7684\u8bc4\u8bba\uff0c\u5217\u8868\u9875\u7684\u8bc4\u8bba\u6570\u91cf\u4e0d\u4f1a\u7acb\u9a6c\u968f\u7740\u66f4\u65b0\u3002\u5f97\u7b49\u5230\u4e0b\u6b21\u66f4\u65b0\u7f13\u5b58\u7684\u65f6\u5019\u624d\u4f1a\u66f4\u65b0\u3002<\/p>\n<p> \u5982\u679c\u60a8\u60f3\u5217\u8868\u9875\u80fd\u5373\u65f6\u4f53\u73b0\u8bc4\u8bba\u6570\u91cf\u7684\u53d8\u5316\u3002\u53ea\u9700\u7ee7\u7eed\u8fdb\u884c\u4e0b\u9762\u4fee\u6539\u5373\u53ef<br \/>\n<br \/> &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/>\n<br \/> \u628a category.php \u6587\u4ef6\u7684<br \/>\n<br \/> $smarty-&gt;caching = true;<br \/>\n<br \/> \u4fee\u6539\u4e3a<br \/>\n<br \/> $smarty-&gt;caching = false;&nbsp;<br \/>\n<br \/> &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p> &nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u95ee\u9898\u63cf\u8ff0\uff1a \u6211\u60f3\u8ba9\u5546\u54c1\u5217\u8868\u9875\uff08category.php\uff09\u7684\u6bcf\u4e2a\u5546\u54c1\u7684\u4e0b\u9762\u663e\u793a\u8be5\u5546\u54c1\u7684\u8bc4\u8bba\u6570\u91cf\u4ee5\u53ca\u8bc4\u8bba\u7b49\u7ea7\uff0c\u8be5\u5982\u4f55\u64cd\u4f5c\u5462\uff1f\uff1f \u6548\u679c\u56fe\u793a\uff1a \u89e3\u51b3\u65b9\u6cd5\uff1a \u7b2c\u4e00\u6b65\uff1a \u9996\u5148\u4fee\u6539category.php \u6587\u4ef6\uff0c\u5b9a\u4f4d\u5230 category_get_goods() \u51fd\u6570\u90e8\u5206 \u627e\u5230 $sql = &#8216;SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, &#8216; . &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8220;IFNULL(mp.user_price, g.shop_price * &#8216;$_SESSION[discount]&#8217;) AS shop_price, g.promote_price, g.goods_type, &#8221; . &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8216;g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb , g.goods_img &#8216; . &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8216;FROM &#8216; . $GLOBALS[&#8216;ecs&#8217;]-&gt;table(&#8216;goods&#8217;) . &#8216; AS g &#8216; [&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-59106","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/59106","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=59106"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/59106\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=59106"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=59106"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=59106"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}