{"id":60177,"date":"2025-04-24T10:15:23","date_gmt":"2025-04-24T02:15:23","guid":{"rendered":"https:\/\/fwq.ai\/blog\/60177\/"},"modified":"2025-04-24T10:15:23","modified_gmt":"2025-04-24T02:15:23","slug":"%e4%bf%ae%e6%94%b9ecshop%e8%ae%a9%e9%a6%96%e9%a1%b5%e6%98%be%e7%a4%ba%e8%af%84%e8%ae%ba%e6%95%b0%e9%87%8f%e5%92%8c%e8%af%84%e8%ae%ba%e7%ba%a7%e5%88%ab-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/60177\/","title":{"rendered":"\u4fee\u6539ecshop\u8ba9\u9996\u9875\u663e\u793a\u8bc4\u8bba\u6570\u91cf\u548c\u8bc4\u8bba\u7ea7\u522b"},"content":{"rendered":"<p>&nbsp;&nbsp;\u5982\u4f55\u4fee\u6539ecshop\u8ba9\u9996\u9875\u663e\u793a\u8bc4\u8bba\u6570\u91cf\u548c\u8bc4\u8bba\u7ea7\u522b\uff0c\u597d\u6a21\u677f\u63d0\u4f9b\u65b9\u6cd5<\/p>\n<p><span style=\"font-family: Verdana, Helvetica, Arial, sans-serif;text-align: left\">\u4fee\u6539category.php&nbsp;<\/span><span style=\"line-height: normal;cursor: pointer;border-bottom-width: 1px;border-bottom-style: solid;font-family: Verdana, Helvetica, Arial, sans-serif;text-align: left\">\u6587\u4ef6<\/span><\/p>\n<p> <span style=\"font-family: Verdana, Helvetica, Arial, sans-serif;text-align: left\">\u627e\u5230\u4e0b\u9762\u7684<\/span><\/p>\n<ol>\n<li>$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; .<\/li>\n<li>&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; .<\/li>\n<li>&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; .<\/li>\n<li>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&#8216;FROM &#8216; . $GLOBALS[&#8216;ecs&#8217;]-&gt;table(&#8216;goods&#8217;) . &#8216; AS g &#8216; .<\/li>\n<li>&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; .<\/li>\n<li>&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; .<\/li>\n<li>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&#8220;WHERE $where $ext ORDER BY $sort $order&#8221;;<\/li>\n<\/ol>\n<p><em>\u590d\u5236<span style=\"cursor: pointer;border-bottom-width: 1px;border-bottom-style: solid\">\u4ee3\u7801<\/span><\/em>  <\/p>\n<p><span style=\"font-family: Verdana, Helvetica, Arial, sans-serif;text-align: left\">\u6539\u6210\u4e0b\u9762\u7684<\/span><\/p>\n<ol>\n<li>$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; .<\/li>\n<li>&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; .<\/li>\n<li>&nbsp;&nbsp;&#8221; IFNULL(AVG(r.comment_rank),0) AS comment_rank,IF(r.comment_rank,count(*),0) AS&nbsp;&nbsp;comment_count, &#8220;.<\/li>\n<li>&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; .<\/li>\n<li>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&#8216;FROM &#8216; . $GLOBALS[&#8216;ecs&#8217;]-&gt;table(&#8216;goods&#8217;) . &#8216; AS g &#8216; .<\/li>\n<li>&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; .<\/li>\n<li>&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; .<\/li>\n<li>&nbsp; &nbsp;&nbsp;&nbsp;&#8216; LEFT JOIN&nbsp;&nbsp;&#8216;. $GLOBALS[&#8216;ecs&#8217;]-&gt;table(&#8216;comment&#8217;) .&#8217; AS r &#8216;.<\/li>\n<li>&nbsp; &nbsp;&#8216;ON r.id_value = g.goods_id AND comment_type = 0 AND r.parent_id = 0 AND r.status = 1 &#8216; .<\/li>\n<li>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&#8220;WHERE $where $ext group by g.goods_id ORDER BY $sort $order&#8221;;<\/li>\n<\/ol>\n<p><em>\u590d\u5236\u4ee3\u7801<\/em>  <\/p>\n<p><span style=\"font-family: Verdana, Helvetica, Arial, sans-serif;text-align: left\">\u7ee7\u7eed\u627e\u5230<\/span><\/p>\n<ol>\n<li>$arr[$row[&#8216;goods_id&#8217;]][&#8216;url&#8217;]&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;]);<\/li>\n<\/ol>\n<p><em>\u590d\u5236\u4ee3\u7801<\/em>  <\/p>\n<p><span style=\"font-family: Verdana, Helvetica, Arial, sans-serif;text-align: left\">\u5728\u4e0b\u9762\u589e\u52a0\u51e0\u5217<\/span><\/p>\n<ol>\n<li>$row[&#8216;comment_rank&#8217;]&nbsp;&nbsp;= ceil($row[&#8216;comment_rank&#8217;]) == 0 ? 5 : ceil($row[&#8216;comment_rank&#8217;]);<\/li>\n<li>$arr[$row[&#8216;goods_id&#8217;]][&#8216;comment_rank&#8217;]=$row[&#8216;comment_rank&#8217;];<\/li>\n<li>$arr[$row[&#8216;goods_id&#8217;]][&#8216;comment_count&#8217;]=$row[&#8216;comment_count&#8217;];<\/li>\n<\/ol>\n<p><em>\u590d\u5236\u4ee3\u7801<\/em>  <\/p>\n<p><span style=\"line-height: normal;cursor: pointer;border-bottom-width: 1px;border-bottom-style: solid;font-family: Verdana, Helvetica, Arial, sans-serif;text-align: left\">\u6a21\u677f<\/span><span style=\"font-family: Verdana, Helvetica, Arial, sans-serif;text-align: left\">\u4fee\u6539\u8bf4\u660e\uff1a<\/span><br \/> <span style=\"font-family: Verdana, Helvetica, Arial, sans-serif;text-align: left\">htemes\/default\/library\/goods_list.lbi \u6587\u4ef6<\/span><\/p>\n<ol>\n<li>&lt;a href=&#8221;javascript:collect({$goods.goods_id});&#8221;&gt;{$lang.btn_collect}&lt;\/a&gt;<\/li>\n<\/ol>\n<p><em>\u590d\u5236\u4ee3\u7801<\/em>  <\/p>\n<p><span style=\"font-family: Verdana, Helvetica, Arial, sans-serif;text-align: left\">\u5728\u4e0a\u9762\u589e\u52a0\u4ee5\u4e0b\u4ee3\u7801<\/span><\/p>\n<ol>\n<li>&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;<\/li>\n<li>\u8bc4\u8bba\u6570\uff1a{$goods.comment_count}&lt;br&gt;<\/li>\n<\/ol>\n<p><em>\u590d\u5236\u4ee3\u7801<\/em>  <\/p>\n<p><span style=\"line-height: normal;cursor: pointer;border-bottom-width: 1px;border-bottom-style: solid;font-family: Verdana, Helvetica, Arial, sans-serif;text-align: left\">\u8bbe\u7f6e<\/span><span style=\"font-family: Verdana, Helvetica, Arial, sans-serif;text-align: left\">\u7f13\u5b58\u673a\u5236<\/span><\/p>\n<ol>\n<li>\u628a category.php \u6587\u4ef6\u7684<\/li>\n<li>$smarty-&gt;caching = true;<\/li>\n<li>\u4fee\u6539\u4e3a<\/li>\n<li>$smarty-&gt;caching = false;<\/li>\n<\/ol>\n<p><em>\u590d\u5236\u4ee3\u7801<\/em> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;&nbsp;\u5982\u4f55\u4fee\u6539ecshop\u8ba9\u9996\u9875\u663e\u793a\u8bc4\u8bba\u6570\u91cf\u548c\u8bc4\u8bba\u7ea7\u522b\uff0c\u597d\u6a21\u677f\u63d0\u4f9b\u65b9\u6cd5 \u4fee\u6539category.php&nbsp;\u6587\u4ef6 \u627e\u5230\u4e0b\u9762\u7684 $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; &#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; &#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;&#8216;FROM &#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-60177","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/60177","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=60177"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/60177\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=60177"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=60177"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=60177"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}