{"id":60794,"date":"2025-04-26T08:52:43","date_gmt":"2025-04-26T00:52:43","guid":{"rendered":"https:\/\/fwq.ai\/blog\/60794\/"},"modified":"2025-04-26T08:52:43","modified_gmt":"2025-04-26T00:52:43","slug":"%e7%bb%99zencart%e4%ba%a7%e5%93%81%e6%b7%bb%e5%8a%a0%e4%b8%80%e4%b8%aaproduct_color%e5%ad%97%e6%ae%b5","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/60794\/","title":{"rendered":"\u7ed9ZenCart\u4ea7\u54c1\u6dfb\u52a0\u4e00\u4e2aproduct_color\u5b57\u6bb5"},"content":{"rendered":"<p> \u7ed9ZenCart\u4ea7\u54c1\u6dfb\u52a0\u4e00\u4e2aproduct_color\u5b57\u6bb5,\u9700\u8981\u53c2\u7167\u4ee5\u4e0b\u516d\u4e2a\u6b65\u9aa4\uff1a<br \/> 1\uff0c\u5148\u53bbphpmyadmin\uff0c\u627e\u5230\u4f60ZenCart\u7f51\u7ad9\u7684\u6570\u636e\u5e93\uff0c\u7136\u540e\u627e\u5230products\u8868\uff0c\u7ed9\u8be5\u8868\u6dfb\u52a0\u4e00\u4e2aproduct_color\u5b57\u6bb5\uff0c\u4e0d\u4f1a\u7528sql\u8bed\u53e5\u7684\u53ef\u624b\u52a8\u6dfb\u52a0\u3002<\/p>\n<p> 2\uff0c\u7f16\u8f91\u6587\u4ef6admin\/includes\/modules\/product\/collect_info.php<\/p>\n<p> \u2460\u5728\u6587\u4ef6\u6700\u5f00\u59cb\u6709\u4e00\u4e2a$parameters\u6570\u7ec4\u53c2\u6570\u7684\u5730\u65b9\uff0c\u5c06<\/p>\n<p> &#8216;products_color&#8217; =&gt; &#8221;<\/p>\n<p> \u6dfb\u52a0\u5230\u6700\u540e\u3002<\/p>\n<p> \u2461\u7136\u540e\u7d27\u63a5\u7740\u4e0b\u9762\u6709\u4e00\u4e2a$product\u7684\u6570\u636e\u67e5\u8be2\uff0c\u5c06<\/p>\n<p> p.products_color<\/p>\n<p> \u6dfb\u52a0\u5230from\u524d\u9762\u3002<\/p>\n<p> \u2462\u6700\u540e\u518d\u6dfb\u52a0\u5b57\u6bb5\u8f93\u5165\u6846\uff0c\u5927\u7ea6\u5728450\u884c\u9644\u8fd1\uff0c\u5177\u4f53\u770b\u81ea\u5df1\u6587\u4ef6\u7684\u884c\u6570<\/p>\n<ol>\n<li> &lt;TR&gt; &nbsp;&nbsp;<\/li>\n<li> &lt;TD&nbsp;class=main&gt;Color&lt;\/TD&gt; &nbsp;&nbsp;<\/li>\n<li> &lt;TD&nbsp;class=main&gt;&lt;?php&nbsp;echo&nbsp;zen_draw_separator(&#8216;pixel_trans.gif&#8217;,&nbsp;&#8217;24&#8217;,&nbsp;&#8217;15&#8217;)&nbsp;.&nbsp;&#8216;&nbsp;&#8216;&nbsp;.&nbsp;zen_draw_input_field(&#8216;products_color&#8217;,&nbsp;$pInfo-&gt;products_color,&nbsp;zen_set_field_length(TABLE_PRODUCTS,&nbsp;&#8216;products_color&#8217;));&nbsp;?&gt;&lt;\/TD&gt; &nbsp;&nbsp;<\/li>\n<li> &lt;\/TR&gt;&nbsp;&nbsp;<\/li>\n<\/ol>\n<p> &nbsp;<\/p>\n<p> 3\uff0c\u7f16\u8f91\u6587\u4ef6admin\/includes\/modules\/product\/preview_info.php<\/p>\n<p> \u5728\u6587\u4ef6\u7684\u6700\u5f00\u59cb\uff0c\u627e\u5230$product\u7684\u5b9a\u4e49\uff0c\u7136\u540e\u5728\u8fd9\u6bb5\u8bed\u53e5\u7684form\u94b1\u9762\u6dfb\u52a0\u67e5\u8be2\u5b57\u6bb5<\/p>\n<p> p.products_color<\/p>\n<p> 4\uff0c\u7ee7\u7eed\u7f16\u8f91\u6587\u4ef6admin\/includes\/modules\/update_product.php<\/p>\n<p> \u5728\u6587\u4ef6\u7684\u6700\u5f00\u59cb\uff0c\u627e\u5230$sql_data_array\u53d8\u91cf\u7684\u5b9a\u4e49\uff0c\u7136\u540e\u5728\u8fd9\u6bb5\u8bed\u53e5\u7684\u7ed3\u5c3e\u6dfb\u52a0<\/p>\n<p> &#8216;products_color&#8217; =&gt; zen_db_prepare_input($_POST[&#8216;products_color&#8217;]),<\/p>\n<p> 5\uff0c\u7f16\u8f91\u524d\u53f0\u6587\u4ef6includes\/modules\/pages\/product_info\/main_template_vars.php<\/p>\n<p> \u5728\u6587\u4ef6\u7684\u7b2c41\u884c\uff0c\u627e\u5230$sql\u53d8\u91cf\u7684\u5b9a\u4e49\uff0c\u7136\u540e\u5728\u6574\u6bb5\u8bed\u53e5\u7684from\u524d\u9762\u6dfb\u52a0\u67e5\u8be2\u5b57\u6bb5<\/p>\n<p> p.products_color<\/p>\n<p> 6\uff0c\u7ec8\u4e8e\u5230\u6700\u540e\u4e00\u6b65\u4e86\uff0c\u524d\u53f0\u8c03\u7528\u663e\u793a\u521a\u6dfb\u52a0\u7684\u5b57\u6bb5\u3002<\/p>\n<p> \u5728\u6587\u4ef6includes\/templates\/\u4f60\u7684\u6a21\u677f\/templates\/tpl_product_info_display.php\u4e2d\u4f60\u60f3\u8981\u663e\u793a\u7684\u4f4d\u7f6e\uff0c\u6dfb\u52a0\u5b57\u6bb5<\/p>\n<p> echo $product_info-&gt;fields[&#8216;products_color&#8217;];<\/p>\n<p> &nbsp;<\/p>\n<p> \u5927\u529f\u544a\u6210\uff0c\u89c9\u5f97\u6709\u8da3\u7684\u53ef\u4ee5\u81ea\u5df1\u8bd5\u8bd5\uff0c\u4eb2\u6d4b\u6709\u6548\u54e6\uff0c\u5e76\u6ca1\u6709\u76f2\u76ee\u7684\u8f6c\u8f7d\u3002\u5982\u679c\u6d4b\u8bd5\u8fd8\u6709\u95ee\u9898\u7684\uff0c\u8bf7\u67e5\u770bZenCart\u6839\u76ee\u5f55\u7684logs\u9519\u8bef\u65e5\u5fd7\u8fdb\u884c\u8c03\u8bd5\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7ed9ZenCart\u4ea7\u54c1\u6dfb\u52a0\u4e00\u4e2aproduct_color\u5b57\u6bb5,\u9700\u8981\u53c2\u7167\u4ee5\u4e0b\u516d\u4e2a\u6b65\u9aa4\uff1a 1\uff0c\u5148\u53bbphpmyadmin\uff0c\u627e\u5230\u4f60ZenCart\u7f51\u7ad9\u7684\u6570\u636e\u5e93\uff0c\u7136\u540e\u627e\u5230products\u8868\uff0c\u7ed9\u8be5\u8868\u6dfb\u52a0\u4e00\u4e2aproduct_color\u5b57\u6bb5\uff0c\u4e0d\u4f1a\u7528sql\u8bed\u53e5\u7684\u53ef\u624b\u52a8\u6dfb\u52a0\u3002 2\uff0c\u7f16\u8f91\u6587\u4ef6admin\/includes\/modules\/product\/collect_info.php \u2460\u5728\u6587\u4ef6\u6700\u5f00\u59cb\u6709\u4e00\u4e2a$parameters\u6570\u7ec4\u53c2\u6570\u7684\u5730\u65b9\uff0c\u5c06 &#8216;products_color&#8217; =&gt; &#8221; \u6dfb\u52a0\u5230\u6700\u540e\u3002 \u2461\u7136\u540e\u7d27\u63a5\u7740\u4e0b\u9762\u6709\u4e00\u4e2a$product\u7684\u6570\u636e\u67e5\u8be2\uff0c\u5c06 p.products_color \u6dfb\u52a0\u5230from\u524d\u9762\u3002 \u2462\u6700\u540e\u518d\u6dfb\u52a0\u5b57\u6bb5\u8f93\u5165\u6846\uff0c\u5927\u7ea6\u5728450\u884c\u9644\u8fd1\uff0c\u5177\u4f53\u770b\u81ea\u5df1\u6587\u4ef6\u7684\u884c\u6570 &lt;TR&gt; &nbsp;&nbsp; &lt;TD&nbsp;class=main&gt;Color&lt;\/TD&gt; &nbsp;&nbsp; &lt;TD&nbsp;class=main&gt;&lt;?php&nbsp;echo&nbsp;zen_draw_separator(&#8216;pixel_trans.gif&#8217;,&nbsp;&#8217;24&#8217;,&nbsp;&#8217;15&#8217;)&nbsp;.&nbsp;&#8216;&nbsp;&#8216;&nbsp;.&nbsp;zen_draw_input_field(&#8216;products_color&#8217;,&nbsp;$pInfo-&gt;products_color,&nbsp;zen_set_field_length(TABLE_PRODUCTS,&nbsp;&#8216;products_color&#8217;));&nbsp;?&gt;&lt;\/TD&gt; &nbsp;&nbsp; &lt;\/TR&gt;&nbsp;&nbsp; &nbsp; 3\uff0c\u7f16\u8f91\u6587\u4ef6admin\/includes\/modules\/product\/preview_info.php \u5728\u6587\u4ef6\u7684\u6700\u5f00\u59cb\uff0c\u627e\u5230$product\u7684\u5b9a\u4e49\uff0c\u7136\u540e\u5728\u8fd9\u6bb5\u8bed\u53e5\u7684form\u94b1\u9762\u6dfb\u52a0\u67e5\u8be2\u5b57\u6bb5 p.products_color 4\uff0c\u7ee7\u7eed\u7f16\u8f91\u6587\u4ef6admin\/includes\/modules\/update_product.php \u5728\u6587\u4ef6\u7684\u6700\u5f00\u59cb\uff0c\u627e\u5230$sql_data_array\u53d8\u91cf\u7684\u5b9a\u4e49\uff0c\u7136\u540e\u5728\u8fd9\u6bb5\u8bed\u53e5\u7684\u7ed3\u5c3e\u6dfb\u52a0 &#8216;products_color&#8217; =&gt; zen_db_prepare_input($_POST[&#8216;products_color&#8217;]), 5\uff0c\u7f16\u8f91\u524d\u53f0\u6587\u4ef6includes\/modules\/pages\/product_info\/main_template_vars.php \u5728\u6587\u4ef6\u7684\u7b2c41\u884c\uff0c\u627e\u5230$sql\u53d8\u91cf\u7684\u5b9a\u4e49\uff0c\u7136\u540e\u5728\u6574\u6bb5\u8bed\u53e5\u7684from\u524d\u9762\u6dfb\u52a0\u67e5\u8be2\u5b57\u6bb5 p.products_color 6\uff0c\u7ec8\u4e8e\u5230\u6700\u540e\u4e00\u6b65\u4e86\uff0c\u524d\u53f0\u8c03\u7528\u663e\u793a\u521a\u6dfb\u52a0\u7684\u5b57\u6bb5\u3002 \u5728\u6587\u4ef6includes\/templates\/\u4f60\u7684\u6a21\u677f\/templates\/tpl_product_info_display.php\u4e2d\u4f60\u60f3\u8981\u663e\u793a\u7684\u4f4d\u7f6e\uff0c\u6dfb\u52a0\u5b57\u6bb5 echo $product_info-&gt;fields[&#8216;products_color&#8217;]; &nbsp; \u5927\u529f\u544a\u6210\uff0c\u89c9\u5f97\u6709\u8da3\u7684\u53ef\u4ee5\u81ea\u5df1\u8bd5\u8bd5\uff0c\u4eb2\u6d4b\u6709\u6548\u54e6\uff0c\u5e76\u6ca1\u6709\u76f2\u76ee\u7684\u8f6c\u8f7d\u3002\u5982\u679c\u6d4b\u8bd5\u8fd8\u6709\u95ee\u9898\u7684\uff0c\u8bf7\u67e5\u770bZenCart\u6839\u76ee\u5f55\u7684logs\u9519\u8bef\u65e5\u5fd7\u8fdb\u884c\u8c03\u8bd5\uff01<\/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-60794","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/60794","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=60794"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/60794\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=60794"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=60794"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=60794"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}