{"id":199499,"date":"2025-05-03T11:54:35","date_gmt":"2025-05-03T03:54:35","guid":{"rendered":"https:\/\/server.hk\/cnblog\/199499\/"},"modified":"2025-05-03T11:54:35","modified_gmt":"2025-05-03T03:54:35","slug":"ecshop%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%e5%93%81%e7%89%8c","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/199499\/","title":{"rendered":"ecshop\u5546\u54c1\u5217\u8868\u9875\u663e\u793a\u6bcf\u4e2a\u5546\u54c1\u7684\u54c1\u724c"},"content":{"rendered":"<p> \u597d\u6a21\u677f\u4e3a\u60a8\u6574\u7406\uff0c\u5728Ecshop\u5546\u54c1\u5217\u8868\u9875\u663e\u793a\u6bcf\u4e2a\u5546\u54c1\u7684\u54c1\u724c\u7684\u4fee\u6539\u65b9\u6cd5<\/p>\n<p> 1\u3001\u9996\u5148\u4fee\u6539 category.php \u6587\u4ef6<br \/> \u5c06<br \/> $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; .<\/p>\n<p> \u4fee\u6539\u4e3a<br \/> $sql = &#8216;SELECT g.goods_id, g.goods_name, b.brand_name , g.goods_name_style, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, &#8216; .<\/p>\n<p> \u627e\u5230<br \/> &#8220;ON mp.goods_id = g.goods_id AND mp.user_rank = &#8216;$_SESSION[user_rank]&#8217; &#8221; .<\/p>\n<p> \u5728\u5b83\u4e0b\u9762\u589e\u52a0\u4e00\u884c<br \/> &#8221; LEFT JOIN&nbsp; &#8220;. $GLOBALS[&#8216;ecs&#8217;]-&gt;table(&#8216;brand&#8217;) . &#8221; AS b on b.brand_id = g.brand_id &#8221; .<\/p>\n<p> \u7ee7\u7eed\uff0c\u627e\u5230<br \/> $arr[$row[&#8216;goods_id&#8217;]][&#8216;name&#8217;]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = $row[&#8216;goods_name&#8217;];<\/p>\n<p> \u5728\u5b83\u4e0b\u8fb9\u589e\u52a0\u4e00\u884c<br \/> $arr[$row[&#8216;goods_id&#8217;]][&#8216;brand_name&#8217;]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = $row[&#8216;brand_name&#8217;];<\/p>\n<p> 2\u3001\u63a5\u4e0b\u6765\u6253\u5f00\u6a21\u677f\u5e93\u6587\u4ef6 \/themes\/default\/library\/goods_list.lbi<br \/> \u60f3\u5728\u54ea\u663e\u793a\u54c1\u724c\u5c31\u5728\u54ea\u52a0\u5165\u4ee3\u7801 {$goods.brand_name}\u5373\u53ef\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u597d\u6a21\u677f\u4e3a\u60a8\u6574\u7406\uff0c\u5728Ecshop\u5546&#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-199499","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199499","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=199499"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199499\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=199499"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=199499"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=199499"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}