{"id":60907,"date":"2025-04-26T11:31:59","date_gmt":"2025-04-26T03:31:59","guid":{"rendered":"https:\/\/fwq.ai\/blog\/60907\/"},"modified":"2025-04-26T11:31:59","modified_gmt":"2025-04-26T03:31:59","slug":"%e7%bb%99zencart%e4%ba%a7%e5%93%81%e5%88%97%e8%a1%a8%e9%a1%b5%e5%92%8c%e4%ba%a7%e5%93%81%e9%a1%b5%e9%9d%a2%e6%b7%bb%e5%8a%a0%e8%af%84%e8%ae%ba%e6%98%9f%e6%98%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/60907\/","title":{"rendered":"\u7ed9ZenCart\u4ea7\u54c1\u5217\u8868\u9875\u548c\u4ea7\u54c1\u9875\u9762\u6dfb\u52a0\u8bc4\u8bba\u661f\u661f"},"content":{"rendered":"<p> 1\uff0c\u7ed9ZenCart\u4ea7\u54c1\u5217\u8868\u9875\u9762\u7684\u4ea7\u54c1\u6dfb\u52a0\u8bc4\u8bba\u5c0f\u661f\u661f<\/p>\n<p> \u6253\u5f00\u6587\u4ef6includes\\modules\\\u4f60\u7684\u6a21\u677f\\product_listing.php<\/p>\n<p>   &nbsp;  <\/p>\n<ol>\n<li> $lc_text&nbsp;.=&nbsp;&#8221;&nbsp;.&nbsp;(zen_get_show_product_switch($listing-&gt;fields[&#8216;products_id&#8217;],&nbsp;&#8216;ALWAYS_FREE_SHIPPING_IMAGE_SWITCH&#8217;)&nbsp;?&nbsp;(zen_get_product_is_always_free_shipping($listing-&gt;fields[&#8216;products_id&#8217;])&nbsp;?&nbsp;TEXT_PRODUCT_FREE_SHIPPING_ICON&nbsp;.&nbsp;&#8216;&lt;br&nbsp;\/&gt;&#8217;&nbsp;:&nbsp;&#8221;)&nbsp;:&nbsp;&#8221;)&nbsp;&nbsp;<\/li>\n<\/ol>\n<p> &nbsp;<\/p>\n<p> #\u524d\u9762\u4e00\u884c\u63d2\u5165<\/p>\n<p>   &nbsp;  <\/p>\n<ol>\n<li> \/\/\u663e\u793a\u8bc4\u8bba\u661f\u661fstart&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/li>\n<li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$count_stars_query&nbsp;=&nbsp;&#8220;select&nbsp;count(reviews_rating)&nbsp;as&nbsp;num,&nbsp;avg(reviews_rating)&nbsp;as&nbsp;aver&nbsp;&nbsp;from&nbsp;&#8221;&nbsp;.&nbsp;TABLE_REVIEWS&nbsp;.&nbsp;&#8221;&nbsp;where&nbsp;products_id&nbsp;=&nbsp;&#8216;&#8221;&nbsp;.&nbsp;(int)$listing-&gt;fields[&#8216;products_id&#8217;]&nbsp;.&nbsp;&#8220;&#8216;&#8221;; &nbsp;&nbsp;<\/li>\n<li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$count_stars&nbsp;=&nbsp;$db-&gt;Execute($count_stars_query); &nbsp;&nbsp;<\/li>\n<li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$starnum&nbsp;=&nbsp;round($count_stars-&gt;fields[&#8216;aver&#8217;]); &nbsp;&nbsp;<\/li>\n<li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$star&nbsp;=&nbsp;array(&#8220;stars_1.gif&#8221;,&#8221;stars_2.gif&#8221;,&#8221;stars_3.gif&#8221;,&#8221;stars_4.gif&#8221;,&#8221;stars_5.gif&#8221;); &nbsp;&nbsp;<\/li>\n<li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if($count_stars-&gt;fields[&#8216;num&#8217;]&gt;=1){ &nbsp;&nbsp;<\/li>\n<li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$reviews_display&nbsp;='&lt;div&nbsp;class=&#8221;listreviews&#8221;&gt;&lt;img&nbsp;src=&#8221;includes\/templates\/\u4f60\u7684\u6a21\u677f\/images\/&#8217;.&nbsp;$star[$starnum-1]&nbsp;.'&#8221;&nbsp;\/&gt;(&#8216;.$count_stars-&gt;fields[&#8216;num&#8217;].&#8217;)&lt;\/div&gt;&#8217;; &nbsp;&nbsp;<\/li>\n<li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}else{ &nbsp;&nbsp;<\/li>\n<li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$reviews_display&nbsp;='&lt;div&nbsp;class=&#8221;listreviews&#8221;&gt;&lt;img&nbsp;src=&#8221;includes\/templates\/\u4f60\u7684\u6a21\u677f\/images\/stars_0.gif&#8221;&nbsp;\/&gt;(0)&lt;\/div&gt;&#8217;; &nbsp;&nbsp;<\/li>\n<li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} &nbsp;&nbsp;<\/li>\n<li> \/\/\u663e\u793a\u8bc4\u8bba\u661f\u661fend&nbsp;&nbsp;&nbsp;<\/li>\n<\/ol>\n<p> &nbsp;<\/p>\n<p> #\u7136\u540e\u5728ZenCart\u6700\u5f00\u59cb\u7684\u90a3\u6bb5\u4ee3\u7801\u540e\u5929\u9762\u6dfb\u52a0$reviews_display\u5c31\u53ef\u4ee5\u4e86\uff1a\u4f8b\u5982<\/p>\n<p>   &nbsp;  <\/p>\n<ol>\n<li> $lc_text&nbsp;.=&nbsp;&#8221;&nbsp;.&nbsp;(zen_get_show_product_switch($listing-&gt;fields[&#8216;products_id&#8217;],&nbsp;&#8216;ALWAYS_FREE_SHIPPING_IMAGE_SWITCH&#8217;)&nbsp;?&nbsp;(zen_get_product_is_always_free_shipping($listing-&gt;fields[&#8216;products_id&#8217;])&nbsp;?&nbsp;TEXT_PRODUCT_FREE_SHIPPING_ICON&nbsp;.&nbsp;&#8216;&lt;br&nbsp;\/&gt;&#8217;&nbsp;:&nbsp;&#8221;)&nbsp;:&nbsp;&#8221;)&nbsp;.'&lt;br&nbsp;\/&gt;&#8217;.$reviews_display;&nbsp;&nbsp;<\/li>\n<\/ol>\n<p> &nbsp;<\/p>\n<p> \u8fd9\u6837\uff0c\u5982\u679c\u5728\u524d\u53f0\u9875\u9762\u663e\u793a\u4f4d\u7f6e\u4e0d\u5bf9\uff0c\u81ea\u5df1\u53ef\u4ee5\u5c06$reviews_display\u4f4d\u7f6e\u7a0d\u4f5c\u8c03\u8bd5\u3002\uff08\u786e\u8ba4\u4f60\u7684\u56fe\u7247\u6587\u4ef6\u5939\u4e0b\u6709stars_0.gif\u8fd9\u5f20\u56fe\u7247\u54e6\uff09<\/p>\n<p> &nbsp;<\/p>\n<p> 2\uff0c\u5728ZenCart\u4ea7\u54c1\u8be6\u7ec6\u9875\u9762\u6dfb\u52a0\u8bc4\u8bba\u661f\u661f<\/p>\n<p>   &nbsp;  <\/p>\n<ol>\n<li> $count_stars_query&nbsp;=&nbsp;&#8220;select&nbsp;count(reviews_rating)&nbsp;as&nbsp;num,&nbsp;avg(reviews_rating)&nbsp;as&nbsp;aver&nbsp;&nbsp;from&nbsp;&#8221;&nbsp;.&nbsp;TABLE_REVIEWS&nbsp;.&nbsp;&#8221;&nbsp;where&nbsp;products_id&nbsp;=&nbsp;&#8216;&#8221;&nbsp;.&nbsp;(int)$_GET[&#8216;products_id&#8217;]&nbsp;.&nbsp;&#8220;&#8216;&#8221;; &nbsp;&nbsp;<\/li>\n<li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$count_stars&nbsp;=&nbsp;$db-&gt;Execute($count_stars_query); &nbsp;&nbsp;<\/li>\n<li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$starnum&nbsp;=&nbsp;round($count_stars-&gt;fields[&#8216;aver&#8217;]); &nbsp;&nbsp;<\/li>\n<li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$star&nbsp;=&nbsp;array(&#8220;stars_1.gif&#8221;,&#8221;stars_2.gif&#8221;,&#8221;stars_3.gif&#8221;,&#8221;stars_4.gif&#8221;,&#8221;stars_5.gif&#8221;); &nbsp;&nbsp;<\/li>\n<li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if($count_stars-&gt;fields[&#8216;num&#8217;]&gt;=1){ &nbsp;&nbsp;<\/li>\n<li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$reviews_display&nbsp;='&lt;br&nbsp;\/&gt;&#8217;.$count_stars-&gt;fields[&#8216;num&#8217;].&#8217;&nbsp;reviews&lt;br&gt;&lt;img&nbsp;src=&#8221;includes\/templates\/\u6a21\u677f\/images\/&#8217;.&nbsp;$star[$starnum-1]&nbsp;.'&#8221;&nbsp;\/&gt;&#8217;; &nbsp;&nbsp;<\/li>\n<li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}else{ &nbsp;&nbsp;<\/li>\n<li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$reviews_display&nbsp;='&lt;br&nbsp;\/&gt;0&nbsp;reviews&lt;br&gt;&lt;img&nbsp;src=&#8221;includes\/templates\/\u6a21\u677f\/images\/stars_0.gif&#8221;&nbsp;\/&gt;&#8217;; &nbsp;&nbsp;<\/li>\n<li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} &nbsp;&nbsp;<\/li>\n<li> &nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;$reviews_display; &nbsp;&nbsp;<\/li>\n<\/ol>\n<p> &nbsp;<\/p>\n<p> \u5c06\u8fd9\u6bb5\u4ee3\u7801\u653e\u5230ZenCart\u4ea7\u54c1\u7684\u4ef7\u683c\u4e0b\u9762\uff0c\u6837\u5f0f\u53ef\u4ee5\u81ea\u5df1\u8c03\u8bd5\uff0c\u786e\u5b9astars_0.gif\u7684\u5b58\u5728\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1\uff0c\u7ed9ZenCart\u4ea7\u54c1\u5217\u8868\u9875\u9762\u7684\u4ea7\u54c1\u6dfb\u52a0\u8bc4\u8bba\u5c0f\u661f\u661f \u6253\u5f00\u6587\u4ef6includes\\modules\\\u4f60\u7684\u6a21\u677f\\product_listing.php &nbsp; $lc_text&nbsp;.=&nbsp;&#8221;&nbsp;.&nbsp;(zen_get_show_product_switch($listing-&gt;fields[&#8216;products_id&#8217;],&nbsp;&#8216;ALWAYS_FREE_SHIPPING_IMAGE_SWITCH&#8217;)&nbsp;?&nbsp;(zen_get_product_is_always_free_shipping($listing-&gt;fields[&#8216;products_id&#8217;])&nbsp;?&nbsp;TEXT_PRODUCT_FREE_SHIPPING_ICON&nbsp;.&nbsp;&#8216;&lt;br&nbsp;\/&gt;&#8217;&nbsp;:&nbsp;&#8221;)&nbsp;:&nbsp;&#8221;)&nbsp;&nbsp; &nbsp; #\u524d\u9762\u4e00\u884c\u63d2\u5165 &nbsp; \/\/\u663e\u793a\u8bc4\u8bba\u661f\u661fstart&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$count_stars_query&nbsp;=&nbsp;&#8220;select&nbsp;count(reviews_rating)&nbsp;as&nbsp;num,&nbsp;avg(reviews_rating)&nbsp;as&nbsp;aver&nbsp;&nbsp;from&nbsp;&#8221;&nbsp;.&nbsp;TABLE_REVIEWS&nbsp;.&nbsp;&#8221;&nbsp;where&nbsp;products_id&nbsp;=&nbsp;&#8216;&#8221;&nbsp;.&nbsp;(int)$listing-&gt;fields[&#8216;products_id&#8217;]&nbsp;.&nbsp;&#8220;&#8216;&#8221;; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$count_stars&nbsp;=&nbsp;$db-&gt;Execute($count_stars_query); &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$starnum&nbsp;=&nbsp;round($count_stars-&gt;fields[&#8216;aver&#8217;]); &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$star&nbsp;=&nbsp;array(&#8220;stars_1.gif&#8221;,&#8221;stars_2.gif&#8221;,&#8221;stars_3.gif&#8221;,&#8221;stars_4.gif&#8221;,&#8221;stars_5.gif&#8221;); &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if($count_stars-&gt;fields[&#8216;num&#8217;]&gt;=1){ &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$reviews_display&nbsp;='&lt;div&nbsp;class=&#8221;listreviews&#8221;&gt;&lt;img&nbsp;src=&#8221;includes\/templates\/\u4f60\u7684\u6a21\u677f\/images\/&#8217;.&nbsp;$star[$starnum-1]&nbsp;.&#8217;&#8221;&nbsp;\/&gt;(&#8216;.$count_stars-&gt;fields[&#8216;num&#8217;].&#8217;)&lt;\/div&gt;&#8217;; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}else{ &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$reviews_display&nbsp;='&lt;div&nbsp;class=&#8221;listreviews&#8221;&gt;&lt;img&nbsp;src=&#8221;includes\/templates\/\u4f60\u7684\u6a21\u677f\/images\/stars_0.gif&#8221;&nbsp;\/&gt;(0)&lt;\/div&gt;&#8217;; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} &nbsp;&nbsp; \/\/\u663e\u793a\u8bc4\u8bba\u661f\u661fend&nbsp;&nbsp;&nbsp; &nbsp; #\u7136\u540e\u5728ZenCart\u6700\u5f00\u59cb\u7684\u90a3\u6bb5\u4ee3\u7801\u540e\u5929\u9762\u6dfb\u52a0$reviews_display\u5c31\u53ef\u4ee5\u4e86\uff1a\u4f8b\u5982 &nbsp; $lc_text&nbsp;.=&nbsp;&#8221;&nbsp;.&nbsp;(zen_get_show_product_switch($listing-&gt;fields[&#8216;products_id&#8217;],&nbsp;&#8216;ALWAYS_FREE_SHIPPING_IMAGE_SWITCH&#8217;)&nbsp;?&nbsp;(zen_get_product_is_always_free_shipping($listing-&gt;fields[&#8216;products_id&#8217;])&nbsp;?&nbsp;TEXT_PRODUCT_FREE_SHIPPING_ICON&nbsp;.&nbsp;&#8216;&lt;br&nbsp;\/&gt;&#8217;&nbsp;:&nbsp;&#8221;)&nbsp;:&nbsp;&#8221;)&nbsp;.'&lt;br&nbsp;\/&gt;&#8217;.$reviews_display;&nbsp;&nbsp; &nbsp; \u8fd9\u6837\uff0c\u5982\u679c\u5728\u524d\u53f0\u9875\u9762\u663e\u793a\u4f4d\u7f6e\u4e0d\u5bf9\uff0c\u81ea\u5df1\u53ef\u4ee5\u5c06$reviews_display\u4f4d\u7f6e\u7a0d\u4f5c\u8c03\u8bd5\u3002\uff08\u786e\u8ba4\u4f60\u7684\u56fe\u7247\u6587\u4ef6\u5939\u4e0b\u6709stars_0.gif\u8fd9\u5f20\u56fe\u7247\u54e6\uff09 &nbsp; 2\uff0c\u5728ZenCart\u4ea7\u54c1\u8be6\u7ec6\u9875\u9762\u6dfb\u52a0\u8bc4\u8bba\u661f\u661f &nbsp; $count_stars_query&nbsp;=&nbsp;&#8220;select&nbsp;count(reviews_rating)&nbsp;as&nbsp;num,&nbsp;avg(reviews_rating)&nbsp;as&nbsp;aver&nbsp;&nbsp;from&nbsp;&#8221;&nbsp;.&nbsp;TABLE_REVIEWS&nbsp;.&nbsp;&#8221;&nbsp;where&nbsp;products_id&nbsp;=&nbsp;&#8216;&#8221;&nbsp;.&nbsp;(int)$_GET[&#8216;products_id&#8217;]&nbsp;.&nbsp;&#8220;&#8216;&#8221;; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$count_stars&nbsp;=&nbsp;$db-&gt;Execute($count_stars_query); &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$starnum&nbsp;=&nbsp;round($count_stars-&gt;fields[&#8216;aver&#8217;]); &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$star&nbsp;=&nbsp;array(&#8220;stars_1.gif&#8221;,&#8221;stars_2.gif&#8221;,&#8221;stars_3.gif&#8221;,&#8221;stars_4.gif&#8221;,&#8221;stars_5.gif&#8221;); &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if($count_stars-&gt;fields[&#8216;num&#8217;]&gt;=1){ &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$reviews_display&nbsp;='&lt;br&nbsp;\/&gt;&#8217;.$count_stars-&gt;fields[&#8216;num&#8217;].&#8217;&nbsp;reviews&lt;br&gt;&lt;img&nbsp;src=&#8221;includes\/templates\/\u6a21\u677f\/images\/&#8217;.&nbsp;$star[$starnum-1]&nbsp;.&#8217;&#8221;&nbsp;\/&gt;&#8217;; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}else{ &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$reviews_display&nbsp;='&lt;br&nbsp;\/&gt;0&nbsp;reviews&lt;br&gt;&lt;img&nbsp;src=&#8221;includes\/templates\/\u6a21\u677f\/images\/stars_0.gif&#8221;&nbsp;\/&gt;&#8217;; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;$reviews_display; [&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-60907","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/60907","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=60907"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/60907\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=60907"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=60907"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=60907"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}