{"id":199164,"date":"2025-05-03T13:24:40","date_gmt":"2025-05-03T05:24:40","guid":{"rendered":"https:\/\/server.hk\/cnblog\/199164\/"},"modified":"2025-05-03T13:24:40","modified_gmt":"2025-05-03T05:24:40","slug":"ecshop%e8%b0%83%e7%94%a8%e6%8c%87%e5%ae%9a%e5%95%86%e5%93%81%e5%88%86%e7%b1%bb","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/199164\/","title":{"rendered":"ECSHOP\u8c03\u7528\u6307\u5b9a\u5546\u54c1\u5206\u7c7b"},"content":{"rendered":"<p>&nbsp;<span style=\"border-collapse: collapse;font-family: Verdana, Helvetica, Arial, sans-serif\">\u9996\u5148\u662f\u590d\u5236\u4e00\u4e2a index.php&nbsp;<span style=\"line-height: normal;cursor: pointer;border-bottom-width: 1px;border-bottom-style: solid\">\u6587\u4ef6<\/span>\uff0c\u66f4\u540d\u4e3a chengkao.php \uff0c\u8fd9\u6b21\u597d\u6a21\u677f\u91c7\u7528ecshop\u505a\u7684\u4e00\u4e2a\u9891\u9053\uff0c\u56e0\u6b64\u5c31\u7528\u6210\u8003\u7684\u62fc\u97f3\u6765\u547d\u540d\u5427\u3002<br \/> \u4e00\u3001\u641c\u7d22 index.dwt \u66ff\u6362\u4e3a chengkao.dwt<br \/> \u4e8c\u3001\u628a\u4ee5\u4e0b\u4ee3\u7801\u7c98\u8d34\u5230\u6587\u4ef6\u5012\u6570\u7b2c\u4e8c\u884c\u7684\u4f4d\u7f6e\uff0c&lt;\/?&gt; \u7684\u524d\u9762\uff0c\u975e\u7279\u5b9a\u3002<br \/> <\/span><\/p>\n<ol>\n<li>\/**<\/li>\n<li>* \u83b7\u5f97\u6307\u5b9a\u5206\u7c7b\u5546\u54c1<span style=\"line-height: normal;cursor: pointer;border-bottom-width: 1px;border-bottom-style: solid\">\u5217\u8868<\/span>\u3002<\/li>\n<li>*\/<\/li>\n<li>function cat_goods_list($cat_id)<\/li>\n<li>{<\/li>\n<li>$sql = &#8216;SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.shop_price, g.goods_thumb , g.goods_img, g.cat_id &#8216; .<\/li>\n<li>&#8216;FROM &#8216; . $GLOBALS[&#8216;ecs&#8217;]-&gt;table(&#8216;goods&#8217;) . &#8216; AS g &#8216; .<\/li>\n<li>&#8220;WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 AND g.cat_id = &#8220;.$cat_id . &#8221; ORDER by g.goods_id DESC LIMIT 12&#8243; ;<\/li>\n<li>$res = $GLOBALS[&#8216;db&#8217;]-&gt;getAll($sql);<\/li>\n<li>$goods = array();<\/li>\n<li>foreach ($res AS $idx =&gt; $row)<\/li>\n<li>{<\/li>\n<li>$goods[$idx][&#8216;id&#8217;]&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=$row[&#8216;goods_id&#8217;];<\/li>\n<li>$goods[$idx][&#8216;name&#8217;]&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;=$row[&#8216;goods_name&#8217;];<\/li>\n<li>$goods[$idx][&#8216;market_price&#8217;]&nbsp; &nbsp; =price_format($row[&#8216;market_price&#8217;]);<\/li>\n<li>$goods[$idx][&#8216;shop_price&#8217;]&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=price_format($row[&#8216;shop_price&#8217;]);<\/li>\n<li>$goods[$idx][&#8216;thumb&#8217;]&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;= empty($row[&#8216;goods_thumb&#8217;]) ? $GLOBALS[&#8216;_CFG&#8217;][&#8216;no_picture&#8217;] : $row[&#8216;goods_thumb&#8217;];<\/li>\n<li>$goods[$idx][&#8216;goods_img&#8217;]&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;= empty($row[&#8216;goods_img&#8217;]) ? $GLOBALS[&#8216;_CFG&#8217;][&#8216;no_picture&#8217;] : $row[&#8216;goods_img&#8217;];<\/li>\n<li>$goods[$idx][&#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<li>}<\/li>\n<li>return $goods;<\/li>\n<li>}<\/li>\n<\/ol>\n<p><em>\u590d\u5236\u4ee3\u7801<\/em>  <\/p>\n<p> \u4e09\u3001\u5df2\u7ecf\u8bf4\u5f97\u6709\u70b9\u50bb\u4e86\u3002\u7136\u540e\u628a\u4e0b\u9762\u7684\u8c03\u7528\u590d\u5236\u5230\u5408\u9002\u4f4d\u7f6e\u3002<\/p>\n<ol>\n<li>$smarty-&gt;assign(&#8216;catid_39&#8217;,&nbsp; &nbsp;&nbsp; &nbsp; cat_goods_list (39));&nbsp;&nbsp;\/\/\u4e13\u5347\u672c<\/li>\n<li>$smarty-&gt;assign(&#8216;catid_40&#8217;,&nbsp; &nbsp;&nbsp; &nbsp; cat_goods_list (40));&nbsp;&nbsp;\/\/\u9ad8\u5347\u672c\u4e13<\/li>\n<li>$smarty-&gt;assign(&#8216;catid_152&#8217;,&nbsp; &nbsp;&nbsp; &nbsp; cat_goods_list (152));&nbsp;&nbsp;\/\/\u4e13\u63d2\u672c<\/li>\n<\/ol>\n<p><em>\u590d\u5236\u4ee3\u7801<\/em>  <\/p>\n<p> \u8fd9\u91cc\u53ef\u4ee5\u770b\u51fa\u8c03\u7528\u4e86\u4e09\u4e2a\u5206\u7c7b\u3002<br \/> \u56db\u3001\u590d\u5236\u4e00\u4e2a index.dwt \u6587\u4ef6\uff0c\u6539\u540d\u4e3a chengkao.dwt \u3002\u590d\u5236\u4ee5\u4e0b\u4ee3\u7801\u5230\u5408\u9002\u5730\u65b9\uff0c\u4e8b\u5b9e\u53ea\u8981\u4fee\u6539cat_goods.lbi \u6587\u4ef6\u4e2d\u7684\u4e00\u4e9b smarty \u8c03\u7528\u5c31\u884c\u4e86\u3002\u8fd9\u6837\u5c31\u4e0d\u9700\u8981\u91cd\u65b0\u6574\u4ec0\u4e48<span style=\"line-height: normal;cursor: pointer;border-bottom-width: 1px;border-bottom-style: solid\">\u6a21\u7248<\/span>\u4e86\u3002<\/p>\n<ol>\n<li>&lt;div class=&#8221;module clearfix&#8221;&gt;<\/li>\n<li>&lt;h3&gt; &lt;a href=&#8221;https:\/\/www.ldhost.cn\/help\/category-39-b0.html&#8221;&gt;\u6210\u8003\u9ad8\u5347\u672c\u4e13&lt;\/a&gt;&lt;\/h3&gt;<\/li>\n<li>&lt;ul&gt;<\/li>\n<li>&lt;!&#8211;{foreach from=$catid_39 item=cat_goods}&#8211;&gt;<\/li>\n<li>&lt;li&gt;<\/li>\n<li>&lt;p&gt;&lt;a href=&#8221;{$cat_goods.url}&#8221;&gt;&lt;img src=&#8221;{$cat_goods.thumb}&#8221; alt=&#8221;{$cat_goods.name|escape:html}&#8221; \/&gt;&lt;\/a&gt;&lt;\/p&gt;<\/li>\n<li>&lt;p&gt;&lt;a href=&#8221;{$cat_goods.url}&#8221; title=&#8221;{$cat_goods.name|escape:html}&#8221;&gt;{$cat_goods.name|escape:html}}&lt;\/a&gt;&lt;\/p&gt;<\/li>\n<li>&lt;!&#8211; {if $cat_goods.promote_price neq &#8220;&#8221;} &#8211;&gt;<\/li>\n<li>{$lang.promote_price}&lt;span&gt;{$cat_goods.promote_price}&lt;\/span&gt;&lt;br \/&gt;<\/li>\n<li>&lt;!&#8211; {else}&#8211;&gt;<\/li>\n<li>{$lang.shop_price}&lt;span&gt;{$cat_goods.shop_price}&lt;\/span&gt;&lt;br \/&gt;<\/li>\n<li>&lt;!&#8211;{\/if}&#8211;&gt;<\/li>\n<li>&lt;\/li&gt;<\/li>\n<li>&lt;!&#8211;{\/foreach}&#8211;&gt;<\/li>\n<li>&lt;\/ul&gt;<\/li>\n<li>&lt;\/div&gt;<\/li>\n<\/ol>\n<p><em>\u590d\u5236\u4ee3\u7801<\/em>  <\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;\u9996\u5148\u662f\u590d\u5236\u4e00\u4e2a in&#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-199164","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199164","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=199164"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199164\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=199164"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=199164"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=199164"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}