{"id":60981,"date":"2025-04-26T09:04:55","date_gmt":"2025-04-26T01:04:55","guid":{"rendered":"https:\/\/fwq.ai\/blog\/60981\/"},"modified":"2025-04-26T09:04:55","modified_gmt":"2025-04-26T01:04:55","slug":"zencart%e6%90%9c%e7%b4%a2%e7%bb%93%e6%9e%9c%e5%85%b3%e9%94%ae%e8%af%8d%e9%ab%98%e4%ba%ae%e6%98%be%e7%a4%ba","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/60981\/","title":{"rendered":"Zencart\u641c\u7d22\u7ed3\u679c\u5173\u952e\u8bcd\u9ad8\u4eae\u663e\u793a"},"content":{"rendered":"<p>\u9996\u5148\u4ecb\u7ecd\u4e00\u4e0b\u8fd9\u4e2a\u529f\u80fd\uff1a\u5728\u641c\u7d22\u6846\u8f93\u5165\u5173\u952e\u8bcd\u7684\u65f6\u5019\uff0c\u641c\u7d22\u51fa\u6765\u7684\u7ed3\u679c\u4f1a\u628a\u5339\u914d\u5230\u7684\u5173\u952e\u8bcd\u9ad8\u4eae\u663e\u793a\uff0c\u53ef\u4ee5\u7cbe\u786e\u5339\u914d\uff0c\u4e5f\u53ef\u4ee5\u6a21\u7cca\u5339\u914d\u3002 &nbsp; \u7cbe\u786e\u5339\u914d\uff1a\u4f8b\u5982\u4ea7\u54c1\u540d\u5b57\u662f\u201c\u5927\u718a\u535a\u5ba2\u5b9a\u5236\u5916\u8d38 \u201d\uff0c\u641c\u8fc7\u5173\u952e\u8bcd\u662f\u201czencart\u6a21\u677f\u201d\uff0c\u5c31\u53ef\u4ee5\u641c\u7d22\u5230\u8fd9\u4e2a\u4ea7\u54c1\uff0c\u5982\u679c\u5173\u952e\u8bcd\u662f\u201c\u201c\u5219\u4e0d\u80fd\u641c\u7d22\u5230\u8fd9\u4e2a\u4ea7\u54c1\u3002 &nbsp; \u6a21\u7cca\u5339\u914d\uff08\u5206\u6bb5\u5339\u914d\uff09\uff1a\u4e0a\u9762\u4f8b\u5b50\u4e2d\u901a\u8fc7\u641c\u7d22\u5173\u952e\u8bcd\u201czencart\u6a21\u677f\u201d\u53ef\u4ee5\u641c\u7d22\u4ea7\u54c1\uff0c\u641c\u7d22\u201c \u201d\u3001\u201c\u5916\u8d38\u6a21\u677f\u201d\u3001\u201c\u5927\u718azencart\u6a21\u677f\u201d\u90fd\u662f\u53ef\u4ee5\u641c\u7d22\u5230\u8fd9\u4e2a\u4ea7\u54c1\u7684\u3002 &nbsp; \u5b89\u88c5\u8be6\u89e3\uff1a &nbsp; 1\uff0c\u5728\u6587\u4ef6inlcudes\/functions\/functions_general.php \u4e2d\u52a0\u5165\u4ee5\u4e0b\u51fd\u6570\uff1a &nbsp; &nbsp; &nbsp; &nbsp; function highLight($str, $keywords, $color = &#8220;red&#8221;) { &nbsp;&nbsp; &nbsp; &nbsp; if (empty($keywords)) { &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return $str; &nbsp;&nbsp; &nbsp; &nbsp; } &nbsp;&nbsp; &nbsp; &nbsp; $keywords = split(&#8220;[ \\t\\r\\n,]+&#8221;, $keywords); &nbsp;&nbsp; &nbsp; &nbsp; foreach($keywords as $val) { &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $tvar = preg_quote($val); &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $tvar = str_ireplace(&#8216;\/&#8217;, &#8216;\\\/&#8217;, $tvar); &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $patterns[] &nbsp; &nbsp;= &#8220;\/(&#8221; . $tvar . &#8220;)\/i&#8221;; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $replacement[] = urlencode($val) ; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $tvar = preg_quote(urlencode($val)); &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $tvar = str_ireplace(&#8216;\/&#8217;, &#8216;\\\/&#8217;, $tvar); &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $tmppattern[] &nbsp;= &#8220;\/(&#8221; &nbsp;. $tvar . &nbsp;&#8220;)\/i&#8221;; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $finalrep[] &nbsp; &nbsp;= &#8220;&lt;strong style=&#8217;color:&#8221; . $color . &#8220;&#8216;&gt;&#8221; . $val . &#8220;&lt;\/strong&gt;&#8221;; &nbsp;&nbsp; &nbsp; &nbsp; } &nbsp;&nbsp; &nbsp; &nbsp; $str = preg_replace($patterns, $replacement, $str); &nbsp;&nbsp; &nbsp; &nbsp; $str = preg_replace($tmppattern, $finalrep, $str); &nbsp;&nbsp; &nbsp; &nbsp; return $str; &nbsp;&nbsp; } &nbsp; &nbsp; &nbsp; 2\uff0c\u6253\u5f00includes\/modules\/\u60a8\u7684\u6a21\u677f\/product_listing.php \u627e\u5230case &#8216;PRODUCT_LIST_NAME&#8217;:\u4e0b\u7684\u4e24\u9879 &nbsp; $listing-&gt;fields[&#8216;products_name&#8217;] &nbsp; &nbsp;\u66ff\u6362\u6210\uff1a &nbsp; highLight($listing-&gt;fields[&#8216;products_name&#8217;],$_GET[&#8216;keyword&#8217;]) &nbsp; 3\uff0c\u7f29\u77ed\u641c\u7d22\u9875\u9762url\u7684\u957f\u5ea6 &nbsp; \u6253\u5f00\u6587\u4ef6\uff1a &nbsp; includes\\templates\\template_default\\sideboxes\\tpl_search.php &nbsp; includes\\templates\\template_default\\sideboxes\\tpl_search_header.php &nbsp; \u6ce8\u91ca\u6389\uff1a$content .= zen_draw_hidden_field(&#8216;search_in_description&#8217;, &#8216;1&#8217;) . zen_hide_session_id(); &nbsp; 4\uff0c\u6253\u5f00\u540e\u53f0Configuration &#8212; SEO URLS \u5728\u2018\u8f93\u5165\u9700\u8981\u4f18\u5316\u7684\u9875\u9762\u2019 \u5c06advanced_search_result\u52a0\u5165\u8fdb\u53bb<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9996\u5148\u4ecb\u7ecd\u4e00\u4e0b\u8fd9\u4e2a\u529f\u80fd\uff1a\u5728\u641c\u7d22\u6846\u8f93\u5165\u5173\u952e\u8bcd\u7684\u65f6\u5019\uff0c\u641c\u7d22\u51fa\u6765\u7684\u7ed3\u679c\u4f1a\u628a\u5339\u914d\u5230\u7684\u5173\u952e\u8bcd\u9ad8\u4eae\u663e\u793a\uff0c\u53ef\u4ee5\u7cbe\u786e\u5339\u914d\uff0c\u4e5f\u53ef\u4ee5\u6a21\u7cca\u5339\u914d\u3002 &nbsp; \u7cbe\u786e\u5339\u914d\uff1a\u4f8b\u5982\u4ea7\u54c1\u540d\u5b57\u662f\u201c\u5927\u718a\u535a\u5ba2\u5b9a\u5236\u5916\u8d38 \u201d\uff0c\u641c\u8fc7\u5173\u952e\u8bcd\u662f\u201czencart\u6a21\u677f\u201d\uff0c\u5c31\u53ef\u4ee5\u641c\u7d22\u5230\u8fd9\u4e2a\u4ea7\u54c1\uff0c\u5982\u679c\u5173\u952e\u8bcd\u662f\u201c\u201c\u5219\u4e0d\u80fd\u641c\u7d22\u5230\u8fd9\u4e2a\u4ea7\u54c1\u3002 &nbsp; \u6a21\u7cca\u5339\u914d\uff08\u5206\u6bb5\u5339\u914d\uff09\uff1a\u4e0a\u9762\u4f8b\u5b50\u4e2d\u901a\u8fc7\u641c\u7d22\u5173\u952e\u8bcd\u201czencart\u6a21\u677f\u201d\u53ef\u4ee5\u641c\u7d22\u4ea7\u54c1\uff0c\u641c\u7d22\u201c \u201d\u3001\u201c\u5916\u8d38\u6a21\u677f\u201d\u3001\u201c\u5927\u718azencart\u6a21\u677f\u201d\u90fd\u662f\u53ef\u4ee5\u641c\u7d22\u5230\u8fd9\u4e2a\u4ea7\u54c1\u7684\u3002 &nbsp; \u5b89\u88c5\u8be6\u89e3\uff1a &nbsp; 1\uff0c\u5728\u6587\u4ef6inlcudes\/functions\/functions_general.php \u4e2d\u52a0\u5165\u4ee5\u4e0b\u51fd\u6570\uff1a &nbsp; &nbsp; &nbsp; &nbsp; function highLight($str, $keywords, $color = &#8220;red&#8221;) { &nbsp;&nbsp; &nbsp; &nbsp; if (empty($keywords)) { &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return $str; &nbsp;&nbsp; &nbsp; &nbsp; } &nbsp;&nbsp; &nbsp; &nbsp; $keywords = split(&#8220;[ \\t\\r\\n,]+&#8221;, $keywords); &nbsp;&nbsp; &nbsp; &nbsp; foreach($keywords as $val) { [&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-60981","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/60981","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=60981"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/60981\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=60981"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=60981"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=60981"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}