{"id":61000,"date":"2025-04-26T10:59:57","date_gmt":"2025-04-26T02:59:57","guid":{"rendered":"https:\/\/fwq.ai\/blog\/61000\/"},"modified":"2025-04-26T10:59:57","modified_gmt":"2025-04-26T02:59:57","slug":"%e6%89%b9%e9%87%8f%e6%81%a2%e5%a4%8dzencart%e4%ba%a7%e5%93%81%e8%a1%a8%e6%89%80%e5%b1%9e%e5%88%86%e7%b1%bbmaster_categories_id%e4%b8%ba","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/61000\/","title":{"rendered":"\u6279\u91cf\u6062\u590dzencart\u4ea7\u54c1\u8868\u6240\u5c5e\u5206\u7c7bmaster_categories_id\u4e3a"},"content":{"rendered":"<p> \u5c06\u4e0b\u9762\u4ee3\u7801\u4fdd\u5b58\u4e3amaster_categories_id.php\uff0c\u4e0a\u4f20\u5230\u7f51\u7ad9\u6839\u76ee\u5f55\u8fd0\u884c\u5373\u53ef\uff0c\u64cd\u4f5c\u524d\u5148\u5907\u4efd\u6570\u636e\u5e93<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.ldhost.cn\/helphmb\/uploads\/allimg\/c160110\/14523AMK2010-324N.gif\" class=\"aligncenter\" title=\"\u6279\u91cf\u6062\u590dzencart\u4ea7\u54c1\u8868\u6240\u5c5e\u5206\u7c7bmaster_categories_id\u4e3a\u63d2\u56fe\" alt=\"\u6279\u91cf\u6062\u590dzencart\u4ea7\u54c1\u8868\u6240\u5c5e\u5206\u7c7bmaster_categories_id\u4e3a\u63d2\u56fe\" \/>  <\/p>\n<pre>\r\n&lt;?php\r\nheader(\"content-Type: text\/html; charset=utf-8\"); \r\n\/***\r\n\u6279\u91cf\u6062\u590dzencart\u4ea7\u54c1\u8868master_categories_id\u4e3a0\u7684\u4ea7\u54c1\r\n***\/\r\nrequire('includes\/application_top.php');\r\necho '\u6b63\u5728\u5904\u7406...';\r\n$products_query = \"select products_id from \" . TABLE_PRODUCTS . \" where master_categories_id = '0' order by products_id\";\r\n$products = $db-&gt;Execute($products_query);\r\n$id_array = array();\r\nwhile(!$products-&gt;EOF){\r\n    $id_array[] = $products-&gt;fields['products_id'];\r\n    $products-&gt;MoveNext();     \r\n}\r\n\r\nforeach($id_array as $val){\r\n    $categories_id = $db-&gt;Execute(\"select categories_id from \" . TABLE_PRODUCTS_TO_CATEGORIES . \" where products_id = '\".(int)$val.\"' limit 0,1\");\r\n    if($categories_id-&gt;fields['categories_id']){        \r\n        $products=$db-&gt;Execute(\"update \" . TABLE_PRODUCTS . \" set master_categories_id = '\" .$categories_id-&gt;fields['categories_id']. \"' where products_id = \" . (int)$val);\r\n    }\r\n}\r\necho 'OK!\u5904\u7406\u5b8c\u6bd5';\r\nrequire(DIR_WS_INCLUDES . 'application_bottom.php');\r\n?&gt;<\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.ldhost.cn\/helphmb\/uploads\/allimg\/c160110\/14523AMK2010-324N.gif\" class=\"aligncenter\" title=\"\u6279\u91cf\u6062\u590dzencart\u4ea7\u54c1\u8868\u6240\u5c5e\u5206\u7c7bmaster_categories_id\u4e3a\u63d2\u56fe\" alt=\"\u6279\u91cf\u6062\u590dzencart\u4ea7\u54c1\u8868\u6240\u5c5e\u5206\u7c7bmaster_categories_id\u4e3a\u63d2\u56fe\" \/><br \/>\n <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5c06\u4e0b\u9762\u4ee3\u7801\u4fdd\u5b58\u4e3amaster_categories_id.php\uff0c\u4e0a\u4f20\u5230\u7f51\u7ad9\u6839\u76ee\u5f55\u8fd0\u884c\u5373\u53ef\uff0c\u64cd\u4f5c\u524d\u5148\u5907\u4efd\u6570\u636e\u5e93 &lt;?php header(&#8220;content-Type: text\/html; charset=utf-8&#8221;); \/*** \u6279\u91cf\u6062\u590dzencart\u4ea7\u54c1\u8868master_categories_id\u4e3a0\u7684\u4ea7\u54c1 ***\/ require(&#8216;includes\/application_top.php&#8217;); echo &#8216;\u6b63\u5728\u5904\u7406&#8230;&#8217;; $products_query = &#8220;select products_id from &#8221; . TABLE_PRODUCTS . &#8221; where master_categories_id = &#8216;0&#8217; order by products_id&#8221;; $products = $db-&gt;Execute($products_query); $id_array = array(); while(!$products-&gt;EOF){ $id_array[] = $products-&gt;fields[&#8216;products_id&#8217;]; $products-&gt;MoveNext(); } foreach($id_array as $val){ $categories_id = $db-&gt;Execute(&#8220;select categories_id from &#8221; . TABLE_PRODUCTS_TO_CATEGORIES . &#8221; where products_id [&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-61000","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/61000","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=61000"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/61000\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=61000"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=61000"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=61000"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}