{"id":60737,"date":"2025-04-26T08:20:46","date_gmt":"2025-04-26T00:20:46","guid":{"rendered":"https:\/\/fwq.ai\/blog\/60737\/"},"modified":"2025-04-26T08:20:46","modified_gmt":"2025-04-26T00:20:46","slug":"%e5%9c%a8zencart%e4%ba%a7%e5%93%81%e8%af%a6%e7%bb%86%e9%a1%b5%e9%9d%a2%e6%98%be%e7%a4%batags%e6%a0%87%e7%ad%be","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/60737\/","title":{"rendered":"\u5728zencart\u4ea7\u54c1\u8be6\u7ec6\u9875\u9762\u663e\u793atags\u6807\u7b7e"},"content":{"rendered":"<p>\u7ed9\u5546\u54c1\u4fe1\u606f\u9875\u9762\u6dfb\u52a0\u4e00\u4e9btag\u5173\u952e\u8bcd\u6807\u7b7e\u6709\u5229\u4e8e\u8c37\u6b4c\u7684\u6536\u5f55\uff0c\u4e5f\u6709\u5229\u4e8e\u5173\u952e\u8bcd\u7684SEO\uff0c\u5b9e\u73b0\u8fd9\u4e2a\u529f\u80fd\u5e76\u4e0d\u96be\u3002\u5176\u5b9e\u5c31\u662f\u7ed9zencart\u6dfb\u52a0\u4e00\u4e2a\u529f\u80fd\u6a21\u5757\uff0c   &nbsp;   \u5177\u4f53\u65b9\u6cd5\u662f\uff1a   &nbsp;   1\uff0c\u5728mudules\u76ee\u5f55\u4e0b\u9762\u65b0\u5efa\u4e00\u4e2a\u4ee5\u6a21\u677f\u5f53\u524d\u6a21\u677f\u540d\u5b57\u4e3a\u540d\u7684\u76ee\u5f55\uff08\u5df2\u7ecf\u6709\u4e86\u5c31\u4e0d\u7528\u65b0\u5efa\u4e86\uff09\uff0c\u7136\u540e\u5728\u8be5\u76ee\u5f55\u4e0b\u9762\u65b0\u5efa\u4e00\u4e2a\u6587\u4ef6\uff0c\u547d\u540d\u4e3amodules_tag.php\u3002\u8f93\u5165\u5982\u4e0b\u4ee3\u7801\uff1a   &nbsp;   $tag_sql=&#8221;select metatags_keywords from &#8220;.TABLE_META_TAGS_PRODUCTS_DESCRIPTION.&#8221; where &#8220;. &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#8220;products_id=&#8221;.(int)$_GET[&#8216;products_id&#8217;].&#8221; and language_id=&#8221;.(int)$_SESSION[&#8216;languages_id&#8217;]; &nbsp; &nbsp;   $tag=$db-&gt;Execute($tag_sql); &nbsp; &nbsp;   $tags=array(); &nbsp; &nbsp;   if($tag-&gt;RecordCount()&gt;0){ &nbsp; &nbsp;   &nbsp; &nbsp; $has_products_tags=true; &nbsp; &nbsp;   &nbsp; &nbsp; $tags=explode(&#8216;,&#8217;, $tag-&gt;fields[&#8216;metatags_keywords&#8217;]); &nbsp; &nbsp;   } &nbsp;&nbsp;   \u8fd9\u91cc\u7684\u529f\u80fd\u5c31\u662f\u83b7\u53d6\u5173\u952e\u8bcd\u6807\u7b7e\u91cc\u9762\u7684\u5173\u952e\u8bcd\u3002   &nbsp;   2\uff0c\u5728\u5f53\u524d\u6a21\u677f\u7684templates\u76ee\u5f55\u4e0b\u9762\u6dfb\u52a0\u4e00\u4e2a\u6587\u4ef6\uff0c\u547d\u540d\u4e3a\uff1atpl_module_tag.php\u3002\u7136\u540e\u8f93\u5165\u4e0b\u9762\u7684\u4ee3\u7801\uff1a   &nbsp;   $has_products_tags=false; &nbsp; &nbsp;   include(DIR_WS_MODULES . zen_get_module_directory(&#8216;modules_tag.php&#8217;)); &nbsp; &nbsp;   ?&gt; &nbsp; &nbsp;   &lt;?php if($has_products_tags) {?&gt; &nbsp; &nbsp;   &lt;div id=&#8221;tags&#8221;&gt; &nbsp; &nbsp;   &nbsp; &lt;strong&gt;&lt;?php echo TEXT_TAGS?&gt;&lt;\/strong&gt; &nbsp; &nbsp;   &nbsp; &lt;?php foreach ($tags as $tag) {?&gt; &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp; &lt;span&gt;&lt;a href=&#8221;tag\/&lt;?php echo str_replace(&#8216; &#8216;, &#8216;+&#8217;, trim($tag));?&gt;&#8221;&gt;&lt;?php echo trim($tag);?&gt;&lt;\/a&gt;&lt;\/span&gt; &nbsp; &nbsp;   &nbsp; &lt;?php }?&gt; &nbsp; &nbsp;   &lt;\/div&gt; &nbsp; &nbsp;   &lt;?php }?&gt; &nbsp;   \u8fd9\u91cc\u7684\u4ee3\u7801\u5c31\u662f\u8c03\u7528\u5173\u952e\u8bcd\uff0c\u53ef\u6839\u636e\u81ea\u5df1\u7684\u9700\u8981\u8c03\u6574css.   &nbsp;   3\uff0c\u7ed9\u8be5\u6807\u7b7e\u7684url\u5199\u4e00\u4e2a\u91cd\u5199\u89c4\u5219\uff0c\u56e0\u4e3a\u8fd9\u4e2a\u6807\u7b7e\u5176\u5b9e\u662f\u4f7f\u7528\u7cfb\u7edf\u7684\u67e5\u8be2\u529f\u80fd\uff0c\u53ea\u4e0d\u8fc7\u67e5\u8be2\u7684\u5173\u952e\u8bcd\u88ab\u8bbe\u7f6e\u4e3a\u5546\u54c1\u7684\u5173\u952e\u8bcd\u3002\u7531\u4e8e\u67e5\u8be2\u9875\u9762\u7684URL\u6bd4\u8f83\u957f\uff0c\u4e0d\u662f\u5f88\u53cb\u597d\uff0c\u6240\u4ee5\u6709\u5fc5\u8981\u505a\u4e2a\u91cd\u5199\u6765\u8fbe\u5230\u53cb\u597d\u7684URL\u3002   \u5728\u6839\u76ee\u5f55\u7684.htaccess \u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u89c4\u5219   &nbsp;   RewriteRule ^tag\/(.*) index.php?main_page=advanced_search_result&amp;search_in_description=1&amp;keyword=$1 [L]   &nbsp;   4\uff0c\u8981\u770b\u5230\u6548\u679c\u8bf7\u7ed9\u5546\u54c1\u6dfb\u52a0\u5173\u952e\u8bcd\uff0c\u5728\u5546\u54c1\u5217\u8868\u7684\u53f3\u4fa7\u70b9\u51fb\u98ce\u706b\u8f6e\u8fdb\u5165\u7f16\u8f91\u3002  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7ed9\u5546\u54c1\u4fe1\u606f\u9875\u9762\u6dfb\u52a0\u4e00\u4e9btag\u5173\u952e\u8bcd\u6807\u7b7e\u6709\u5229\u4e8e\u8c37\u6b4c\u7684\u6536\u5f55\uff0c\u4e5f\u6709\u5229\u4e8e\u5173\u952e\u8bcd\u7684SEO\uff0c\u5b9e\u73b0\u8fd9\u4e2a\u529f\u80fd\u5e76\u4e0d\u96be\u3002\u5176\u5b9e\u5c31\u662f\u7ed9zencart\u6dfb\u52a0\u4e00\u4e2a\u529f\u80fd\u6a21\u5757\uff0c &nbsp; \u5177\u4f53\u65b9\u6cd5\u662f\uff1a &nbsp; 1\uff0c\u5728mudules\u76ee\u5f55\u4e0b\u9762\u65b0\u5efa\u4e00\u4e2a\u4ee5\u6a21\u677f\u5f53\u524d\u6a21\u677f\u540d\u5b57\u4e3a\u540d\u7684\u76ee\u5f55\uff08\u5df2\u7ecf\u6709\u4e86\u5c31\u4e0d\u7528\u65b0\u5efa\u4e86\uff09\uff0c\u7136\u540e\u5728\u8be5\u76ee\u5f55\u4e0b\u9762\u65b0\u5efa\u4e00\u4e2a\u6587\u4ef6\uff0c\u547d\u540d\u4e3amodules_tag.php\u3002\u8f93\u5165\u5982\u4e0b\u4ee3\u7801\uff1a &nbsp; $tag_sql=&#8221;select metatags_keywords from &#8220;.TABLE_META_TAGS_PRODUCTS_DESCRIPTION.&#8221; where &#8220;. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#8220;products_id=&#8221;.(int)$_GET[&#8216;products_id&#8217;].&#8221; and language_id=&#8221;.(int)$_SESSION[&#8216;languages_id&#8217;]; &nbsp; &nbsp; $tag=$db-&gt;Execute($tag_sql); &nbsp; &nbsp; $tags=array(); &nbsp; &nbsp; if($tag-&gt;RecordCount()&gt;0){ &nbsp; &nbsp; &nbsp; &nbsp; $has_products_tags=true; &nbsp; &nbsp; &nbsp; &nbsp; $tags=explode(&#8216;,&#8217;, $tag-&gt;fields[&#8216;metatags_keywords&#8217;]); &nbsp; &nbsp; } &nbsp;&nbsp; \u8fd9\u91cc\u7684\u529f\u80fd\u5c31\u662f\u83b7\u53d6\u5173\u952e\u8bcd\u6807\u7b7e\u91cc\u9762\u7684\u5173\u952e\u8bcd\u3002 &nbsp; 2\uff0c\u5728\u5f53\u524d\u6a21\u677f\u7684templates\u76ee\u5f55\u4e0b\u9762\u6dfb\u52a0\u4e00\u4e2a\u6587\u4ef6\uff0c\u547d\u540d\u4e3a\uff1atpl_module_tag.php\u3002\u7136\u540e\u8f93\u5165\u4e0b\u9762\u7684\u4ee3\u7801\uff1a &nbsp; $has_products_tags=false; &nbsp; &nbsp; include(DIR_WS_MODULES . [&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-60737","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/60737","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=60737"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/60737\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=60737"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=60737"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=60737"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}