{"id":60814,"date":"2025-04-26T10:15:05","date_gmt":"2025-04-26T02:15:05","guid":{"rendered":"https:\/\/fwq.ai\/blog\/60814\/"},"modified":"2025-04-26T10:15:05","modified_gmt":"2025-04-26T02:15:05","slug":"zencart%e9%a6%96%e9%a1%b5%e6%8c%87%e5%ae%9a%e6%98%be%e7%a4%ba%e6%9f%90%e4%b8%aa%e5%88%86%e7%b1%bb%e4%b8%8b%e9%9d%a2%e7%9a%84%e4%ba%a7%e5%93%81","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/60814\/","title":{"rendered":"ZenCart\u9996\u9875\u6307\u5b9a\u663e\u793a\u67d0\u4e2a\u5206\u7c7b\u4e0b\u9762\u7684\u4ea7\u54c1"},"content":{"rendered":"<p> ZenCartt\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u9996\u9875\u663e\u793a\u7684\u65b0\u8fdb\u4ea7\u54c1\u662f\u968f\u673a\u83b7\u53d6\u6240\u6709\u6700\u8fd1\u6dfb\u52a0\u7684\u4ea7\u54c1\u3002\u6709\u65f6\u5019\u4e0d\u60f3\u5728\u6240\u6709\u7684\u5206\u7c7b\u91cc\u9762\u83b7\u53d6\u8fd9\u4e9b\u6700\u65b0\u4ea7\u54c1\uff0c\u800c\u662f\u6307\u5b9a\u5728\u67d0\u4e9b\u5206\u7c7b\u4e0b\u9762\u3002\u5206\u4eab\u4e00\u4e0b\u8fd9\u4e2a\u4fee\u6539\u65b9\u6cd5\u3002<\/p>\n<p> \u9996\u5148\u6253\u5f00includesmodulesnew_products.php \u8fd9\u4e2a\u6a21\u5757\u6587\u4ef6\u5c31\u662f\u9996\u9875\u8c03\u7528\u7684\u65b0\u8fdb\u4ea7\u54c1\u6a21\u5757\u3002\u8981\u60f3\u5b9e\u73b0\u8fd9\u4e2a\u529f\u80fd\uff0c\u53ea\u8981\u4fee\u6539$new_products_query \u8fd9\u4e2a\u53d8\u91cf\uff0c\u8fd9\u4e2a\u662f\u67e5\u8be2\u6700\u65b0\u4ea7\u54c1\u7684SQL\u8bed\u53e5\u3002<\/p>\n<p> \u770b\u4e0b\u9762\u8fd9\u6bb5\u4ee3\u7801\uff1a<\/p>\n<p> &nbsp;<\/p>\n<p> if ( (($manufacturers_id &gt; 0 &amp;&amp; $_GET[&#8216;filter_id&#8217;] == 0) || $_GET[&#8216;music_genre_id&#8217;] &gt; 0 || $_GET[&#8216;record_company_id&#8217;] &gt; 0) || (!isset($new_products_category_id) || $new_products_category_id == \u20190\u2032) ) {<br \/> $new_products_query = \u201cselect distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name,<br \/> p.products_date_added, p.products_price, p.products_type, p.master_categories_id<br \/> from \u201d . TABLE_PRODUCTS . \u201d p, \u201d . TABLE_PRODUCTS_DESCRIPTION . \u201d pd<br \/> where p.products_id = pd.products_id<br \/> and pd.language_id = \u2018\u201d . (int)$_SESSION[&#8216;languages_id&#8217;] . \u201c\u2018<br \/> and p.products_status = 1 \u201d . $display_limit;<br \/> } else {<br \/> \/\/ get all products and cPaths in this subcat tree<br \/> $productsInCategory = zen_get_categories_products_list( (($manufacturers_id &gt; 0 &amp;&amp; $_GET[&#8216;filter_id&#8217;] &gt; 0) ? zen_get_generated_category_path_rev($_GET[&#8216;filter_id&#8217;]) : $cPath), false, true, 0, $display_limit);<\/p>\n<p> if (is_array($productsInCategory) &amp;&amp; sizeof($productsInCategory) &gt; 0) {<br \/> \/\/ build products-list string to insert into SQL query<br \/> foreach($productsInCategory as $key =&gt; $value) {<br \/> $list_of_products .= $key . \u2018, \u2018;<br \/> }<br \/> $list_of_products = substr($list_of_products, 0, -2); \/\/ remove trailing comma<\/p>\n<p> $new_products_query = \u201cselect distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name,<br \/> p.products_date_added, p.products_price, p.products_type, p.master_categories_id<br \/> from \u201d . TABLE_PRODUCTS . \u201d p, \u201d . TABLE_PRODUCTS_DESCRIPTION . \u201d pd<br \/> where p.products_id = pd.products_id<br \/> and pd.language_id = \u2018\u201d . (int)$_SESSION[&#8216;languages_id&#8217;] . \u201c\u2018<br \/> and p.products_status = 1<br \/> and p.products_id in (\u201d . $list_of_products . \u201c)\u201d;<br \/> }<br \/> }<\/p>\n<p> \u4fee\u6539\u6210\u5982\u4e0b:<\/p>\n<p> $filter_cate=\u201d;<\/p>\n<p> $cate_IDS=\u201d22\u2033;\/\/\/\u8981\u663e\u793a\u7684\u5206\u7c7bID\uff0c\u5982\u679c\u6709\u7236\u5206\u7c7b\uff0c\u8bf7\u8f93\u5165\u5b50\u5206\u7c7b\u7684ID<br \/> if($this_is_home_page){<br \/> $filter_cate=\u201d and p.master_categories_id in($cate_IDS) \u201c;<br \/> }<br \/> if ( (($manufacturers_id &gt; 0 &amp;&amp; $_GET[&#8216;filter_id&#8217;] == 0) || $_GET[&#8216;music_genre_id&#8217;] &gt; 0 || $_GET[&#8216;record_company_id&#8217;] &gt; 0) || (!isset($new_products_category_id) || $new_products_category_id == \u20190\u2032) ) {<br \/> $new_products_query = \u201cselect distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name,<br \/> p.products_date_added, p.products_price, p.products_type, p.master_categories_id<br \/> from \u201d . TABLE_PRODUCTS . \u201d p, \u201d . TABLE_PRODUCTS_DESCRIPTION . \u201d pd<br \/> where p.products_id = pd.products_id<br \/> and pd.language_id = \u2018\u201d . (int)$_SESSION[&#8216;languages_id&#8217;] . \u201c\u2018<br \/> and p.products_status = 1 \u201d . $display_limit.$filter_cate;\/\/\/\u6dfb\u52a0\u5230SQL\u8bed\u53e5\u540e\u9762<br \/> } else {<br \/> \/\/ get all products and cPaths in this subcat tree<br \/> $productsInCategory = zen_get_categories_products_list( (($manufacturers_id &gt; 0 &amp;&amp; $_GET[&#8216;filter_id&#8217;] &gt; 0) ? zen_get_generated_category_path_rev($_GET[&#8216;filter_id&#8217;]) : $cPath), false, true, 0, $display_limit);<\/p>\n<p> if (is_array($productsInCategory) &amp;&amp; sizeof($productsInCategory) &gt; 0) {<br \/> \/\/ build products-list string to insert into SQL query<br \/> foreach($productsInCategory as $key =&gt; $value) {<br \/> $list_of_products .= $key . \u2018, \u2018;<br \/> }<br \/> $list_of_products = substr($list_of_products, 0, -2); \/\/ remove trailing comma<\/p>\n<p> $new_products_query = \u201cselect distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name,<br \/> p.products_date_added, p.products_price, p.products_type, p.master_categories_id<br \/> from \u201d . TABLE_PRODUCTS . \u201d p, \u201d . TABLE_PRODUCTS_DESCRIPTION . \u201d pd<br \/> where p.products_id = pd.products_id<br \/> and pd.language_id = \u2018\u201d . (int)$_SESSION[&#8216;languages_id&#8217;] . \u201c\u2018<br \/> and p.products_status = 1<br \/> and p.products_id in (\u201d . $list_of_products . \u201c)\u201d.$filter_cate;\/\/\/\u6dfb\u52a0\u5230SQL\u8bed\u53e5\u540e\u9762<br \/> }<br \/> }<\/p>\n","protected":false},"excerpt":{"rendered":"<p>ZenCartt\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u9996\u9875\u663e\u793a\u7684\u65b0\u8fdb\u4ea7\u54c1\u662f\u968f\u673a\u83b7\u53d6\u6240\u6709\u6700\u8fd1\u6dfb\u52a0\u7684\u4ea7\u54c1\u3002\u6709\u65f6\u5019\u4e0d\u60f3\u5728\u6240\u6709\u7684\u5206\u7c7b\u91cc\u9762\u83b7\u53d6\u8fd9\u4e9b\u6700\u65b0\u4ea7\u54c1\uff0c\u800c\u662f\u6307\u5b9a\u5728\u67d0\u4e9b\u5206\u7c7b\u4e0b\u9762\u3002\u5206\u4eab\u4e00\u4e0b\u8fd9\u4e2a\u4fee\u6539\u65b9\u6cd5\u3002 \u9996\u5148\u6253\u5f00includesmodulesnew_products.php \u8fd9\u4e2a\u6a21\u5757\u6587\u4ef6\u5c31\u662f\u9996\u9875\u8c03\u7528\u7684\u65b0\u8fdb\u4ea7\u54c1\u6a21\u5757\u3002\u8981\u60f3\u5b9e\u73b0\u8fd9\u4e2a\u529f\u80fd\uff0c\u53ea\u8981\u4fee\u6539$new_products_query \u8fd9\u4e2a\u53d8\u91cf\uff0c\u8fd9\u4e2a\u662f\u67e5\u8be2\u6700\u65b0\u4ea7\u54c1\u7684SQL\u8bed\u53e5\u3002 \u770b\u4e0b\u9762\u8fd9\u6bb5\u4ee3\u7801\uff1a &nbsp; if ( (($manufacturers_id &gt; 0 &amp;&amp; $_GET[&#8216;filter_id&#8217;] == 0) || $_GET[&#8216;music_genre_id&#8217;] &gt; 0 || $_GET[&#8216;record_company_id&#8217;] &gt; 0) || (!isset($new_products_category_id) || $new_products_category_id == \u20190\u2032) ) { $new_products_query = \u201cselect distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, p.products_date_added, p.products_price, p.products_type, p.master_categories_id from \u201d . TABLE_PRODUCTS . \u201d p, \u201d . TABLE_PRODUCTS_DESCRIPTION . \u201d [&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-60814","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/60814","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=60814"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/60814\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=60814"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=60814"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=60814"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}