{"id":60722,"date":"2025-04-26T12:04:45","date_gmt":"2025-04-26T04:04:45","guid":{"rendered":"https:\/\/fwq.ai\/blog\/60722\/"},"modified":"2025-04-26T12:04:45","modified_gmt":"2025-04-26T04:04:45","slug":"zencart%e6%89%b9%e9%87%8f%e6%8f%92%e5%85%a5text%e6%96%87%e6%9c%ac%e5%b1%9e%e6%80%a7attributes","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/60722\/","title":{"rendered":"zencart\u6279\u91cf\u63d2\u5165TEXT\u6587\u672c\u5c5e\u6027attributes"},"content":{"rendered":"<p style=\"margin: 10px auto;padding: 0px;font-family: Tahoma, Verdana, Arial;font-size: 14px;line-height: 25.2000007629395px\"> \u6709\u65f6\u5019\u4e0a\u4f20\u7684\u4ea7\u54c1\u4e0e\u591a\u7ea7\u5206\u7c7b\u6bd4\u8f83\u591a\uff0c\u5728\u540e\u53f0\u6dfb\u52a0\u6587\u672c\u5c5e\u6027\u5982Name\uff0cNumber\u7b49\u9700\u8981\u987e\u5ba2\u81ea\u5b9a\u4e49\u7684\u5185\u5bb9\u5c31\u6bd4\u8f83\u8d39\u795e\u4e86\u3002\u73b0\u5728\u53ea\u9700\u5c06\u4ee5\u4e0b\u4ee3\u7801\u4fdd\u5b58\u4e3ainsert_attributes.php\uff0c\u53d8\u91cf$options_id_array\uff0c$current_category_id\u4fee\u6539\u4e3a\u5b9e\u9645\u7684\u503c\uff0c\u4e0a\u4f20\u5230\u7f51\u7ad9\u6839\u76ee\u5f55\u8fd0\u884c\u5373\u53ef\u4e00\u6b65\u5230\u4f4d\u3002<\/p>\n<p><span style=\"margin: 0px;padding: 0px 5px 0px 0px;line-height: 1.8\"><img decoding=\"async\" src=\"https:\/\/www.ldhost.cn\/helphmb\/uploads\/allimg\/141205\/11362512S-0.gif\" style=\"margin: 0px;padding: 0px;border: none !important\" class=\"aligncenter\" title=\"zencart\u6279\u91cf\u63d2\u5165TEXT\u6587\u672c\u5c5e\u6027attributes\u63d2\u56fe\" alt=\"zencart\u6279\u91cf\u63d2\u5165TEXT\u6587\u672c\u5c5e\u6027attributes\u63d2\u56fe\" \/><\/span>  <\/p>\n<pre>\r\n&lt;?<span style=\"margin: 0px;padding: 0px;line-height: 1.8\">php\r\n<\/span><span style=\"margin: 0px;padding: 0px;line-height: 1.8\">\/\/<\/span><span style=\"margin: 0px;padding: 0px;line-height: 1.8\">header(\"content-Type: text\/html; charset=utf-8\"); <\/span>\r\n@<span style=\"margin: 0px;padding: 0px;line-height: 1.8\">set_time_limit<\/span>(1800<span style=\"margin: 0px;padding: 0px;line-height: 1.8\">);\r\n@<\/span><span style=\"margin: 0px;padding: 0px;line-height: 1.8\">ini_set<\/span>('memory_limit','100M'<span style=\"margin: 0px;padding: 0px;line-height: 1.8\">);\r\n<\/span><span style=\"margin: 0px;padding: 0px;line-height: 1.8\">require<\/span>('includes\/application_top.php'<span style=\"margin: 0px;padding: 0px;line-height: 1.8\">);\r\n<\/span><span style=\"margin: 0px;padding: 0px;line-height: 1.8\">$options_id_array<\/span> = <span style=\"margin: 0px;padding: 0px;line-height: 1.8\">array<\/span>(2,3); <span style=\"margin: 0px;padding: 0px;line-height: 1.8\">\/\/<\/span><span style=\"margin: 0px;padding: 0px;line-height: 1.8\">\u6587\u672c\u5c5e\u6027\u5bf9\u5e94\u7684ID\u6570\u7ec4<\/span>\r\n<span style=\"margin: 0px;padding: 0px;line-height: 1.8\">$current_category_id<\/span> = 99; <span style=\"margin: 0px;padding: 0px;line-height: 1.8\">\/\/<\/span><span style=\"margin: 0px;padding: 0px;line-height: 1.8\">\u8981\u6279\u91cf\u8bbe\u7f6e\u6587\u672c\u5c5e\u6027\u7684\u4ea7\u54c1\u5206\u7c7bID<\/span>\r\n\r\n<span style=\"margin: 0px;padding: 0px;line-height: 1.8\">$categories_products_list<\/span> = zen_get_categories_products_list(<span style=\"margin: 0px;padding: 0px;line-height: 1.8\">$current_category_id<\/span><span style=\"margin: 0px;padding: 0px;line-height: 1.8\">);\r\n<\/span><span style=\"margin: 0px;padding: 0px;line-height: 1.8\">$plist_array<\/span> = <span style=\"margin: 0px;padding: 0px;line-height: 1.8\">array<\/span><span style=\"margin: 0px;padding: 0px;line-height: 1.8\">();\r\n<\/span><span style=\"margin: 0px;padding: 0px;line-height: 1.8\">foreach<\/span>(<span style=\"margin: 0px;padding: 0px;line-height: 1.8\">$categories_products_list<\/span> <span style=\"margin: 0px;padding: 0px;line-height: 1.8\">as<\/span> <span style=\"margin: 0px;padding: 0px;line-height: 1.8\">$key<\/span> =&gt; <span style=\"margin: 0px;padding: 0px;line-height: 1.8\">$value<\/span><span style=\"margin: 0px;padding: 0px;line-height: 1.8\">){\r\n    <\/span><span style=\"margin: 0px;padding: 0px;line-height: 1.8\">$plist_array<\/span>[] = <span style=\"margin: 0px;padding: 0px;line-height: 1.8\">$key<\/span><span style=\"margin: 0px;padding: 0px;line-height: 1.8\">;\r\n}\r\n<\/span><span style=\"margin: 0px;padding: 0px;line-height: 1.8\">\/\/<\/span><span style=\"margin: 0px;padding: 0px;line-height: 1.8\">print_r($plist_array);<\/span>\r\n\r\n<span style=\"margin: 0px;padding: 0px;line-height: 1.8\">foreach<\/span>(<span style=\"margin: 0px;padding: 0px;line-height: 1.8\">$plist_array<\/span> <span style=\"margin: 0px;padding: 0px;line-height: 1.8\">as<\/span> <span style=\"margin: 0px;padding: 0px;line-height: 1.8\">$pid<\/span><span style=\"margin: 0px;padding: 0px;line-height: 1.8\">){    \r\n    <\/span><span style=\"margin: 0px;padding: 0px;line-height: 1.8\">foreach<\/span>(<span style=\"margin: 0px;padding: 0px;line-height: 1.8\">$options_id_array<\/span> <span style=\"margin: 0px;padding: 0px;line-height: 1.8\">as<\/span> <span style=\"margin: 0px;padding: 0px;line-height: 1.8\">$optid<\/span><span style=\"margin: 0px;padding: 0px;line-height: 1.8\">){\r\n        <\/span><span style=\"margin: 0px;padding: 0px;line-height: 1.8\">$db<\/span>-&gt;Execute(\"insert into \" . TABLE_PRODUCTS_ATTRIBUTES . \" (products_id, options_id, options_values_id, options_values_price, price_prefix, product_attribute_is_free, products_attributes_weight_prefix, attributes_display_only, attributes_default, attributes_discounted) values('\" . (int)<span style=\"margin: 0px;padding: 0px;line-height: 1.8\">$pid<\/span> . \"', '\" . (int)<span style=\"margin: 0px;padding: 0px;line-height: 1.8\">$optid<\/span> . \"', 0, '0.0000', '+', '1', '+', 0, 0, '1')\"<span style=\"margin: 0px;padding: 0px;line-height: 1.8\">);\r\n    }\r\n}\r\n\r\n<\/span><span style=\"margin: 0px;padding: 0px;line-height: 1.8\">echo<\/span> '&lt;center style=\"color:#009900; font-size:14px;padding-top:50px;\"&gt;Insert Attributes Success!&lt;\/center&gt;'<span style=\"margin: 0px;padding: 0px;line-height: 1.8\">;\r\n\r\n<\/span><span style=\"margin: 0px;padding: 0px;line-height: 1.8\">require<\/span>(DIR_WS_INCLUDES . 'application_bottom.php'<span style=\"margin: 0px;padding: 0px;line-height: 1.8\">);\r\n<\/span>?&gt;<\/pre>\n<p><span style=\"margin: 0px;padding: 0px 5px 0px 0px;line-height: 1.8\"><img decoding=\"async\" src=\"https:\/\/www.ldhost.cn\/helphmb\/uploads\/allimg\/141205\/11362512S-0.gif\" style=\"margin: 0px;padding: 0px;border: none !important\" class=\"aligncenter\" title=\"zencart\u6279\u91cf\u63d2\u5165TEXT\u6587\u672c\u5c5e\u6027attributes\u63d2\u56fe\" alt=\"zencart\u6279\u91cf\u63d2\u5165TEXT\u6587\u672c\u5c5e\u6027attributes\u63d2\u56fe\" \/><\/span>   <\/p>\n<p style=\"margin: 10px auto;padding: 0px;font-family: Tahoma, Verdana, Arial;font-size: 14px;line-height: 25.2000007629395px\"> \u6253\u5b8c\u6536\u5de5\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6709\u65f6\u5019\u4e0a\u4f20\u7684\u4ea7\u54c1\u4e0e\u591a\u7ea7\u5206\u7c7b\u6bd4\u8f83\u591a\uff0c\u5728\u540e\u53f0\u6dfb\u52a0\u6587\u672c\u5c5e\u6027\u5982Name\uff0cNumber\u7b49\u9700\u8981\u987e\u5ba2\u81ea\u5b9a\u4e49\u7684\u5185\u5bb9\u5c31\u6bd4\u8f83\u8d39\u795e\u4e86\u3002\u73b0\u5728\u53ea\u9700\u5c06\u4ee5\u4e0b\u4ee3\u7801\u4fdd\u5b58\u4e3ainsert_attributes.php\uff0c\u53d8\u91cf$options_id_array\uff0c$current_category_id\u4fee\u6539\u4e3a\u5b9e\u9645\u7684\u503c\uff0c\u4e0a\u4f20\u5230\u7f51\u7ad9\u6839\u76ee\u5f55\u8fd0\u884c\u5373\u53ef\u4e00\u6b65\u5230\u4f4d\u3002 &lt;?php \/\/header(&#8220;content-Type: text\/html; charset=utf-8&#8221;); @set_time_limit(1800); @ini_set(&#8216;memory_limit&#8217;,&#8217;100M&#8217;); require(&#8216;includes\/application_top.php&#8217;); $options_id_array = array(2,3); \/\/\u6587\u672c\u5c5e\u6027\u5bf9\u5e94\u7684ID\u6570\u7ec4 $current_category_id = 99; \/\/\u8981\u6279\u91cf\u8bbe\u7f6e\u6587\u672c\u5c5e\u6027\u7684\u4ea7\u54c1\u5206\u7c7bID $categories_products_list = zen_get_categories_products_list($current_category_id); $plist_array = array(); foreach($categories_products_list as $key =&gt; $value){ $plist_array[] = $key; } \/\/print_r($plist_array); foreach($plist_array as $pid){ foreach($options_id_array as $optid){ $db-&gt;Execute(&#8220;insert into &#8221; . TABLE_PRODUCTS_ATTRIBUTES . &#8221; (products_id, options_id, options_values_id, options_values_price, price_prefix, product_attribute_is_free, products_attributes_weight_prefix, attributes_display_only, attributes_default, attributes_discounted) [&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-60722","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/60722","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=60722"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/60722\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=60722"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=60722"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=60722"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}