{"id":2181,"date":"2010-04-11T14:49:37","date_gmt":"2010-04-11T06:49:37","guid":{"rendered":"http:\/\/www.inhaoxu.com\/blog\/?p=2181"},"modified":"2010-04-11T14:49:37","modified_gmt":"2010-04-11T06:49:37","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8ecshop%e4%b8%ad%e5%ae%9e%e7%8e%b0%e9%a6%96%e9%a1%b5%e4%ba%a7%e5%93%81%e6%98%be%e7%a4%ba%e8%af%84%e8%ae%ba%e6%95%b0%e9%87%8f","status":"publish","type":"post","link":"https:\/\/inhaoxu.com\/blog\/?p=2181","title":{"rendered":"\u5982\u4f55\u5728ecshop\u4e2d\u5b9e\u73b0\u9996\u9875\u4ea7\u54c1\u663e\u793a\u8bc4\u8bba\u6570\u91cf"},"content":{"rendered":"<p>\u8fd9\u4e2a\u9700\u8981\u4fee\u6539\u4e00\u4e2a\u7a0b\u5e8f\u6587\u4ef6 lib_goods.php<br \/>\n\u4eca\u5929\u53ea\u8bb2\u9996\u9875\u8c03\u7528(\u53ca \u6700\u65b0 \u70ed\u95e8 \u70ed\u9500\u4e2d\u663e\u793a)\u5176\u4ed6\u5730\u65b9\u663e\u793a \u6709\u9700\u8981\u7684\u4ee5\u540e\u518d\u5171\u4eab\u7ed9\u5927\u5bb6<br \/>\n\u5b9e\u73b0\u5728\u6587\u4ef6\u672b\u5c3e\u6dfb\u52a0\u4e00\u4e2a\u51fd\u6570<\/p>\n<p>function get_evaluation_sum($goods_id)<br \/>\n{<br \/>\n$sql = &#8220;SELECT count(*) FROM &#8221; . $GLOBALS[&#8216;ecs&#8217;]-&gt;table(&#8216;comment&#8217;) . &#8221; WHERE status=1 and\u00a0 comment_type =0 and id_value =&#8221;.$goods_id ;\/\/status=1\u8868\u793a\u901a\u8fc7\u4e86\u7684\u8bc4\u8bba\u624d\u7b97\u00a0 comment_type =0\u8868\u793a\u9488\u5bf9\u5546\u54c1\u7684\u8bc4\u4ef7<br \/>\n\u00a0\u00a0\u00a0 return $GLOBALS[&#8216;db&#8217;]-&gt;getOne($sql);<br \/>\n}<\/p>\n<p>\u7136\u540e\u627e\u5230 \u5728get_recommend_goods\u51fd\u6570\u4e2d \u5927\u81f4325\u884c \u5176\u540e\u6dfb\u52a0<\/p>\n<p>$goods[$idx][&#8216;url&#8217;]\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = build_uri(&#8216;goods&#8217;, array(&#8216;gid&#8217; =&gt; $row[&#8216;goods_id&#8217;]), $row[&#8216;goods_name&#8217;]);<\/p>\n<p>\u5176\u540e\u6dfb\u52a0<br \/>\n$goods[$idx][&#8216;evaluation&#8217;]\u00a0\u00a0 = get_evaluation_sum($row[&#8216;goods_id&#8217;]);<\/p>\n<p>\u70df\u53f0php\u57f9\u8bad\uff08<a href=\"http:\/\/www.0535php.com\/\">www.0535php.com<\/a>\uff09\u4e0e\u60a8\u5206\u4eabecshop\u4e8c\u6b21\u5f00\u53d1<\/p>\n<p>\u63a8\u8350\u5927\u5bb6\u5728lib_goods.php\u7a0b\u5e8f\u4e2d\u6240\u6709\u7684\uff1a<br \/>\n$goods[$idx][&#8216;url&#8217;]\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = build_uri(&#8216;goods&#8217;, array(&#8216;gid&#8217; =&gt; $row[&#8216;goods_id&#8217;]), $row[&#8216;goods_name&#8217;]);<br \/>\n\u4ee3\u7801\u540e\u6dfb\u52a0\uff1a<br \/>\n$goods[$idx][&#8216;evaluation&#8217;]\u00a0\u00a0 = get_evaluation_sum($row[&#8216;goods_id&#8217;]);<\/p>\n<p>\u8fd9\u6837\uff0c\u9996\u9875\u4e2d\u7684\u65b0\u54c1\u3001\u7cbe\u54c1\u3001\u70ed\u9500\u3001\u4fc3\u9500\uff0c\u6307\u5b9a\u5206\u7c7b\u4e0b\u7684\u5546\u54c1\uff0c\u6307\u5b9a\u54c1\u724c\u4e0b\u7684\u5546\u54c1\u90fd\u53ef\u4ee5\u663e\u793a\u8bc4\u8bba\u7684\u6570\u91cf\u3002\u9664\u9996\u9875\u663e\u793a\u5546\u54c1\u8bc4\u8bba\u5916\uff0c\u6211\u4eec\u8fd8\u53ef\u4ee5\u5728\u5546\u54c1\u5206\u7c7b\u9875\u663e\u793a\u6240\u6709\u4ea7\u54c1\u7684\u8bc4\u8bba\u6570\u91cf\uff0c\u89e3\u51b3\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n<p>1\u3001\u6253\u5f00 category.php \u7a0b\u5e8f\u6587\u4ef6\uff0c\u67e5\u627e\uff1a<br \/>\n\u00a0\u00a0 $arr[$row[&#8216;goods_id&#8217;]][&#8216;goods_brief&#8217;]\u00a0\u00a0\u00a0\u00a0\u00a0 = $row[&#8216;goods_brief&#8217;];\u00a0\u00a0\u00a0<br \/>\n\u00a0\u00a0\u00a0\u00a0 \u5728\u524d\u9762\u52a0\u4e0a\uff1a<br \/>\n\u00a0\u00a0 $goods_id = $row[&#8216;goods_id&#8217;];<br \/>\n\u00a0\u00a0\u00a0\u00a0 $count = $GLOBALS[&#8216;db&#8217;]-&gt;getOne(&#8220;SELECT COUNT(*) FROM &#8221; . $GLOBALS[&#8216;ecs&#8217;]-&gt;table(&#8216;comment&#8217;) . &#8221; where comment_type=0 and id_value =&#8217;$goods_id'&#8221;);<br \/>\n\u00a0\u00a0\u00a0\u00a0 $arr[$row[&#8216;goods_id&#8217;]][&#8216;review_count&#8217;]\u00a0\u00a0\u00a0\u00a0\u00a0 = $count;<\/p>\n<p>2\u3001\u6253\u5f00 goods_list.lbi \u5e93\u6587\u4ef6\uff0c\u5728\u5408\u9002\u7684\u4f4d\u7f6e\uff08\u5efa\u8bae\u5728\u4ef7\u683c\u4e0b\u9762\uff0c\u6bd4\u8f83\u7b26\u5408\u8d2d\u7269\u7528\u6237\u4e0a\u7f51\u4e60\u60ef\uff09\u4e0b\u6dfb\u52a0\u8c03\u7528\u4ee3\u7801\uff1a<br \/>\n\u00a0\u00a0 (\u5df2\u6709&lt;font color=&#8221;#CC0000&#8243; style=&#8221;font-weight:bold;&#8221;&gt;{$goods.review_count}&lt;\/font&gt;\u4eba\u8bc4\u8bba)<\/p>\n<p>3\u3001\u4fdd\u8bc1\u8be5\u5546\u54c1\u4e0b\u5df2\u7ecf\u6709\u8bc4\u8bba\u5b58\u5728\uff0c\u5e76\u4e14\u5df2\u7ecf\u901a\u8fc7\u7ba1\u7406\u5458\u7684\u5ba1\u6838\uff0c\u65b9\u53ef\u663e\u793a\u8bc4\u8bba\u6570\u91cf\uff1b\u5426\u5219\uff0c\u4f1a\u663e\u793a\u4e3a0\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8fd9\u4e2a\u9700\u8981\u4fee\u6539\u4e00\u4e2a\u7a0b\u5e8f\u6587\u4ef6 lib_goo&hellip;  <a href=\"https:\/\/inhaoxu.com\/blog\/?p=2181\" class=\"more-link\">more <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/inhaoxu.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2181"}],"collection":[{"href":"https:\/\/inhaoxu.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/inhaoxu.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/inhaoxu.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/inhaoxu.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2181"}],"version-history":[{"count":0,"href":"https:\/\/inhaoxu.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2181\/revisions"}],"wp:attachment":[{"href":"https:\/\/inhaoxu.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2181"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/inhaoxu.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2181"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/inhaoxu.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2181"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}