{"id":199354,"date":"2025-05-03T13:54:59","date_gmt":"2025-05-03T05:54:59","guid":{"rendered":"https:\/\/server.hk\/cnblog\/199354\/"},"modified":"2025-05-03T13:54:59","modified_gmt":"2025-05-03T05:54:59","slug":"ecshop%e5%95%86%e5%93%81%e9%a1%b5_%e5%b0%86%e4%b8%8a%e4%b8%80%e4%b8%aa%e4%b8%8b%e4%b8%80%e4%b8%aa%e7%9a%84alt%e6%94%b9%e4%b8%ba%e5%95%86%e5%93%81%e5%90%8d%e7%a7%b0","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/199354\/","title":{"rendered":"ECSHOP\u5546\u54c1\u9875_\u5c06\u4e0a\u4e00\u4e2a\u4e0b\u4e00\u4e2a\u7684ALT\u6539\u4e3a\u5546\u54c1\u540d\u79f0"},"content":{"rendered":"<p> \u7b2c1\u6b65\uff1a\u4fee\u6539 goods.php \u6587\u4ef6<\/p>\n<p> \u627e\u5230\u4e0b\u9762\u8fd9\u6bb5\u4ee3\u7801<\/p>\n<p> &nbsp;<\/p>\n<table cellpadding=\"5\" cellspacing=\"0\" 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>\n<p> \/* \u4e0a\u4e00\u4e2a\u5546\u54c1\u4e0b\u4e00\u4e2a\u5546\u54c1 *\/<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $prev_gid = $db-&gt;getOne(&#8220;SELECT goods_id FROM &#8221; .$ecs-&gt;table(&#8216;goods&#8217;). &#8221; WHERE cat_id=&#8221; . $goods[&#8216;cat_id&#8217;] . &#8221; AND goods_id &gt; &#8221; . $goods[&#8216;goods_id&#8217;] . &#8221; AND is_on_sale = 1 AND is_alone_sale = 1 AND is_delete = 0 LIMIT 1&#8243;);<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!empty($prev_gid))<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $prev_good[&#8216;url&#8217;] = build_uri(&#8216;goods&#8217;, array(&#8216;gid&#8217; =&gt; $prev_gid), $goods[&#8216;goods_name&#8217;]);<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $smarty-&gt;assign(&#8216;prev_good&#8217;, $prev_good);\/\/\u4e0a\u4e00\u4e2a\u5546\u54c1<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<\/p>\n<p> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $next_gid = $db-&gt;getOne(&#8220;SELECT max(goods_id) FROM &#8221; . $ecs-&gt;table(&#8216;goods&#8217;) . &#8221; WHERE cat_id=&#8221;.$goods[&#8216;cat_id&#8217;].&#8221; AND goods_id &lt; &#8220;.$goods[&#8216;goods_id&#8217;] . &#8221; AND is_on_sale = 1 AND is_alone_sale = 1 AND is_delete = 0&#8243;);<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!empty($next_gid))<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $next_good[&#8216;url&#8217;] = build_uri(&#8216;goods&#8217;, array(&#8216;gid&#8217; =&gt; $next_gid), $goods[&#8216;goods_name&#8217;]);<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $smarty-&gt;assign(&#8216;next_good&#8217;, $next_good);\/\/\u4e0b\u4e00\u4e2a\u5546\u54c1<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p> \u7136\u540e\u5c06\u5b83\u4fee\u6539\u4e3a\u4e0b\u9762\u4ee3\u7801\uff08\u6ce8\u610f\u7ea2\u8272\u90e8\u5206\uff09<\/p>\n<p> &nbsp;<\/p>\n<table cellpadding=\"5\" cellspacing=\"0\" 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>\n<p> \/* \u4e0a\u4e00\u4e2a\u5546\u54c1\u4e0b\u4e00\u4e2a\u5546\u54c1 *\/&nbsp;<br \/> $prev_gid = $db-&gt;<span style=\"color: #ff0000\">getRow<\/span>(&#8220;SELECT goods_id<span style=\"color: #ff0000\">,goods_name <\/span>FROM &#8221; .$ecs-&gt;table(&#8216;goods&#8217;). &#8221; WHERE cat_id=&#8221; . $goods[&#8216;cat_id&#8217;] . &#8221; AND goods_id &gt; &#8221; . $goods[&#8216;goods_id&#8217;] . &#8221; AND is_on_sale = 1 AND is_alone_sale = 1 AND is_delete = 0 LIMIT 1&#8243;);<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!empty($prev_gid))<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $prev_good[&#8216;url&#8217;] = build_uri(&#8216;goods&#8217;, array(&#8216;gid&#8217; =&gt;<span style=\"color: #ff0000\"> $prev_gid[&#8216;goods_id&#8217;]<\/span>), $goods[&#8216;goods_name&#8217;]);<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font>$prev_good[&#8216;goods_name&#8217;] =$prev_gid[&#8216;goods_name&#8217;];<\/font><br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $smarty-&gt;assign(&#8216;prev_good&#8217;, $prev_good);\/\/\u4e0a\u4e00\u4e2a\u5546\u54c1<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<\/p>\n<p> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $next_gid = $db-&gt;<span style=\"color: #ff0000\">getRow<\/span>(&#8220;SELECT <span style=\"color: #ff0000\">goods_id,goods_name<\/span> FROM &#8221; . $ecs-&gt;table(&#8216;goods&#8217;) . &#8221; WHERE cat_id=&#8221;.$goods[&#8216;cat_id&#8217;].&#8221; AND goods_id &lt; &#8220;.$goods[&#8216;goods_id&#8217;] . &#8221; AND is_on_sale = 1 AND is_alone_sale = 1 AND is_delete = 0 <span style=\"color: #ff0000\">order by goods_id desc&nbsp;limit 1<\/span>&#8220;);<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!empty($next_gid))<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $next_good[&#8216;url&#8217;] = build_uri(&#8216;goods&#8217;, array(&#8216;gid&#8217; =&gt; <span style=\"color: #ff0000\">$next_gid[&#8216;goods_id&#8217;]<\/span>), $goods[&#8216;goods_name&#8217;]);<br \/> <font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $next_good[&#8216;goods_name&#8217;] =$next_gid[&#8216;goods_name&#8217;];<\/font><br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $smarty-&gt;assign(&#8216;next_good&#8217;, $next_good);\/\/\u4e0b\u4e00\u4e2a\u5546\u54c1<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p> \u7b2c2\u6b65\uff1a \u4fee\u6539\u6a21\u677f\u6587\u4ef6&nbsp; \uff08\u4ee5\u5b98\u65b9\u9ed8\u8ba4\u6a21\u677f\u4e3a\u4f8b\uff09&nbsp; \/themes\/default\/goods.dwt<\/p>\n<p> \u5c06<\/p>\n<table cellpadding=\"5\" cellspacing=\"0\" 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;{$prev_good.url}&#8221;&gt;&lt;img alt=&#8221;prev&#8221; src=&#8221;.\/images\/up.gif&#8221; \/&gt;&lt;\/a&gt;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p> \u4fee\u6539\u4e3a\uff1a<br \/> &nbsp;<\/p>\n<table cellpadding=\"5\" cellspacing=\"0\" 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;{$prev_good.url}&#8221;&gt;&lt;img alt=&#8221;{$prev_good.goods_name}&#8221; src=&#8221;.\/images\/up.gif&#8221; \/&gt;&lt;\/a&gt;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p> \u518d\u5c06<\/p>\n<table cellpadding=\"5\" cellspacing=\"0\" 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;{$next_good.url}&#8221;&gt;&lt;img alt=&#8221;next&#8221; src=&#8221;.\/images\/down.gif&#8221; \/&gt;&lt;\/a&gt;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p> \u4fee\u6539\u4e3a<br \/> &nbsp;<\/p>\n<table cellpadding=\"5\" cellspacing=\"0\" 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;{$next_good.url}&#8221;&gt;&lt;img alt=&#8221;{$next_good.goods_name}&#8221; src=&#8221;.\/images\/down.gif&#8221; \/&gt;&lt;\/a&gt;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>  &nbsp;  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7b2c1\u6b65\uff1a\u4fee\u6539 goods.php&#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-199354","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199354","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=199354"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199354\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=199354"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=199354"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=199354"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}