{"id":60777,"date":"2025-04-26T08:34:26","date_gmt":"2025-04-26T00:34:26","guid":{"rendered":"https:\/\/fwq.ai\/blog\/60777\/"},"modified":"2025-04-26T08:34:26","modified_gmt":"2025-04-26T00:34:26","slug":"zen-cart%e6%a0%b9%e6%8d%ae%e8%b4%ad%e7%89%a9%e8%bd%a6%e4%ba%a7%e5%93%81%e6%95%b0%e9%87%8f%e6%88%96%e8%ae%a2%e5%8d%95%e6%80%bb%e9%a2%9d%e8%bf%9b%e8%a1%8c%e6%8a%98%e6%89%a3","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/60777\/","title":{"rendered":"zen cart\u6839\u636e\u8d2d\u7269\u8f66\u4ea7\u54c1\u6570\u91cf\u6216\u8ba2\u5355\u603b\u989d\u8fdb\u884c\u6298\u6263"},"content":{"rendered":"<p> zen cart\u5173\u4e8e\u6298\u6263\u7684\u63d2\u4ef6\u4e0d\u5c11\uff0c\u4f46\u5927\u90e8\u5206\u662f\u57fa\u4e8e\u4ea7\u54c1\u7684\uff0c\u6bd4\u5982\u4e70\u591a\u5c11\u4e2a\u4ea7\u54c1\u65f6\uff0c\u4ef7\u683c\u6253\u591a\u5c11\u6298\uff0c\u6216\u8005\u662f\u4e70\u591a\u5c11\u4e2a\u4ea7\u54c1\u9001\u591a\u5c11\u3002\u4eca\u5929\u8981\u63a2\u8ba8\u7684\u662f\u57fa\u4e8e\u8ba2\u5355\u603b\u91d1\u989d\u6216\u6574\u4e2a\u8d2d\u7269\u8f66\u4ea7\u54c1\u7684\u6570\u91cf\u6765\u6253\u6298\u3002\u5982\uff0c<\/p>\n<p> \u5f53\u8ba2\u5355\u91d1\u989d\u8d85\u8fc7$500\u65f6\uff0c\u4f18\u60e0$26<\/p>\n<p> \u5f53\u8ba2\u5355\u91d1\u989d\u8d85\u8fc7$1000\u65f6\uff0c\u7ed9%8\u7684\u6298\u6263<\/p>\n<p> \u5f53\u8ba2\u5355\u4e2d\u4ea7\u54c1\u603b\u6570\u91cf\u8d85\u8fc75\u4e2a\u65f6\uff0c\u7ed9\u4e88\u6574\u4e2a\u8ba2\u5355\u603b\u989d%5\u7684\u6298\u6263<\/p>\n<p> \u5f53\u8ba2\u5355\u4e2d\u4ea7\u54c1\u6570\u91cf\u8d85\u8fc720\u4e2a\u65f6\uff0c\u6574\u4e2a\u8ba2\u5355\u62539\u6298<\/p>\n<p> \u7b49\u7b49\u2026 \u2026<\/p>\n<p> \u7ecf\u8fc7\u5bf9zen cart\u76f8\u5173\u4ee3\u7801\u7684\u5206\u6790\uff0c\u6211\u53d1\u73b0\u5b9e\u65bd\u4e0a\u9762\u7684\u8fd9\u7766\u89c4\u5219\u5176\u5b9e\u5f88\u5bb9\u6613\u3002\u53ea\u662fzen cart\u672c\u8eab\u5e76\u6ca1\u6709\u975e\u5e38\u597d\u7684\u6a21\u5757\u548c\u6570\u636e\u5206\u79bb\u673a\u5236\uff0c\u6240\u4ee5\u6211\u5c31\u5148\u628a\u7b80\u5355\u5b9e\u65bd\u7684\u65b9\u6cd5\u5199\u51fa\uff0c\u5f85\u4ee5\u540e\u6709\u7a7a\u518d\u6574\u7406\u5f62\u6210\u6a21\u5757\u53d1\u5e03\u3002<\/p>\n<p> \u51e0\u4e4e\u6240\u6709\u7684zen cart\u6a21\u677f\u901a\u5e38\u53ea\u4f1a\u6709\u4e24\u5230\u4e09\u4e2a\u5730\u65b9\u4f1a\u663e\u793a\u8ba2\u5355\u7684\u6c47\u603b\u4fe1\u606f\uff0c\u4e00\u4e2a\u662f\u5728\u8d2d\u7269\u8f66\u9875\u9762shopping_cart\uff0c\u518d\u4e00\u4e2a\u662f\u8ba2\u5355\u4fe1\u606f\u786e\u8ba4\u9875\u9762checkout_confirmation\uff0c\u6700\u540e\u8fd8\u6709\u53ef\u80fd\u663e\u793a\u7684\u5219\u662f\u76f8\u5173\u7684sidebox.\u5f53\u7136\u67d0\u4e9bzen cart\u6a21\u677f\u53ef\u80fd\u4f1a\u6709\u66f4\u591a\u7684\u9875\u9762\u6709\u663e\u793a\u8fd9\u4e2a\u5185\u5bb9\u3002\u4e0d\u8fc7\u603b\u7ed3\u4e0b\u6765\uff0c\u4e0d\u5916\u4e4e\u8fd9\u4e24\u4e2a\u9875\u9762\u7684\u4fee\u6539\u3002\u6240\u4ee5\uff0c\u5b9e\u73b0\u8fd9\u4e2a\u6253\u6298\u529f\u80fd\u7684\u4e3b\u8981\u5de5\u4f5c\u5c31\u662f\u4fee\u6539\u8fd9\u4e24\u4e2a\u9875\u9762\u548c\u751f\u6210\u8ba2\u5355\u7684\u7c7b\u3002\u4e8b\u5b9e\u4e0a\u7ecf\u8fc7\u4ee3\u7801\u5206\u6790\u6211\u53d1\u73b0shopping_cart\u9875\u9762\u7684\u8ba2\u5355\u7edf\u8ba1\u91c7\u7528\u7684\u65b9\u6cd5\u548ccheckout_confirmation\u9875\u9762\u7684\u4e0d\u4e00\u6837\uff0c\u524d\u8005\u662f\u8c03\u7528shopping_cart\u7c7b\uff0c\u800c\u540e\u8005\u662f\u8c03\u7528order\u7c7b\u3002<\/p>\n<p> \u5148\u770b\u4e0bshopping_cart\u9875\u9762\u7684\u6a21\u677fincludes\/templates\/[\u6a21\u677f\u540d\u79f0]\/templates\/tpl_shopping_cart_default.php\uff1a<\/p>\n<p> \u539f\u5148\u8d2d\u7269\u8f66\u53ea\u663e\u793a\u8ba2\u5355\u603b\u91d1\u989d\uff0c\u73b0\u5728\u8981\u663e\u793a\u4e09\u9879\uff0c\u5206\u522b\u662f\u6253\u6298\u524d\u603b\u91d1\u989d\uff0c\u4f18\u60e0\u7684\u91d1\u989d\uff0c\u6298\u6263\u540e\u7684\u603b\u91d1\u989d\uff0c\u6a21\u677f\u8981\u4fee\u6539\u6210<\/p>\n<p> &nbsp;<\/p>\n<p> \u90a3\u4e48\u5c31\u9700\u8981\u5728shopping_cart\u5bf9\u5e94\u7684header_php.php\u6587\u4ef6\u4e2d\u5b9a\u4e49\u521d\u59cb\u5316\u8fd9\u4e09\u4e2a\u53d8\u91cfincludes\/modules\/pages\/shopping_cart\/header_php.php\uff1a<\/p>\n<p> $flagHasCartContents = ($_SESSION[&#8216;cart&#8217;]-&gt;count_contents() &gt; 0);<br \/> $cartShowTotal = $currencies-&gt;format($_SESSION[&#8216;cart&#8217;]-&gt;show_total());<br \/> \/\/added by george<br \/> $cartOtotal = $currencies-&gt;format($_SESSION[&#8216;cart&#8217;]-&gt;show_ototal());<br \/> $discountTotal = $cartOtotal &#8211; $cartShowTotal;<\/p>\n<p> $cartOtotal\u662f\u8ba2\u5355\u539f\u4ef7\uff0c$cartShowTotal\u662f\u6253\u6298\u540e\u7684\u8ba2\u5355\u603b\u989d.$discountTotal\u4f18\u60e0\u7684\u91d1\u989d\u3002\u4e0b\u4e00\u6b65\u5219\u662f\u5bf9shopping_cart\u7c7b\u7684\u4fee\u6539\u4e86\uff1a\u4fee\u6539calculate\u6210\u5458\u65b9\u6cd5\u5b9e\u73b0\u6253\u6298\u89c4\u5219\uff1b\u6dfb\u52a0\u4e00\u4e2a\u6210\u5458\u5c5e\u6027\u6765\u4fdd\u5b58\u539f\u4ef7\uff1b\u6dfb\u52a0\u4e00\u4e2a\u65b9\u6cd5\u4e5f\u8bfb\u53d6\u539f\u4ef7\uff1b\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<p> &#8212;&#8212;-includes\/classes\/shopping_cart.php<br \/> &#8230;<br \/> &#8230;<br \/> var $contents;<br \/> \/**<br \/> * shopping cart total price<br \/> * @var decimal<br \/> *\/<br \/> var $total;<br \/> \/**<br \/> * shopping cart total weight<br \/> * @var decimal<br \/> *\/<\/p>\n<p> \/\/added by george<br \/> \/\/\u6dfb\u52a0\u6210\u5458\u5c5e\u6027$ototal<br \/> var $ototal;<\/p>\n<p> \/**<br \/> * Method to calculate cart totals(price and weight)<br \/> *<br \/> * @return void<br \/> * @global object access to the db object<br \/> *\/<br \/> function calculate() {<br \/> global $db;<br \/> $this-&gt;total = 0;<br \/> $this-&gt;weight = 0;<br \/> &#8230;<br \/> &#8230;<br \/> &#8230;<br \/> \/\/ + or blank adds<br \/> if ($attribute_weight-&gt;fields[&#8216;products_attributes_weight_prefix&#8217;] == &#8216;-&#8216;) {<br \/> $this-&gt;weight -= $qty * $new_attributes_weight;<br \/> } else {<br \/> $this-&gt;weight += $qty * $new_attributes_weight;<br \/> }<br \/> }<br \/> } \/\/ attributes weight<\/p>\n<p> }<br \/> \/\/added by george to apply discount<br \/> \/\/\u5b9e\u73b0\u6253\u6298\u89c4\u5219<br \/> $this -&gt; ototal = $this -&gt; total; \/\/save origianl order total<br \/> if ( $this -&gt; count_contents() == 2) {<br \/> $this -&gt; total = $this -&gt; total * 0.95;<br \/> } elseif ( $this -&gt; count_contents() &gt;= 3) {<br \/> $this -&gt; total = $this -&gt; total * 0.9;<br \/> }<br \/> \/\/end of discount code<br \/> }<br \/> \/**<br \/> * Method to calculate price of attributes for a given item<br \/> &#8230;<br \/> &#8230;<br \/> \/**<br \/> * Method to calculate total price of items in cart<br \/> *<br \/> * @return decimal Total Price<br \/> *\/<br \/> function show_total() {<br \/> $this-&gt;notify(&#8216;NOTIFIER_CART_SHOW_TOTAL_START&#8217;);<br \/> $this-&gt;calculate();<br \/> $this-&gt;notify(&#8216;NOTIFIER_CART_SHOW_TOTAL_END&#8217;);<br \/> return $this-&gt;total;<br \/> }<\/p>\n<p> \/\/added by george<br \/> \/\/\u83b7\u53d6\u539f\u4ef7\u7684\u65b9\u6cd5<br \/> function show_ototal() {<br \/> $this-&gt;notify(&#8216;NOTIFIER_CART_SHOW_TOTAL_START&#8217;);<br \/> $this-&gt;calculate();<br \/> $this-&gt;notify(&#8216;NOTIFIER_CART_SHOW_TOTAL_END&#8217;);<br \/> return $this-&gt;ototal;<br \/> }<\/p>\n<p> \u5230\u76ee\u524d\u4e3a\u6b62\uff0c\u5bf9\u8d2d\u7269\u8f66\u9875\u9762\u7684\u4fee\u6539\u7b97\u662f\u5b8c\u6210\u4e86\u3002\u5f53\u7136CSS\u4e4b\u7c7b\u7684\u4fee\u9970\u662f\u5fc5\u8981\u7684\u3002\u8fd9\u91cc\u5c31\u4e0d\u63d0\u4e86\u3002\u4e0d\u8fc7\u8ba2\u5355\u786e\u8ba4\u9875\u9762checkout_confirmation\u8fd8\u672b\u4fee\u6539\u3002<\/p>\n<p> if (MODULE_ORDER_TOTAL_INSTALLED) {<br \/> $order_totals = $order_total_modules-&gt;process();<br \/> ?&gt;<\/p>\n<p>  output(); ?&gt;  <\/p>\n<p> }<br \/> ?&gt;<\/p>\n<p> \u663e\u7136checkout_confirmation\u9875\u9762\u7684\u8ba2\u5355\u6c47\u603b\u4fe1\u606f\u662f\u901a\u8fc7$order_total_modules\u5bf9\u8c61\u751f\u6210\u7684\u800c\u8fd9\u4e2a\u5bf9\u8c61\u662f\u5728checkout_confirmation\u9875\u9762\u7684header_php.php\u4e2d\u5b9a\u4e49\u7684\uff1a<\/p>\n<p> .\/includes\/modules\/pages\/checkout_confirmation\/header_php.php:66:$order_total_modules = new order_total;<\/p>\n<p> \u90a3\u4e48\u518d\u5f80\u4e0a\u8ffd\u8e2a\u4e00\u6b65\u5e94\u8be5\u662f\u67e5\u770border_total\u7c7b\u7684output\u65b9\u6cd5\u4e86\uff1a<\/p>\n<p> function output($return_html=false) {<br \/> global $template, $current_page_base;<br \/> $output_string = &#8221;;<br \/> if (is_array($this-&gt;modules)) {<br \/> reset($this-&gt;modules);<br \/> while (list(, $value) = each($this-&gt;modules)) {<br \/> $class = substr($value, 0, strrpos($value, &#8216;.&#8217;));<br \/> $size = sizeof($GLOBALS[$class]-&gt;output);<\/p>\n<p> \/\/ ideally, the first part of this IF statement should be dropped, and the ELSE portion is all that should be kept<br \/> if ($return_html == true) {<br \/> for ($i=0; $i&lt;$size; $i++) {<br \/> $output_string .= &#8216;<\/p>\n<p> &#8216; . &#8220;\\n&#8221; .<br \/>\n<br \/> &#8216; <\/p>\n<p> &nbsp;<\/p>\n<p> &#8216; . $GLOBALS[$class]-&gt;output[$i][&#8216;title&#8217;] . &#8216; <\/p>\n<p> &#8216; . &#8220;\\n&#8221; .<br \/> &#8216;<\/p>\n<p> &#8216; . $GLOBALS[$class]-&gt;output[$i][&#8216;text&#8217;] . &#8216; <\/p>\n<p> &#8216; . &#8220;\\n&#8221; .<br \/> &#8216;<\/p>\n<p> &#8216;;<br \/> }<br \/> } else {<br \/> \/\/ use a template file for output instead of hard-coded HTML<br \/> require($template-&gt;get_template_dir(&#8216;tpl_modules_order_totals.php&#8217;,DIR_WS_TEMPLATE, $current_page_base,&#8217;templates&#8217;). &#8216;\/tpl_modules_order_totals.php&#8217;);<br \/> }<br \/> }<br \/> }<br \/> return $output_string;<br \/> }<\/p>\n<p> \u663e\u7136\u6700\u7ec8\u8c03\u7528\u7684\u662ftpl_modules_order_totals.php\u8fd9\u4e2a\u6a21\u677f\uff1a<\/p>\n<p> for ($i=0; $i&lt;$size; $i++) { ?&gt;<\/p>\n<p> &nbsp;<\/p>\n<p>  output[$i][&#8216;text&#8217;]; ?&gt;   output[$i][&#8216;title&#8217;]; ?&gt;   <\/p>\n<p> &nbsp;<\/p>\n<p> \u901a\u8fc7\u5206\u6790zen cart\u7684order_total\u7c7b\u7684\u6784\u9020\u51fd\u6570order_total\uff08\u4ee3\u7801\u5982\u4e0b\uff09\uff0c\u518d\u7efc\u5408order_total\u7c7b\u7684output\u65b9\u6cd5\uff0cprocess\u65b9\u6cd5\uff0c\u53ef\u4ee5\u786e\u5b9atpl_modules_order_totals.php\u8fd9\u4e2a\u6a21\u677f\u662f\u901a\u8fc7\u8c03\u7528includes\/modules\/order_total\/\u76ee\u5f55\u4e0b\u7684ot_subtotal\uff0cot_shipping,ot_total\u8fd9\u4e09\u4e2a\u7c7b\u3002\u901a\u8fc7\u5728tpl_modules_order_totals.php\u8fd9\u4e2a\u6a21\u677f<\/p>\n<p> <\/p>\n<p> &nbsp;<\/p>\n<p> function order_total() {<br \/> global $messageStack;<br \/> if (defined(&#8216;MODULE_ORDER_TOTAL_INSTALLED&#8217;) &amp;&amp; zen_not_null(MODULE_ORDER_TOTAL_INSTALLED)) {<br \/> $module_list = explode(&#8216;;&#8217;, MODULE_ORDER_TOTAL_INSTALLED);<\/p>\n<p> reset($module_list);<br \/> while (list(, $value) = each($module_list)) {<br \/> \/\/include(DIR_WS_LANGUAGES . $_SESSION[&#8216;language&#8217;] . &#8216;\/modules\/order_total\/&#8217; . $value);<br \/> $lang_file = zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION[&#8216;language&#8217;] . &#8216;\/modules\/order_total\/&#8217;, $value, &#8216;false&#8217;);<br \/> if (@file_exists($lang_file)) {<br \/> include_once($lang_file);<br \/> } else {<br \/> if (IS_ADMIN_FLAG === false) {<br \/> $messageStack-&gt;add(WARNING_COULD_NOT_LOCATE_LANG_FILE . $lang_file, &#8216;caution&#8217;);<br \/> } else {<br \/> $messageStack-&gt;add_session(WARNING_COULD_NOT_LOCATE_LANG_FILE . $lang_file, &#8216;caution&#8217;);<br \/> }<br \/> }<br \/> \/\/\u7531\u6b64\u53ef\u786e\u5b9a\u8c03\u7528\u7684\u662fincludes\/modules\/order_total\/\u76ee\u5f55\u4e0b\u7684\u8fd9\u4e9b\u7c7b<br \/> $module_file = DIR_WS_MODULES . &#8216;order_total\/&#8217; . $value;<br \/> if (@file_exists($module_file)) {<br \/> include_once($module_file);<br \/> $class = substr($value, 0, strrpos($value, &#8216;.&#8217;));<br \/> $GLOBALS[$class] = new $class;<br \/> $this-&gt;modules[] = $value;<br \/> }<br \/> }<br \/> }<br \/> }<\/p>\n<p> Ok,\u7ec8\u4e8e\u5feb\u627e\u5230\u6211\u4eec\u8981\u4fee\u6539\u7684\u4ee3\u7801\u4e86\u3002\u518d\u5206\u6790\u4e00\u4e0b\uff0c\u73b0\u5728checkout_confirmation\u663e\u793a\u7684\u4e09\u9879\u662fsubtotal,shipping,order total,\u8ba2\u5355\u539f\u4ef7\uff0c\u8fd0\u8d39\uff0c\u52a0\u8fd0\u8d39\u540e\u8ba2\u5355\u603b\u989d\u3002<\/p>\n<p> \u901a\u8fc7\u5206\u6790ot_subtotal\uff0cot_shipping,ot_total\u8fd9\u4e09\u4e2a\u7c7b\u5bf9output\u6570\u7ec4\u7684\u521d\u59cb\u5316\uff0c\u6211\u6700\u7ec8\u53d1\u73b0\u6570\u636e\u6700\u7ec8\u6765\u6e90\u4e8eorder\u7c7b[includes\/class\/order.php]\uff0c\u4ee5ot_total\u4e3a\u4f8b\u770b\u4e00\u4e0b\u4ee3\u7801\uff1a<\/p>\n<p> function process() {<br \/> global $order, $currencies;<br \/> $this-&gt;output[] = array(&#8216;title&#8217; =&gt; $this-&gt;title . &#8216;:&#8217;,<br \/> &#8216;text&#8217; =&gt; $currencies-&gt;format($order-&gt;info[&#8216;total&#8217;], true, $order-&gt;info[&#8216;currency&#8217;], $order-&gt;info[&#8216;currency_value&#8217;]),<br \/> &#8216;value&#8217; =&gt; $order-&gt;info[&#8216;total&#8217;]);<br \/> }<\/p>\n<p> \u6700\u7ec8\u6211\u901a\u8fc7\u4fee\u6539\u4e86order\u7c7bcart\u6210\u5458\u65b9\u6cd5\uff0c\u76f4\u63a5\u5e94\u7528\u4e86\u6253\u6298\u89c4\uff0c\u5b9e\u73b0\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<p> *********************************************\/<br \/> $index++;<br \/> }<br \/> &nbsp;&nbsp;&nbsp; \/\/\u4e0b\u9762\u7684\u4ee3\u7801\u5b9e\u73b0\u6253\u6298\u89c4\u5219\uff0c\u4e0d\u8fc7\u8fd9\u6837\u5199\u8fd0\u8d39\u662f\u6ca1\u53c2\u4e0e\u6253\u6298\u7684<br \/> $this-&gt;info[&#8216;osubtotal&#8217;] = $this-&gt;info[&#8216;subtotal&#8217;];<br \/> if ( $_SESSION[&#8216;cart&#8217;] -&gt;count_contents() == 2) {<br \/> $this-&gt;info[&#8216;subtotal&#8217;] *= 0.95;<br \/> } elseif( $_SESSION[&#8216;cart&#8217;] -&gt;count_contents() &gt;= 3) {<br \/> $this-&gt;info[&#8216;subtotal&#8217;] *= 0.9;<br \/> }<br \/> \/\/ Update the final total to include tax if not already tax-inc<br \/> if (DISPLAY_PRICE_WITH_TAX == &#8216;true&#8217;) {<br \/> $this-&gt;info[&#8216;total&#8217;] = $this-&gt;info[&#8216;subtotal&#8217;] + $this-&gt;info[&#8216;shipping_cost&#8217;];<br \/> } else {<br \/> $this-&gt;info[&#8216;total&#8217;] = $this-&gt;info[&#8216;subtotal&#8217;] + $this-&gt;info[&#8216;tax&#8217;] + $this-&gt;info[&#8216;shipping_cost&#8217;];<br \/> }<\/p>\n<p> \u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u4e0a\u9762\u7684\u8fd9\u4e2a\u4ee3\u7801\u6253\u6298\u662f\u9488\u5bf9\u4ea7\u54c1\u7684\u603b\u4ef7\uff0c\u6ca1\u6709\u5bf9\u8fd0\u8d39\u6253\u6298\u3002\u5982\u679c\u8981\u5bf9\u8fd0\u8d39\u4e5f\u6253\u6298\uff0c\u90a3\u5c31\u8981\u4fee\u6539\u6210\u8fd9\u6837\uff1a<\/p>\n<p> *********************************************\/<br \/> $index++;<br \/> }<\/p>\n<p> \/\/ Update the final total to include tax if not already tax-inc<br \/> if (DISPLAY_PRICE_WITH_TAX == &#8216;true&#8217;) {<br \/> $this-&gt;info[&#8216;total&#8217;] = $this-&gt;info[&#8216;subtotal&#8217;] + $this-&gt;info[&#8216;shipping_cost&#8217;];<br \/> } else {<br \/> $this-&gt;info[&#8216;total&#8217;] = $this-&gt;info[&#8216;subtotal&#8217;] + $this-&gt;info[&#8216;tax&#8217;] + $this-&gt;info[&#8216;shipping_cost&#8217;];<br \/> }<br \/> \/\/\u5728\u8fd9\u8fb9\u5e94\u7528\u6253\u6298\u89c4\u5219\uff0c\u662f\u5bf9\u8ba2\u5355\u603b\u91d1\u989d\uff0c\u5305\u62ec\u8fd0\u8d39\u4e00\u8d77\u6253\u6298<br \/> if ( $_SESSION[&#8216;cart&#8217;] -&gt;count_contents() == 2) {<br \/> $this-&gt;info[&#8216;total&#8217;] *= 0.95;<br \/> } elseif( $_SESSION[&#8216;cart&#8217;] -&gt;count_contents() &gt;= 3) {<br \/> $this-&gt;info[&#8216;total&#8217;] *= 0.9;<br \/> }<\/p>\n<p> \u4ee5\u4e0a\u7684\u53ea\u662f\u6211\u5b9e\u65bd\u540e\u7684\u5bf9\u5b9e\u73b0\u601d\u8def\u7684\u7c97\u7565\u56de\u5fc6\uff0c\u5f85\u6709\u7a7a\u518d\u6574\u7406\u6210zen cart\u6a21\u5757\u5f62\u5f0f\u53d1\u5e03\u3002\u5e76\u5728zen cart\u540e\u53f0\u8bbe\u7f6e\u4e00\u4e2a\u754c\u9762\u8fdb\u884c\u6253\u6298\u89c4\u5219\u7684\u8bbe\u7f6e\u3002\u800c\u4e0d\u662f\u5c06\u6253\u6298\u89c4\u5219\u5199\u6b7b\u5728\u4ee3\u7801\u4e2d\u3002<\/p>\n<p> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>zen cart\u5173\u4e8e\u6298\u6263\u7684\u63d2\u4ef6\u4e0d\u5c11\uff0c\u4f46\u5927\u90e8\u5206\u662f\u57fa\u4e8e\u4ea7\u54c1\u7684\uff0c\u6bd4\u5982\u4e70\u591a\u5c11\u4e2a\u4ea7\u54c1\u65f6\uff0c\u4ef7\u683c\u6253\u591a\u5c11\u6298\uff0c\u6216\u8005\u662f\u4e70\u591a\u5c11\u4e2a\u4ea7\u54c1\u9001\u591a\u5c11\u3002\u4eca\u5929\u8981\u63a2\u8ba8\u7684\u662f\u57fa\u4e8e\u8ba2\u5355\u603b\u91d1\u989d\u6216\u6574\u4e2a\u8d2d\u7269\u8f66\u4ea7\u54c1\u7684\u6570\u91cf\u6765\u6253\u6298\u3002\u5982\uff0c \u5f53\u8ba2\u5355\u91d1\u989d\u8d85\u8fc7$500\u65f6\uff0c\u4f18\u60e0$26 \u5f53\u8ba2\u5355\u91d1\u989d\u8d85\u8fc7$1000\u65f6\uff0c\u7ed9%8\u7684\u6298\u6263 \u5f53\u8ba2\u5355\u4e2d\u4ea7\u54c1\u603b\u6570\u91cf\u8d85\u8fc75\u4e2a\u65f6\uff0c\u7ed9\u4e88\u6574\u4e2a\u8ba2\u5355\u603b\u989d%5\u7684\u6298\u6263 \u5f53\u8ba2\u5355\u4e2d\u4ea7\u54c1\u6570\u91cf\u8d85\u8fc720\u4e2a\u65f6\uff0c\u6574\u4e2a\u8ba2\u5355\u62539\u6298 \u7b49\u7b49\u2026 \u2026 \u7ecf\u8fc7\u5bf9zen cart\u76f8\u5173\u4ee3\u7801\u7684\u5206\u6790\uff0c\u6211\u53d1\u73b0\u5b9e\u65bd\u4e0a\u9762\u7684\u8fd9\u7766\u89c4\u5219\u5176\u5b9e\u5f88\u5bb9\u6613\u3002\u53ea\u662fzen cart\u672c\u8eab\u5e76\u6ca1\u6709\u975e\u5e38\u597d\u7684\u6a21\u5757\u548c\u6570\u636e\u5206\u79bb\u673a\u5236\uff0c\u6240\u4ee5\u6211\u5c31\u5148\u628a\u7b80\u5355\u5b9e\u65bd\u7684\u65b9\u6cd5\u5199\u51fa\uff0c\u5f85\u4ee5\u540e\u6709\u7a7a\u518d\u6574\u7406\u5f62\u6210\u6a21\u5757\u53d1\u5e03\u3002 \u51e0\u4e4e\u6240\u6709\u7684zen cart\u6a21\u677f\u901a\u5e38\u53ea\u4f1a\u6709\u4e24\u5230\u4e09\u4e2a\u5730\u65b9\u4f1a\u663e\u793a\u8ba2\u5355\u7684\u6c47\u603b\u4fe1\u606f\uff0c\u4e00\u4e2a\u662f\u5728\u8d2d\u7269\u8f66\u9875\u9762shopping_cart\uff0c\u518d\u4e00\u4e2a\u662f\u8ba2\u5355\u4fe1\u606f\u786e\u8ba4\u9875\u9762checkout_confirmation\uff0c\u6700\u540e\u8fd8\u6709\u53ef\u80fd\u663e\u793a\u7684\u5219\u662f\u76f8\u5173\u7684sidebox.\u5f53\u7136\u67d0\u4e9bzen cart\u6a21\u677f\u53ef\u80fd\u4f1a\u6709\u66f4\u591a\u7684\u9875\u9762\u6709\u663e\u793a\u8fd9\u4e2a\u5185\u5bb9\u3002\u4e0d\u8fc7\u603b\u7ed3\u4e0b\u6765\uff0c\u4e0d\u5916\u4e4e\u8fd9\u4e24\u4e2a\u9875\u9762\u7684\u4fee\u6539\u3002\u6240\u4ee5\uff0c\u5b9e\u73b0\u8fd9\u4e2a\u6253\u6298\u529f\u80fd\u7684\u4e3b\u8981\u5de5\u4f5c\u5c31\u662f\u4fee\u6539\u8fd9\u4e24\u4e2a\u9875\u9762\u548c\u751f\u6210\u8ba2\u5355\u7684\u7c7b\u3002\u4e8b\u5b9e\u4e0a\u7ecf\u8fc7\u4ee3\u7801\u5206\u6790\u6211\u53d1\u73b0shopping_cart\u9875\u9762\u7684\u8ba2\u5355\u7edf\u8ba1\u91c7\u7528\u7684\u65b9\u6cd5\u548ccheckout_confirmation\u9875\u9762\u7684\u4e0d\u4e00\u6837\uff0c\u524d\u8005\u662f\u8c03\u7528shopping_cart\u7c7b\uff0c\u800c\u540e\u8005\u662f\u8c03\u7528order\u7c7b\u3002 \u5148\u770b\u4e0bshopping_cart\u9875\u9762\u7684\u6a21\u677fincludes\/templates\/[\u6a21\u677f\u540d\u79f0]\/templates\/tpl_shopping_cart_default.php\uff1a \u539f\u5148\u8d2d\u7269\u8f66\u53ea\u663e\u793a\u8ba2\u5355\u603b\u91d1\u989d\uff0c\u73b0\u5728\u8981\u663e\u793a\u4e09\u9879\uff0c\u5206\u522b\u662f\u6253\u6298\u524d\u603b\u91d1\u989d\uff0c\u4f18\u60e0\u7684\u91d1\u989d\uff0c\u6298\u6263\u540e\u7684\u603b\u91d1\u989d\uff0c\u6a21\u677f\u8981\u4fee\u6539\u6210 &nbsp; \u90a3\u4e48\u5c31\u9700\u8981\u5728shopping_cart\u5bf9\u5e94\u7684header_php.php\u6587\u4ef6\u4e2d\u5b9a\u4e49\u521d\u59cb\u5316\u8fd9\u4e09\u4e2a\u53d8\u91cfincludes\/modules\/pages\/shopping_cart\/header_php.php\uff1a $flagHasCartContents = ($_SESSION[&#8216;cart&#8217;]-&gt;count_contents() &gt; 0); $cartShowTotal = $currencies-&gt;format($_SESSION[&#8216;cart&#8217;]-&gt;show_total()); \/\/added by george $cartOtotal = $currencies-&gt;format($_SESSION[&#8216;cart&#8217;]-&gt;show_ototal()); $discountTotal = $cartOtotal &#8211; $cartShowTotal; $cartOtotal\u662f\u8ba2\u5355\u539f\u4ef7\uff0c$cartShowTotal\u662f\u6253\u6298\u540e\u7684\u8ba2\u5355\u603b\u989d.$discountTotal\u4f18\u60e0\u7684\u91d1\u989d\u3002\u4e0b\u4e00\u6b65\u5219\u662f\u5bf9shopping_cart\u7c7b\u7684\u4fee\u6539\u4e86\uff1a\u4fee\u6539calculate\u6210\u5458\u65b9\u6cd5\u5b9e\u73b0\u6253\u6298\u89c4\u5219\uff1b\u6dfb\u52a0\u4e00\u4e2a\u6210\u5458\u5c5e\u6027\u6765\u4fdd\u5b58\u539f\u4ef7\uff1b\u6dfb\u52a0\u4e00\u4e2a\u65b9\u6cd5\u4e5f\u8bfb\u53d6\u539f\u4ef7\uff1b\u4ee3\u7801\u5982\u4e0b\uff1a &#8212;&#8212;-includes\/classes\/shopping_cart.php &#8230; &#8230; var $contents; \/** * shopping cart total price * @var decimal *\/ var $total; [&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-60777","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/60777","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=60777"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/60777\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=60777"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=60777"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=60777"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}