{"id":60771,"date":"2025-04-26T12:27:23","date_gmt":"2025-04-26T04:27:23","guid":{"rendered":"https:\/\/fwq.ai\/blog\/60771\/"},"modified":"2025-04-26T12:27:23","modified_gmt":"2025-04-26T04:27:23","slug":"zencart%e8%b4%9d%e5%ae%9dpaypal%e9%98%b2%e6%bc%8f%e5%8d%95%e4%bf%ae%e6%94%b9","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/60771\/","title":{"rendered":"zencart\u8d1d\u5b9dPaypal\u9632\u6f0f\u5355\u4fee\u6539"},"content":{"rendered":"<p> ZenCart\u6a21\u677f\u9ed8\u8ba4\u7684\u4e0b\u5355\u6d41\u7a0b\u662f\uff1a<br \/> \u8d2d\u7269\u8f66(shopping cart)-&gt;[\u8d27\u8fd0\u65b9\u5f0f(shipping method)]-&gt;\u652f\u4ed8\u65b9\u5f0f(payment method)-&gt;\u8ba2\u5355\u786e\u8ba4(confirmation)-&gt;[\u7b2c\u4e09\u65b9\u7f51\u7ad9\u652f\u4ed8]-&gt;\u8ba2\u5355\u5904\u7406(checkout process)-&gt;\u4e0b\u5355\u6210\u529f(checkout success).<br \/> \u7b49\u4e8e\u9700\u8981\u8d1d\u5b9d Paypal\u4ed8\u6b3e\u6210\u529f\u624d\u80fd\u751f\u6210\u8ba2\u5355\uff0c\u54ea\u4e9b\u6ca1\u6709\u4ed8\u6b3e\u6216\u8005\u6682\u65f6\u65e0\u6cd5\u4ed8\u6b3e\u7684\u5ba2\u6237\u5c31\u65e0\u6cd5\u751f\u6210\u8ba2\u5355\uff0c\u8fd9\u4e2a\u5bf9\u4e8e\u7ad9\u957f\u6216\u8005\u5ba2\u6237\u90fd\u6781\u4e3a\u4e0d\u4fbf\uff0c\u90a3\u5982\u4f55\u89e3\u51b3\u9009\u62e9paypal\u8d1d\u5b9d\u4ed8\u6b3e\u4e0d\u4e22\u5931\u8ba2\u5355\u5462\uff1f<\/p>\n<p> zen cart\u8d1d\u5b9d Paypal\u9632\u6f0f\u5355\u4fee\u6539\u89e3\u51b3\u65b9\u6cd5<br \/> \u5728\u652f\u4ed8\u9875\u9762index.php?main_page=checkout_confirmation\u5355\u51fb\u6309\u94ae\u65f6\u5c31\u80fd\u4ea7\u751f\u8ba2\u5355\u3002<br \/> \u65b9\u6cd5\u662f\uff1a\u5728zencart\u4e3b\u9898\u7684\u6839\u76ee\u5f55includes\\templates\\\u5f53\u524d\u6a21\u677f\u540d\\templates\\tpl_checkout_confirmation_default.php\u6587\u4ef6\u7684\u6700\u540e\u9762<br \/> \u540e\u9762\u6dfb\u52a0\u4ee3\u7801\uff1a<br \/> \/\/ create the order record \u9632\u6f0f\u5355<br \/> if ($_SESSION[\u2018payment\u2019] == \u2019paypal\u2019) {<br \/> $insert_id = $order-&gt;create($order_totals, 2);<br \/> $zco_notifier-&gt;notify(\u2018NOTIFY_CHECKOUT_PROCESS_AFTER_ORDER_CREATE\u2019);<br \/> $payment_modules-&gt;after_order_create($insert_id);<br \/> $zco_notifier-&gt;notify(\u2018NOTIFY_CHECKOUT_PROCESS_AFTER_PAYMENT_MODULES_AFTER_ORDER_CREATE\u2019);<br \/> \/\/ store the product info to the order<br \/> $order-&gt;create_add_products($insert_id);<br \/> $_SESSION[\u2018order_number_created\u2019] = $insert_id;<br \/> \u4e3a\u4e86\u907f\u514d\u5bf9\u5176\u4ed6\u652f\u4ed8\u65b9\u5f0f\u4ea7\u751f\u5f71\u54cd\uff0c\u6240\u4ee5\u4ee3\u7801\u505a\u4e86\u4e2a\u5224\u65ad\uff0c\u53ea\u6709\u5728ZenCart\u9009 \u62e9paypal\u652f\u4ed8\u7684\u65f6\u5019\u624d\u4f1a\u751f\u6210\u8ba2\u5355\uff0c\u52a0\u4e86\u8fd9\u6bb5\u540e\u5c31\u4e0d\u7528\u62c5\u5fc3\u4f1a\u6f0f\u5355\u4e86\u2014\u6210\u529f\u4ed8\u6b3e\u540e\u540e\u53f0\u5c31\u4f1a\u4ea7\u751f\u8ba2\u5355\uff0c\u5176\u4e2d\u524d\u9762GS\/AK\u7684\u4e3a\u9632\u6f0f\u5355\u7684\u8ba2\u5355\uff0c\u53ea\u6709\u5728\u51fa \u73b0\u6f0f\u5355\u7684\u65f6\u5019\u624d\u4f1a\u67e5\u770b\u8fd9\u4e9b\u8ba2\u5355\uff0c\u91cc\u9762\u7684\u4fe1\u606f\u8ddf\u6b63\u5e38\u8ba2\u5355\u76f8\u6bd4\u4f1a\u5c11\u4e00\u4e2a\u4ea4\u6613\u53f7\uff0c\u4f46\u662f\u81f3\u5c11\u662f\u53ef\u4ee5\u770b\u5230\u5ba2\u6237\u4fe1\u606f\u53ca\u6240\u8d2d\u4e70\u4e86\u4ec0\u4e48\u4ea7\u54c1\u2026<br \/> \u5728\u786e\u8ba4\u9875\u9762\uff0c\u5982\u679c\u987e\u5ba2\u4e00\u76f4\u5237\u65b0\u9875\u9762\uff0c\u5c31\u4f1a\u4e00\u76f4\u751f\u6210\u8ba2\u5355\uff0c\u53ef\u4ee5\u52a0\u4e2a\u9650\u5236.<br \/> &lt;?php<br \/> \/\/ create the order record \u9632\u6f0f\u5355<br \/> if ($_SESSION[\u2018payment\u2019] == \u2019paypal\u2019 and !isset($_SESSION[\u2018order_number_created\u2019])) {<br \/> $insert_id = $order-&gt;create($order_totals, 2);<br \/> $zco_notifier-&gt;notify(\u2018NOTIFY_CHECKOUT_PROCESS_AFTER_ORDER_CREATE\u2019);<br \/> $payment_modules-&gt;after_order_create($insert_id);<br \/> $zco_notifier-&gt;notify(\u2018NOTIFY_CHECKOUT_PROCESS_AFTER_PAYMENT_MODULES_AFTER_ORDER_CREATE\u2019);<br \/> \/\/ store the product info to the order<br \/> $order-&gt;create_add_products($insert_id);<br \/> $_SESSION[\u2018order_number_created\u2019] = $insert_id;<br \/> \/\/send email notifications<br \/> $order-&gt;send_order_email($insert_id, 2);<br \/> $zco_notifier-&gt;notify(\u2018NOTIFY_CHECKOUT_PROCESS_AFTER_SEND_ORDER_EMAIL\u2019);<br \/> }<br \/> ?&gt;<br \/> \u5728pages\/checkout_payment\/header_php.php\u4efb\u610f\u4f4d\u7f6e\u52a0\u4e0aunset($_SESSION[\u2018order_number_created\u2019]);<br \/> \u8fd9\u6837,\u5c31\u7b97\u987e\u5ba2\u5728\u786e\u8ba4\u9875\u9762\u4e00\u76f4\u5237\u65b0\uff0c\u56e0\u4e3a\u5df2\u7ecf\u8bbe\u7f6e\u4e86$_SESSION[\u2018order_number_created\u2019]\uff0c\u8ba2\u5355\u4e0d\u518d\u751f\u6210\uff0c<br \/> \u5982\u679c\u987e\u5ba2\u8fd4\u56de\u4fee\u6539\u4e86\u8d2d\u7269\u8f66\uff0c\u518d\u6b21\u5230\u8fbecheckout_payment\u65f6$_SESSION[\u2018order_number_created\u2019]\u5c06\u88ab\u6e05\u9664\u3002<\/p>\n<p> OK &nbsp;zen cart\u8d1d\u5b9d Paypal\u9632\u6f0f\u5355\u4fee\u6539\u5c31\u662f\u8fd9\u6837\u5566\uff0c\u5728\u4f7f\u7528zencart\u7f51\u7ad9\u6a21\u677f\u7684\u5ba2\u6237\u5982\u679c\u4f60\u8fd8\u5728&nbsp;\u56e0\u4e3aPaypal\u6f0f\u5355\u5c31\u8bd5\u8bd5\u5427\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>ZenCart\u6a21\u677f\u9ed8\u8ba4\u7684\u4e0b\u5355\u6d41\u7a0b\u662f\uff1a \u8d2d\u7269\u8f66(shopping cart)-&gt;[\u8d27\u8fd0\u65b9\u5f0f(shipping method)]-&gt;\u652f\u4ed8\u65b9\u5f0f(payment method)-&gt;\u8ba2\u5355\u786e\u8ba4(confirmation)-&gt;[\u7b2c\u4e09\u65b9\u7f51\u7ad9\u652f\u4ed8]-&gt;\u8ba2\u5355\u5904\u7406(checkout process)-&gt;\u4e0b\u5355\u6210\u529f(checkout success). \u7b49\u4e8e\u9700\u8981\u8d1d\u5b9d Paypal\u4ed8\u6b3e\u6210\u529f\u624d\u80fd\u751f\u6210\u8ba2\u5355\uff0c\u54ea\u4e9b\u6ca1\u6709\u4ed8\u6b3e\u6216\u8005\u6682\u65f6\u65e0\u6cd5\u4ed8\u6b3e\u7684\u5ba2\u6237\u5c31\u65e0\u6cd5\u751f\u6210\u8ba2\u5355\uff0c\u8fd9\u4e2a\u5bf9\u4e8e\u7ad9\u957f\u6216\u8005\u5ba2\u6237\u90fd\u6781\u4e3a\u4e0d\u4fbf\uff0c\u90a3\u5982\u4f55\u89e3\u51b3\u9009\u62e9paypal\u8d1d\u5b9d\u4ed8\u6b3e\u4e0d\u4e22\u5931\u8ba2\u5355\u5462\uff1f zen cart\u8d1d\u5b9d Paypal\u9632\u6f0f\u5355\u4fee\u6539\u89e3\u51b3\u65b9\u6cd5 \u5728\u652f\u4ed8\u9875\u9762index.php?main_page=checkout_confirmation\u5355\u51fb\u6309\u94ae\u65f6\u5c31\u80fd\u4ea7\u751f\u8ba2\u5355\u3002 \u65b9\u6cd5\u662f\uff1a\u5728zencart\u4e3b\u9898\u7684\u6839\u76ee\u5f55includes\\templates\\\u5f53\u524d\u6a21\u677f\u540d\\templates\\tpl_checkout_confirmation_default.php\u6587\u4ef6\u7684\u6700\u540e\u9762 \u540e\u9762\u6dfb\u52a0\u4ee3\u7801\uff1a \/\/ create the order record \u9632\u6f0f\u5355 if ($_SESSION[\u2018payment\u2019] == \u2019paypal\u2019) { $insert_id = $order-&gt;create($order_totals, 2); $zco_notifier-&gt;notify(\u2018NOTIFY_CHECKOUT_PROCESS_AFTER_ORDER_CREATE\u2019); $payment_modules-&gt;after_order_create($insert_id); $zco_notifier-&gt;notify(\u2018NOTIFY_CHECKOUT_PROCESS_AFTER_PAYMENT_MODULES_AFTER_ORDER_CREATE\u2019); \/\/ store the product info to the order $order-&gt;create_add_products($insert_id); $_SESSION[\u2018order_number_created\u2019] = $insert_id; \u4e3a\u4e86\u907f\u514d\u5bf9\u5176\u4ed6\u652f\u4ed8\u65b9\u5f0f\u4ea7\u751f\u5f71\u54cd\uff0c\u6240\u4ee5\u4ee3\u7801\u505a\u4e86\u4e2a\u5224\u65ad\uff0c\u53ea\u6709\u5728ZenCart\u9009 \u62e9paypal\u652f\u4ed8\u7684\u65f6\u5019\u624d\u4f1a\u751f\u6210\u8ba2\u5355\uff0c\u52a0\u4e86\u8fd9\u6bb5\u540e\u5c31\u4e0d\u7528\u62c5\u5fc3\u4f1a\u6f0f\u5355\u4e86\u2014\u6210\u529f\u4ed8\u6b3e\u540e\u540e\u53f0\u5c31\u4f1a\u4ea7\u751f\u8ba2\u5355\uff0c\u5176\u4e2d\u524d\u9762GS\/AK\u7684\u4e3a\u9632\u6f0f\u5355\u7684\u8ba2\u5355\uff0c\u53ea\u6709\u5728\u51fa \u73b0\u6f0f\u5355\u7684\u65f6\u5019\u624d\u4f1a\u67e5\u770b\u8fd9\u4e9b\u8ba2\u5355\uff0c\u91cc\u9762\u7684\u4fe1\u606f\u8ddf\u6b63\u5e38\u8ba2\u5355\u76f8\u6bd4\u4f1a\u5c11\u4e00\u4e2a\u4ea4\u6613\u53f7\uff0c\u4f46\u662f\u81f3\u5c11\u662f\u53ef\u4ee5\u770b\u5230\u5ba2\u6237\u4fe1\u606f\u53ca\u6240\u8d2d\u4e70\u4e86\u4ec0\u4e48\u4ea7\u54c1\u2026 \u5728\u786e\u8ba4\u9875\u9762\uff0c\u5982\u679c\u987e\u5ba2\u4e00\u76f4\u5237\u65b0\u9875\u9762\uff0c\u5c31\u4f1a\u4e00\u76f4\u751f\u6210\u8ba2\u5355\uff0c\u53ef\u4ee5\u52a0\u4e2a\u9650\u5236. &lt;?php \/\/ create the order record [&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-60771","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/60771","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=60771"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/60771\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=60771"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=60771"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=60771"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}