首頁 後端開發 php教程 Zencart先生成订单后付款,相仿淘宝后台修改订单价格

Zencart先生成订单后付款,相仿淘宝后台修改订单价格

Jun 13, 2016 pm 12:22 PM
gt lt order

Zencart先生成订单后付款,类似淘宝后台修改订单价格

Zencart 使用 Paypal 付款,会出现漏单的情况,即 paypal 已经收到客户的付款,但是网站后台没有客户的订单。导致 paypal 漏单的原因大致会是当客户跳转到Paypal 网站付款完毕之后,直接关闭了窗口,或者网络不稳定,没有正常跳转到网站。

解决 Paypal 漏单问题的方案有好几种:

 

一. 开启 Detailed Line Items in Cart 选项。

原理:在 zencart 后台 Module --> Payment --> PayPal Website Payments Standard - IPN 开启 Detailed Line Items in Cart 选项。这个选项会把你所有的订单物品信息传给 paypal,当客户付款成功而后台未能成功生成订单时,也可以通过 paypal 帐号交易信息看到客户购买了哪些物品。

 

二. 使用 Paypal Sessions Viewer 插件找回 Paypal 漏掉的订单。

原理:zencart 购物车的物品,通过 paypal 方式付款,会在 paypal_session 表中保存此次付款的所有记录,如果付款成功后,从 paypal 网站跳转到购物网站并生成了订单时,zencart系统会自动删除这条 paypal_session 记录,如果没有成功跳转到购物网站,没有成功生成订单,那这条付款记录数据就会一直保存在数据库,当使用 Paypal Session Viewer 插件,就能查看这条记录的所有数据,包括客户信息,购物时间,商品信息,如果你确定已收到款,就可以把这条 paypal_session 信息转移到订单中,生成一个订单。

插件下载地址:http://www.zen-cart.cn/english-version-modules/admin-tools/paypal-sessions-viewer

 

三. 修改付款流程,先生成订单后付款。

原理:用过zen-cart的人都知道,zen-cart中下单步骤是下面这样的(其中[]中的表示不是必须的):

1. 购物车(shopping cart)

2. [货运方式(delivery method)]

3. 支付方式(payment method)

4. 订单确认(confirmation)

5. [第三方网站支付]

6. 订单处理(checkout process)——这一步比较重要,因为会在这里将购物车中的信息写入订单

7. 下单成功(checkout success)

这样的流程在正常情况下是没有任何问题的。但是,从第5步到第6部的过程中,用户可能以为付款成功就直接关闭掉网页了,或者由于网络原因造成不能正常跳转到checkout_process页面,这样造成的后果是很严重的,因为订单不能被正常的创建。基于上述的分析, 我们希望稍微地改变一下流程,即在支付之前订单已经创建好了,这样就算在支付时不能从第三方支付网站跳转回来,我们也不会存在用户付款成功却在后台没有订单的情况了。

本人是参照东国先生的这篇 修改zen-cart下单和付款流程以防止漏单 教程去修改的,因为这个教程比较老,而且也没有很全面,所以我根据自己的实际需求,把他做的更完善,更细节化。

经过修改后的蓝图基本是下面这样的:

1. 在checkour_confirmation页面确认订单后,都会直接proccess,并且进入 account_history_info 页面,可以在这里进入付款页面。如下图所示:

2. 如果当时客户没能付款,也可进入自己的后台对历史订单进行付款。如下图所示:

 

3. 未付款的订单,可以在后台修改价格,像淘宝一样拍下宝贝后,店主给你修改价格后再付款一样。如下图所示:

下面我们来正式修改代码,首先我列举出所有要修改的文件:

1. includes/classes/payment.php

2. includes/modules/payment/paypal.php

3. includes/classes/order.php

4. includes/modules/pages/checkout_process/header_php.php

5. includes/modules/pages/account_history_info/header_php.php

6. includes/templates/你的模板目录/templates/tpl_account_history_info_default.php

7. includes/templates/你的模板目录/templates/tpl_account_history_default.php

8. ipn_main_handler.php

9. admin(后台目录)/orders.php

因为先生成订单再付款,付款步骤就会比原来又多了一步,为了简化付款流程,我安装了 Fast And Easy Checkout For Zencart(快速支付) 插件,安装此插件之前,需要安装另外一个插件 Css Js Loader For Zencart,这是快速支付插件的依赖插件。快速支付与先生成订单后支付没什么因果关系,所以如果你不想安装的话完全可以不理。

按步骤修改上面列举的文件:

1. 首先我们需要对现有的支付模块进行一个改造。需要对支付方式的class增加一个字段paynow_action_url,用来表示进行支付的页面 url,另外还需要增加一个函数,paynow_button($order_id),来获取支付表单的参数隐藏域代码。

要增加 paynow_action_url 变量,请在类payment的构造函数中最后加上下面的代码:    

<span style="color: #0000ff;">if</span> ( (zen_not_null(<span style="color: #800080;">$module</span>)) && (<span style="color: #008080;">in_array</span>(<span style="color: #800080;">$module</span>.'.php', <span style="color: #800080;">$this</span>->modules)) && (<span style="color: #0000ff;">isset</span>(<span style="color: #800080;">$GLOBALS</span>[<span style="color: #800080;">$module</span>]-><span style="color: #000000;">paynow_action_url)) ) {        </span><span style="color: #800080;">$this</span>->paynow_action_url = <span style="color: #800080;">$GLOBALS</span>[<span style="color: #800080;">$module</span>]-><span style="color: #000000;">paynow_action_url;        }</span>
登入後複製

 

要增加paynow_button($order_id)函数,请在payment类的最后一个函数之后加上如下的代码:

<span style="color: #0000ff;">function</span> paynow_button(<span style="color: #800080;">$order_id</span><span style="color: #000000;">){    </span><span style="color: #0000ff;">if</span> (<span style="color: #008080;">is_array</span>(<span style="color: #800080;">$this</span>-><span style="color: #000000;">modules)) {      </span><span style="color: #0000ff;">if</span> (<span style="color: #008080;">is_object</span>(<span style="color: #800080;">$GLOBALS</span>[<span style="color: #800080;">$this</span>-><span style="color: #000000;">selected_module])) {        </span><span style="color: #0000ff;">return</span> <span style="color: #800080;">$GLOBALS</span>[<span style="color: #800080;">$this</span>->selected_module]->paynow_button(<span style="color: #800080;">$order_id</span><span style="color: #000000;">);      }    }}</span>
登入後複製

 

2. 以paypal支付方式为例子,说明如何具体实现。这里直接修改 paypal.php 文件,注意备份此文件。代码如下所示,可以看到,这里去掉了对 form_action_url 的指定,并给定了 paynow_action_url,因为我们希望用户点击“确认订单”后直接进入checkout_process,所以如果不指定 form_action_url,那么确认订单的表单就会直接提交到 checkout_process 页面了,而 paynow_action_url 就是 以前的 form_action_url 的值。paynow_button 函数的实现也很简单,这里只是将原先的 process_button() 函数的内容剪切过来而已,只不过我们没有使用全局的$order变量,而是使用 $order = new order($order_id),来重新构造的一个对象,这样做是为在历史订单中显示pay now按钮做准备的。paypal.php修改后的文件如下:

<span style="color: #008080;">  1</span> <span style="color: #000000;">php</span><span style="color: #008080;">  2</span> <span style="color: #008000;">/*</span><span style="color: #008000;">*</span><span style="color: #008080;">  3</span> <span style="color: #008000;"> * paypal.php payment module class for PayPal Website Payments Standard (IPN) method</span><span style="color: #008080;">  4</span> <span style="color: #008000;"> *</span><span style="color: #008080;">  5</span> <span style="color: #008000;"> * @package paymentMethod</span><span style="color: #008080;">  6</span> <span style="color: #008000;"> * @copyright Copyright 2003-2010 Zen Cart Development Team</span><span style="color: #008080;">  7</span> <span style="color: #008000;"> * @copyright Portions Copyright 2003 osCommerce</span><span style="color: #008080;">  8</span> <span style="color: #008000;"> * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0</span><span style="color: #008080;">  9</span> <span style="color: #008000;"> * @version $Id: paypal.php 15735 2010-03-29 07:13:53Z drbyte $</span><span style="color: #008080;"> 10</span>  <span style="color: #008000;">*/</span><span style="color: #008080;"> 11</span> <span style="color: #008080;"> 12</span> <span style="color: #008080;">define</span>('MODULE_PAYMENT_PAYPAL_TAX_OVERRIDE', 'true'<span style="color: #000000;">);</span><span style="color: #008080;"> 13</span> <span style="color: #008080;"> 14</span> <span style="color: #008000;">/*</span><span style="color: #008000;">*</span><span style="color: #008080;"> 15</span> <span style="color: #008000;"> *  ensure dependencies are loaded</span><span style="color: #008080;"> 16</span>  <span style="color: #008000;">*/</span><span style="color: #008080;"> 17</span>   <span style="color: #0000ff;">include_once</span>((IS_ADMIN_FLAG === <span style="color: #0000ff;">true</span> ? DIR_FS_CATALOG_MODULES : DIR_WS_MODULES) . 'payment/paypal/paypal_functions.php'<span style="color: #000000;">);</span><span style="color: #008080;"> 18</span> <span style="color: #008080;"> 19</span> <span style="color: #008000;">/*</span><span style="color: #008000;">*</span><span style="color: #008080;"> 20</span> <span style="color: #008000;"> * paypal.php payment module class for PayPal Website Payments Standard (IPN) method</span><span style="color: #008080;"> 21</span> <span style="color: #008000;"> *</span><span style="color: #008080;"> 22</span>  <span style="color: #008000;">*/</span><span style="color: #008080;"> 23</span> <span style="color: #0000ff;">class</span> paypal <span style="color: #0000ff;">extends</span><span style="color: #000000;"> base {</span><span style="color: #008080;"> 24</span>   <span style="color: #008000;">/*</span><span style="color: #008000;">*</span><span style="color: #008080;"> 25</span> <span style="color: #008000;">   * string representing the payment method</span><span style="color: #008080;"> 26</span> <span style="color: #008000;">   *</span><span style="color: #008080;"> 27</span> <span style="color: #008000;">   * @var string</span><span style="color: #008080;"> 28</span>    <span style="color: #008000;">*/</span><span style="color: #008080;"> 29</span>   <span style="color: #0000ff;">var</span> <span style="color: #800080;">$code</span><span style="color: #000000;">;</span><span style="color: #008080;"> 30</span>   <span style="color: #008000;">/*</span><span style="color: #008000;">*</span><span style="color: #008080;"> 31</span> <span style="color: #008000;">   * $title is the displayed name for this payment method</span><span style="color: #008080;"> 32</span> <span style="color: #008000;">   *</span><span style="color: #008080;"> 33</span> <span style="color: #008000;">   * @var string</span><span style="color: #008080;"> 34</span>     <span style="color: #008000;">*/</span><span style="color: #008080;"> 35</span>   <span style="color: #0000ff;">var</span> <span style="color: #800080;">$title</span><span style="color: #000000;">;</span><span style="color: #008080;"> 36</span>   <span style="color: #008000;">/*</span><span style="color: #008000;">*</span><span style="color: #008080;"> 37</span> <span style="color: #008000;">   * $description is a soft name for this payment method</span><span style="color: #008080;"> 38</span> <span style="color: #008000;">   *</span><span style="color: #008080;"> 39</span> <span style="color: #008000;">   * @var string</span><span style="color: #008080;"> 40</span>     <span style="color: #008000;">*/</span><span style="color: #008080;"> 41</span>   <span style="color: #0000ff;">var</span> <span style="color: #800080;">$description</span><span style="color: #000000;">;</span><span style="color: #008080;"> 42</span>   <span style="color: #008000;">/*</span><span style="color: #008000;">*</span><span style="color: #008080;"> 43</span> <span style="color: #008000;">   * $enabled determines whether this module shows or not... in catalog.</span><span style="color: #008080;"> 44</span> <span style="color: #008000;">   *</span><span style="color: #008080;"> 45</span> <span style="color: #008000;">   * @var boolean</span><span style="color: #008080;"> 46</span>     <span style="color: #008000;">*/</span><span style="color: #008080;"> 47</span>   <span style="color: #0000ff;">var</span> <span style="color: #800080;">$enabled</span><span style="color: #000000;">;</span><span style="color: #008080;"> 48</span>   <span style="color: #008000;">/*</span><span style="color: #008000;">*</span><span style="color: #008080;"> 49</span> <span style="color: #008000;">    * constructor</span><span style="color: #008080;"> 50</span> <span style="color: #008000;">    *</span><span style="color: #008080;"> 51</span> <span style="color: #008000;">    * @param int $paypal_ipn_id</span><span style="color: #008080;"> 52</span> <span style="color: #008000;">    * @return paypal</span><span style="color: #008080;"> 53</span>     <span style="color: #008000;">*/</span><span style="color: #008080;"> 54</span>   <span style="color: #0000ff;">function</span> paypal(<span style="color: #800080;">$paypal_ipn_id</span> = ''<span style="color: #000000;">) {</span><span style="color: #008080;"> 55</span>     <span style="color: #0000ff;">global</span> <span style="color: #800080;">$order</span>, <span style="color: #800080;">$messageStack</span><span style="color: #000000;">;</span><span style="color: #008080;"> 56</span>     <span style="color: #800080;">$this</span>->code = 'paypal'<span style="color: #000000;">;</span><span style="color: #008080;"> 57</span>     <span style="color: #800080;">$this</span>->codeVersion = '1.3.9'<span style="color: #000000;">;</span><span style="color: #008080;"> 58</span>     <span style="color: #0000ff;">if</span> (IS_ADMIN_FLAG === <span style="color: #0000ff;">true</span><span style="color: #000000;">) {</span><span style="color: #008080;"> 59</span>       <span style="color: #800080;">$this</span>->title = MODULE_PAYMENT_PAYPAL_TEXT_ADMIN_TITLE; <span style="color: #008000;">//</span><span style="color: #008000;"> Payment Module title in Admin</span><span style="color: #008080;"> 60</span>       <span style="color: #0000ff;">if</span> (IS_ADMIN_FLAG === <span style="color: #0000ff;">true</span> && <span style="color: #008080;">defined</span>('MODULE_PAYMENT_PAYPAL_IPN_DEBUG') && MODULE_PAYMENT_PAYPAL_IPN_DEBUG != 'Off') <span style="color: #800080;">$this</span>->title .= '<span class="alert"> (debug mode active)</span>'<span style="color: #000000;">;</span><span style="color: #008080;"> 61</span>       <span style="color: #0000ff;">if</span> (IS_ADMIN_FLAG === <span style="color: #0000ff;">true</span> && MODULE_PAYMENT_PAYPAL_TESTING == 'Test') <span style="color: #800080;">$this</span>->title .= '<span class="alert"> (dev/test mode active)</span>'<span style="color: #000000;">;</span><span style="color: #008080;"> 62</span>     } <span style="color: #0000ff;">else</span><span style="color: #000000;"> {</span><span style="color: #008080;"> 63</span>       <span style="color: #800080;">$this</span>->title = MODULE_PAYMENT_PAYPAL_TEXT_CATALOG_TITLE; <span style="color: #008000;">//</span><span style="color: #008000;"> Payment Module title in Catalog</span><span style="color: #008080;"> 64</span> <span style="color: #000000;">    }</span><span style="color: #008080;"> 65</span>     <span style="color: #800080;">$this</span>->description =<span style="color: #000000;"> MODULE_PAYMENT_PAYPAL_TEXT_DESCRIPTION;</span><span style="color: #008080;"> 66</span>     <span style="color: #800080;">$this</span>->sort_order =<span style="color: #000000;"> MODULE_PAYMENT_PAYPAL_SORT_ORDER;</span><span style="color: #008080;"> 67</span>     <span style="color: #800080;">$this</span>->enabled = ((MODULE_PAYMENT_PAYPAL_STATUS == 'True') ? <span style="color: #0000ff;">true</span> : <span style="color: #0000ff;">false</span><span style="color: #000000;">);</span><span style="color: #008080;"> 68</span>     <span style="color: #0000ff;">if</span> ((int)MODULE_PAYMENT_PAYPAL_ORDER_STATUS_ID > 0<span style="color: #000000;">) {</span><span style="color: #008080;"> 69</span>       <span style="color: #800080;">$this</span>->order_status =<span style="color: #000000;"> MODULE_PAYMENT_PAYPAL_ORDER_STATUS_ID;</span><span style="color: #008080;"> 70</span> <span style="color: #000000;">    }</span><span style="color: #008080;"> 71</span>     <span style="color: #0000ff;">if</span> (<span style="color: #008080;">is_object</span>(<span style="color: #800080;">$order</span>)) <span style="color: #800080;">$this</span>-><span style="color: #000000;">update_status();</span><span style="color: #008080;"> 72</span>     <span style="color: #800080;">$this</span>->paynow_action_url = 'https://' .<span style="color: #000000;"> MODULE_PAYMENT_PAYPAL_HANDLER;</span><span style="color: #008080;"> 73</span> <span style="color: #008080;"> 74</span>     <span style="color: #0000ff;">if</span> (PROJECT_VERSION_MAJOR != '1' && <span style="color: #008080;">substr</span>(PROJECT_VERSION_MINOR, 0, 3) != '3.9') <span style="color: #800080;">$this</span>->enabled = <span style="color: #0000ff;">false</span><span style="color: #000000;">;</span><span style="color: #008080;"> 75</span> <span style="color: #008080;"> 76</span>     <span style="color: #008000;">//</span><span style="color: #008000;"> verify table structure</span><span style="color: #008080;"> 77</span>     <span style="color: #0000ff;">if</span> (IS_ADMIN_FLAG === <span style="color: #0000ff;">true</span>) <span style="color: #800080;">$this</span>-><span style="color: #000000;">tableCheckup();</span><span style="color: #008080;"> 78</span> <span style="color: #000000;">  }</span><span style="color: #008080;"> 79</span>   <span style="color: #008000;">/*</span><span style="color: #008000;">*</span><span style="color: #008080;"> 80</span> <span style="color: #008000;">   * calculate zone matches and flag settings to determine whether this module should display to customers or not</span><span style="color: #008080;"> 81</span> <span style="color: #008000;">    *</span><span style="color: #008080;"> 82</span>     <span style="color: #008000;">*/</span><span style="color: #008080;"> 83</span>   <span style="color: #0000ff;">function</span><span style="color: #000000;"> update_status() {</span><span style="color: #008080;"> 84</span>     <span style="color: #0000ff;">global</span> <span style="color: #800080;">$order</span>, <span style="color: #800080;">$db</span><span style="color: #000000;">;</span><span style="color: #008080;"> 85</span> <span style="color: #008080;"> 86</span>     <span style="color: #0000ff;">if</span> ( (<span style="color: #800080;">$this</span>->enabled == <span style="color: #0000ff;">true</span>) && ((int)MODULE_PAYMENT_PAYPAL_ZONE > 0<span style="color: #000000;">) ) {</span><span style="color: #008080;"> 87</span>       <span style="color: #800080;">$check_flag</span> = <span style="color: #0000ff;">false</span><span style="color: #000000;">;</span><span style="color: #008080;"> 88</span>       <span style="color: #800080;">$check_query</span> = <span style="color: #800080;">$db</span>->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_PAYPAL_ZONE . "' and zone_country_id = '" . <span style="color: #800080;">$order</span>->billing['country']['id'] . "' order by zone_id"<span style="color: #000000;">);</span><span style="color: #008080;"> 89</span>       <span style="color: #0000ff;">while</span> (!<span style="color: #800080;">$check_query</span>-><span style="color: #000000;">EOF) {</span><span style="color: #008080;"> 90</span>         <span style="color: #0000ff;">if</span> (<span style="color: #800080;">$check_query</span>->fields['zone_id'] ) {<span style="color: #008080;"> 91</span>           <span style="color: #800080;">$check_flag</span> = <span style="color: #0000ff;">true</span><span style="color: #000000;">;</span><span style="color: #008080;"> 92</span>           <span style="color: #0000ff;">break</span><span style="color: #000000;">;</span><span style="color: #008080;"> 93</span>         } <span style="color: #0000ff;">elseif</span> (<span style="color: #800080;">$check_query</span>->fields['zone_id'] == <span style="color: #800080;">$order</span>->billing['zone_id'<span style="color: #000000;">]) {</span><span style="color: #008080;"> 94</span>           <span style="color: #800080;">$check_flag</span> = <span style="color: #0000ff;">true</span><span style="color: #000000;">;</span><span style="color: #008080;"> 95</span>           <span style="color: #0000ff;">break</span><span style="color: #000000;">;</span><span style="color: #008080;"> 96</span> <span style="color: #000000;">        }</span><span style="color: #008080;"> 97</span>         <span style="color: #800080;">$check_query</span>-><span style="color: #000000;">MoveNext();</span><span style="color: #008080;"> 98</span> <span style="color: #000000;">      }</span><span style="color: #008080;"> 99</span> <span style="color: #008080;">100</span>       <span style="color: #0000ff;">if</span> (<span style="color: #800080;">$check_flag</span> == <span style="color: #0000ff;">false</span><span style="color: #000000;">) {</span><span style="color: #008080;">101</span>         <span style="color: #800080;">$this</span>->enabled = <span style="color: #0000ff;">false</span><span style="color: #000000;">;</span><span style="color: #008080;">102</span> <span style="color: #000000;">      }</span><span style="color: #008080;">103</span> <span style="color: #000000;">    }</span><span style="color: #008080;">104</span> <span style="color: #000000;">  }</span><span style="color: #008080;">105</span>   <span style="color: #008000;">/*</span><span style="color: #008000;">*</span><span style="color: #008080;">106</span> <span style="color: #008000;">   * JS validation which does error-checking of data-entry if this module is selected for use</span><span style="color: #008080;">107</span> <span style="color: #008000;">   * (Number, Owner, and CVV Lengths)</span><span style="color: #008080;">108</span> <span style="color: #008000;">   *</span><span style="color: #008080;">109</span> <span style="color: #008000;">   * @return string</span><span style="color: #008080;">110</span>     <span style="color: #008000;">*/</span><span style="color: #008080;">111</span>   <span style="color: #0000ff;">function</span><span style="color: #000000;"> javascript_validation() {</span><span style="color: #008080;">112</span>     <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">false</span><span style="color: #000000;">;</span><span style="color: #008080;">113</span> <span style="color: #000000;">  }</span><span style="color: #008080;">114</span>   <span style="color: #008000;">/*</span><span style="color: #008000;">*</span><span style="color: #008080;">115</span> <span style="color: #008000;">   * Displays payment method name along with Credit Card Information Submission Fields (if any) on the Checkout Payment Page</span><span style="color: #008080;">116</span> <span style="color: #008000;">   *</span><span style="color: #008080;">117</span> <span style="color: #008000;">   * @return array</span><span style="color: #008080;">118</span>     <span style="color: #008000;">*/</span><span style="color: #008080;">119</span>   <span style="color: #0000ff;">function</span><span style="color: #000000;"> selection() {</span><span style="color: #008080;">120</span>     <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">array</span>('id' => <span style="color: #800080;">$this</span>->code,<span style="color: #008080;">121</span>                  'module' => MODULE_PAYMENT_PAYPAL_TEXT_CATALOG_LOGO,<span style="color: #008080;">122</span>                  'icon' =><span style="color: #000000;"> MODULE_PAYMENT_PAYPAL_TEXT_CATALOG_LOGO</span><span style="color: #008080;">123</span> <span style="color: #000000;">                 );</span><span style="color: #008080;">124</span> <span style="color: #000000;">  }</span><span style="color: #008080;">125</span>   <span style="color: #008000;">/*</span><span style="color: #008000;">*</span><span style="color: #008080;">126</span> <span style="color: #008000;">   * Normally evaluates the Credit Card Type for acceptance and the validity of the Credit Card Number & Expiration Date</span><span style="color: #008080;">127</span> <span style="color: #008000;">   * Since paypal module is not collecting info, it simply skips this step.</span><span style="color: #008080;">128</span> <span style="color: #008000;">   *</span><span style="color: #008080;">129</span> <span style="color: #008000;">   * @return boolean</span><span style="color: #008080;">130</span>    <span style="color: #008000;">*/</span><span style="color: #008080;">131</span>   <span style="color: #0000ff;">function</span><span style="color: #000000;"> pre_confirmation_check() {</span><span style="color: #008080;">132</span>     <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">false</span><span style="color: #000000;">;</span><span style="color: #008080;">133</span> <span style="color: #000000;">  }</span><span style="color: #008080;">134</span>   <span style="color: #008000;">/*</span><span style="color: #008000;">*</span><span style="color: #008080;">135</span> <span style="color: #008000;">   * Display Credit Card Information on the Checkout Confirmation Page</span><span style="color: #008080;">136</span> <span style="color: #008000;">   * Since none is collected for paypal before forwarding to paypal site, this is skipped</span><span style="color: #008080;">137</span> <span style="color: #008000;">   *</span><span style="color: #008080;">138</span> <span style="color: #008000;">   * @return boolean</span><span style="color: #008080;">139</span>     <span style="color: #008000;">*/</span><span style="color: #008080;">140</span>   <span style="color: #0000ff;">function</span><span style="color: #000000;"> confirmation() {</span><span style="color: #008080;">141</span>     <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">false</span><span style="color: #000000;">;</span><span style="color: #008080;">142</span> <span style="color: #000000;">  }</span><span style="color: #008080;">143</span>   <span style="color: #008000;">/*</span><span style="color: #008000;">*</span><span style="color: #008080;">144</span> <span style="color: #008000;">   * Build the data and actions to process when the "Submit" button is pressed on the order-confirmation screen.</span><span style="color: #008080;">145</span> <span style="color: #008000;">   * This sends the data to the payment gateway for processing.</span><span style="color: #008080;">146</span> <span style="color: #008000;">   * (These are hidden fields on the checkout confirmation page)</span><span style="color: #008080;">147</span> <span style="color: #008000;">   *</span><span style="color: #008080;">148</span> <span style="color: #008000;">   * @return string</span><span style="color: #008080;">149</span>     <span style="color: #008000;">*/</span><span style="color: #008080;">150</span>   <span style="color: #0000ff;">function</span><span style="color: #000000;"> process_button() {</span><span style="color: #008080;">151</span>     <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">false</span><span style="color: #000000;">;</span><span style="color: #008080;">152</span> <span style="color: #000000;">  }</span><span style="color: #008080;">153</span>   <span style="color: #008000;">/*</span><span style="color: #008000;">*</span><span style="color: #008080;">154</span> <span style="color: #008000;">   * Determine the language to use when visiting the PayPal site</span><span style="color: #008080;">155</span>    <span style="color: #008000;">*/</span><span style="color: #008080;">156</span>   <span style="color: #0000ff;">function</span><span style="color: #000000;"> getLanguageCode() {</span><span style="color: #008080;">157</span>     <span style="color: #0000ff;">global</span> <span style="color: #800080;">$order</span><span style="color: #000000;">;</span><span style="color: #008080;">158</span>     <span style="color: #800080;">$lang_code</span> = ''<span style="color: #000000;">;</span><span style="color: #008080;">159</span>     <span style="color: #800080;">$orderISO</span> = zen_get_countries(<span style="color: #800080;">$order</span>->customer['country']['id'], <span style="color: #0000ff;">true</span><span style="color: #000000;">);</span><span style="color: #008080;">160</span>     <span style="color: #800080;">$storeISO</span> = zen_get_countries(STORE_COUNTRY, <span style="color: #0000ff;">true</span><span style="color: #000000;">);</span><span style="color: #008080;">161</span>     <span style="color: #0000ff;">if</span> (<span style="color: #008080;">in_array</span>(<span style="color: #008080;">strtoupper</span>(<span style="color: #800080;">$orderISO</span>['countries_iso_code_2']), <span style="color: #0000ff;">array</span>('US', 'AU', 'DE', 'FR', 'IT', 'GB', 'ES', 'AT', 'BE', 'CA', 'CH', 'CN', 'NL', 'PL'<span style="color: #000000;">))) {</span><span style="color: #008080;">162</span>       <span style="color: #800080;">$lang_code</span> = <span style="color: #008080;">strtoupper</span>(<span style="color: #800080;">$orderISO</span>['countries_iso_code_2'<span style="color: #000000;">]);</span><span style="color: #008080;">163</span>     } <span style="color: #0000ff;">elseif</span> (<span style="color: #008080;">in_array</span>(<span style="color: #008080;">strtoupper</span>(<span style="color: #800080;">$storeISO</span>['countries_iso_code_2']), <span style="color: #0000ff;">array</span>('US', 'AU', 'DE', 'FR', 'IT', 'GB', 'ES', 'AT', 'BE', 'CA', 'CH', 'CN', 'NL', 'PL'<span style="color: #000000;">))) {</span><span style="color: #008080;">164</span>       <span style="color: #800080;">$lang_code</span> = <span style="color: #008080;">strtoupper</span>(<span style="color: #800080;">$storeISO</span>['countries_iso_code_2'<span style="color: #000000;">]);</span><span style="color: #008080;">165</span>     } <span style="color: #0000ff;">elseif</span> (<span style="color: #008080;">in_array</span>(<span style="color: #008080;">strtoupper</span>(<span style="color: #800080;">$_SESSION</span>['languages_code']), <span style="color: #0000ff;">array</span>('EN', 'US', 'AU', 'DE', 'FR', 'IT', 'GB', 'ES', 'AT', 'BE', 'CA', 'CH', 'CN', 'NL', 'PL'<span style="color: #000000;">))) {</span><span style="color: #008080;">166</span>       <span style="color: #800080;">$lang_code</span> = <span style="color: #800080;">$_SESSION</span>['languages_code'<span style="color: #000000;">];</span><span style="color: #008080;">167</span>       <span style="color: #0000ff;">if</span> (<span style="color: #008080;">strtoupper</span>(<span style="color: #800080;">$lang_code</span>) == 'EN') <span style="color: #800080;">$lang_code</span> = 'US'<span style="color: #000000;">;</span><span style="color: #008080;">168</span> <span style="color: #000000;">    }</span><span style="color: #008080;">169</span>     <span style="color: #008000;">//</span><span style="color: #008000;">return $orderISO['countries_iso_code_2'];</span><span style="color: #008080;">170</span>     <span style="color: #0000ff;">return</span> <span style="color: #008080;">strtoupper</span>(<span style="color: #800080;">$lang_code</span><span style="color: #000000;">);</span><span style="color: #008080;">171</span> <span style="color: #000000;">  }</span><span style="color: #008080;">172</span>   <span style="color: #008000;">/*</span><span style="color: #008000;">*</span><span style="color: #008080;">173</span> <span style="color: #008000;">   * Store transaction info to the order and process any results that come back from the payment gateway</span><span style="color: #008080;">174</span>    <span style="color: #008000;">*/</span><span style="color: #008080;">175</span>   <span style="color: #0000ff;">function</span><span style="color: #000000;"> before_process() {</span><span style="color: #008080;">176</span>     <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">false</span><span style="color: #000000;">;</span><span style="color: #008080;">177</span> <span style="color: #000000;">  }</span><span style="color: #008080;">178</span>   <span style="color: #008000;">/*</span><span style="color: #008000;">*</span><span style="color: #008080;">179</span> <span style="color: #008000;">    * Checks referrer</span><span style="color: #008080;">180</span> <span style="color: #008000;">    *</span><span style="color: #008080;">181</span> <span style="color: #008000;">    * @param string $zf_domain</span><span style="color: #008080;">182</span> <span style="color: #008000;">    * @return boolean</span><span style="color: #008080;">183</span>     <span style="color: #008000;">*/</span><span style="color: #008080;">184</span>   <span style="color: #0000ff;">function</span> check_referrer(<span style="color: #800080;">$zf_domain</span><span style="color: #000000;">) {</span><span style="color: #008080;">185</span>     <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">true</span><span style="color: #000000;">;</span><span style="color: #008080;">186</span> <span style="color: #000000;">  }</span><span style="color: #008080;">187</span>   <span style="color: #008000;">/*</span><span style="color: #008000;">*</span><span style="color: #008080;">188</span> <span style="color: #008000;">    * Build admin-page components</span><span style="color: #008080;">189</span> <span style="color: #008000;">    *</span><span style="color: #008080;">190</span> <span style="color: #008000;">    * @param int $zf_order_id</span><span style="color: #008080;">191</span> <span style="color: #008000;">    * @return string</span><span style="color: #008080;">192</span>     <span style="color: #008000;">*/</span><span style="color: #008080;">193</span>   <span style="color: #0000ff;">function</span> admin_notification(<span style="color: #800080;">$zf_order_id</span><span style="color: #000000;">) {</span><span style="color: #008080;">194</span>     <span style="color: #0000ff;">global</span> <span style="color: #800080;">$db</span><span style="color: #000000;">;</span><span style="color: #008080;">195</span>     <span style="color: #800080;">$output</span> = ''<span style="color: #000000;">;</span><span style="color: #008080;">196</span>     <span style="color: #800080;">$sql</span> = "select * from " . TABLE_PAYPAL . " where order_id = '" . (int)<span style="color: #800080;">$zf_order_id</span> . "' order by paypal_ipn_id DESC LIMIT 1"<span style="color: #000000;">;</span><span style="color: #008080;">197</span>     <span style="color: #800080;">$ipn</span> = <span style="color: #800080;">$db</span>->Execute(<span style="color: #800080;">$sql</span><span style="color: #000000;">);</span><span style="color: #008080;">198</span>     <span style="color: #0000ff;">if</span> (<span style="color: #800080;">$ipn</span>->RecordCount() > 0 && <span style="color: #008080;">file_exists</span>(DIR_FS_CATALOG . DIR_WS_MODULES . 'payment/paypal/paypal_admin_notification.php')) <span style="color: #0000ff;">require</span>(DIR_FS_CATALOG . DIR_WS_MODULES . 'payment/paypal/paypal_admin_notification.php'<span style="color: #000000;">);</span><span style="color: #008080;">199</span>     <span style="color: #0000ff;">return</span> <span style="color: #800080;">$output</span><span style="color: #000000;">;</span><span style="color: #008080;">200</span> <span style="color: #000000;">  }</span><span style="color: #008080;">201</span>   <span style="color: #008000;">/*</span><span style="color: #008000;">*</span><span style="color: #008080;">202</span> <span style="color: #008000;">   * Post-processing activities</span><span style="color: #008080;">203</span> <span style="color: #008000;">   * When the order returns from the processor, if PDT was successful, this stores the results in order-status-history and logs data for subsequent reference</span><span style="color: #008080;">204</span> <span style="color: #008000;">   *</span><span style="color: #008080;">205</span> <span style="color: #008000;">   * @return boolean</span><span style="color: #008080;">206</span>     <span style="color: #008000;">*/</span><span style="color: #008080;">207</span>   <span style="color: #0000ff;">function</span><span style="color: #000000;"> after_process() {</span><span style="color: #008080;">208</span>     <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">false</span><span style="color: #000000;">;</span><span style="color: #008080;">209</span> <span style="color: #000000;">  }</span><span style="color: #008080;">210</span>   <span style="color: #008000;">/*</span><span style="color: #008000;">*</span><span style="color: #008080;">211</span> <span style="color: #008000;">   * Used to display error message details</span><span style="color: #008080;">212</span> <span style="color: #008000;">   *</span><span style="color: #008080;">213</span> <span style="color: #008000;">   * @return boolean</span><span style="color: #008080;">214</span>     <span style="color: #008000;">*/</span><span style="color: #008080;">215</span>   <span style="color: #0000ff;">function</span><span style="color: #000000;"> output_error() {</span><span style="color: #008080;">216</span>     <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">false</span><span style="color: #000000;">;</span><span style="color: #008080;">217</span> <span style="color: #000000;">  }</span><span style="color: #008080;">218</span>   <span style="color: #008000;">/*</span><span style="color: #008000;">*</span><span style="color: #008080;">219</span> <span style="color: #008000;">   * Check to see whether module is installed</span><span style="color: #008080;">220</span> <span style="color: #008000;">   *</span><span style="color: #008080;">221</span> <span style="color: #008000;">   * @return boolean</span><span style="color: #008080;">222</span>     <span style="color: #008000;">*/</span><span style="color: #008080;">223</span>   <span style="color: #0000ff;">function</span><span style="color: #000000;"> check() {</span><span style="color: #008080;">224</span>     <span style="color: #0000ff;">global</span> <span style="color: #800080;">$db</span><span style="color: #000000;">;</span><span style="color: #008080;">225</span>     <span style="color: #0000ff;">if</span> (IS_ADMIN_FLAG === <span style="color: #0000ff;">true</span><span style="color: #000000;">) {</span><span style="color: #008080;">226</span>       <span style="color: #0000ff;">global</span> <span style="color: #800080;">$sniffer</span><span style="color: #000000;">;</span><span style="color: #008080;">227</span>       <span style="color: #0000ff;">if</span> (<span style="color: #800080;">$sniffer</span>->field_exists(TABLE_PAYPAL, 'zen_order_id'))  <span style="color: #800080;">$db</span>->Execute("ALTER TABLE " . TABLE_PAYPAL . " CHANGE COLUMN zen_order_id order_id int(11) NOT NULL default '0'"<span style="color: #000000;">);</span><span style="color: #008080;">228</span> <span style="color: #000000;">    }</span><span style="color: #008080;">229</span>     <span style="color: #0000ff;">if</span> (!<span style="color: #0000ff;">isset</span>(<span style="color: #800080;">$this</span>-><span style="color: #000000;">_check)) {</span><span style="color: #008080;">230</span>       <span style="color: #800080;">$check_query</span> = <span style="color: #800080;">$db</span>->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_PAYPAL_STATUS'"<span style="color: #000000;">);</span><span style="color: #008080;">231</span>       <span style="color: #800080;">$this</span>->_check = <span style="color: #800080;">$check_query</span>-><span style="color: #000000;">RecordCount();</span><span style="color: #008080;">232</span> <span style="color: #000000;">    }</span><span style="color: #008080;">233</span>     <span style="color: #0000ff;">return</span> <span style="color: #800080;">$this</span>-><span style="color: #000000;">_check;</span><span style="color: #008080;">234</span> <span style="color: #000000;">  }</span><span style="color: #008080;">235</span>   <span style="color: #008000;">/*</span><span style="color: #008000;">*</span><span style="color: #008080;">236</span> <span style="color: #008000;">   * Install the payment module and its configuration settings</span><span style="color: #008080;">237</span> <span style="color: #008000;">    *</span><span style="color: #008080;">238</span>     <span style="color: #008000;">*/</span><span style="color: #008080;">239</span>   <span style="color: #0000ff;">function</span><span style="color: #000000;"> install() {</span><span style="color: #008080;">240</span>     <span style="color: #0000ff;">global</span> <span style="color: #800080;">$db</span>, <span style="color: #800080;">$messageStack</span><span style="color: #000000;">;</span><span style="color: #008080;">241</span>     <span style="color: #0000ff;">if</span> (<span style="color: #008080;">defined</span>('MODULE_PAYMENT_PAYPAL_STATUS'<span style="color: #000000;">)) {</span><span style="color: #008080;">242</span>       <span style="color: #800080;">$messageStack</span>->add_session('PayPal Website Payments Standard module already installed.', 'error'<span style="color: #000000;">);</span><span style="color: #008080;">243</span>       zen_redirect(zen_href_link(FILENAME_MODULES, 'set=payment&module=paypal', 'NONSSL'<span style="color: #000000;">));</span><span style="color: #008080;">244</span>       <span style="color: #0000ff;">return</span> 'failed'<span style="color: #000000;">;</span><span style="color: #008080;">245</span> <span style="color: #000000;">    }</span><span style="color: #008080;">246</span>     <span style="color: #0000ff;">if</span> (<span style="color: #008080;">defined</span>('MODULE_PAYMENT_PAYPALWPP_STATUS'<span style="color: #000000;">)) {</span><span style="color: #008080;">247</span>       <span style="color: #800080;">$messageStack</span>->add_session('NOTE: PayPal Express Checkout module already installed. You don\'t need Standard if you have Express installed.', 'error'<span style="color: #000000;">);</span><span style="color: #008080;">248</span>       zen_redirect(zen_href_link(FILENAME_MODULES, 'set=payment&module=paypalwpp', 'NONSSL'<span style="color: #000000;">));</span><span style="color: #008080;">249</span>       <span style="color: #0000ff;">return</span> 'failed'<span style="color: #000000;">;</span><span style="color: #008080;">250</span> <span style="color: #000000;">    }</span><span style="color: #008080;">251</span>     <span style="color: #800080;">$db</span>->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable PayPal Module', 'MODULE_PAYMENT_PAYPAL_STATUS', 'True', 'Do you want to accept PayPal payments?', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"<span style="color: #000000;">);</span><span style="color: #008080;">252</span>     <span style="color: #800080;">$db</span>->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Business ID', 'MODULE_PAYMENT_PAYPAL_BUSINESS_ID','".STORE_OWNER_EMAIL_ADDRESS."', 'Primary email address for your PayPal account.<br>NOTE: This must match <strong>EXACTLY </strong>the primary email address on your PayPal account settings.  It <strong>IS case-sensitive</strong>, so please check your PayPal profile preferences at paypal.com and be sure to enter the EXACT same primary email address here.', '6', '2', now())"<span style="color: #000000;">);</span><span style="color: #008080;">253</span>     <span style="color: #800080;">$db</span>->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Transaction Currency', 'MODULE_PAYMENT_PAYPAL_CURRENCY', 'Selected Currency', 'Which currency should the order be sent to PayPal as? <br>NOTE: if an unsupported currency is sent to PayPal, it will be auto-converted to USD.', '6', '3', 'zen_cfg_select_option(array(\'Selected Currency\', \'Only USD\', \'Only AUD\', \'Only CAD\', \'Only EUR\', \'Only GBP\', \'Only CHF\', \'Only CZK\', \'Only DKK\', \'Only HKD\', \'Only HUF\', \'Only JPY\', \'Only NOK\', \'Only NZD\', \'Only PLN\', \'Only SEK\', \'Only SGD\', \'Only THB\', \'Only MXN\', \'Only ILS\', \'Only PHP\', \'Only TWD\', \'Only BRL\', \'Only MYR\'), ', now())"<span style="color: #000000;">);</span><span style="color: #008080;">254</span>     <span style="color: #800080;">$db</span>->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_PAYPAL_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '4', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())"<span style="color: #000000;">);</span><span style="color: #008080;">255</span>     <span style="color: #800080;">$db</span>->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Pending Notification Status', 'MODULE_PAYMENT_PAYPAL_PROCESSING_STATUS_ID', '" . DEFAULT_ORDERS_STATUS_ID .  "', 'Set the status of orders made with this payment module that are not yet completed to this value<br>(\'Pending\' recommended)', '6', '5', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())"<span style="color: #000000;">);</span><span style="color: #008080;">256</span>     <span style="color: #800080;">$db</span>->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_PAYPAL_ORDER_STATUS_ID', '2', 'Set the status of orders made with this payment module that have completed payment to this value<br>(\'Processing\' recommended)', '6', '6', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())"<span style="color: #000000;">);</span><span style="color: #008080;">257</span>     <span style="color: #800080;">$db</span>->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Refund Order Status', 'MODULE_PAYMENT_PAYPAL_REFUND_ORDER_STATUS_ID', '1', 'Set the status of orders that have been refunded made with this payment module to this value<br>(\'Pending\' recommended)', '6', '7', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())"<span style="color: #000000;">);</span><span style="color: #008080;">258</span>     <span style="color: #800080;">$db</span>->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_PAYPAL_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '8', now())"<span style="color: #000000;">);</span><span style="color: #008080;">259</span>     <span style="color: #800080;">$db</span>->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Address Override', 'MODULE_PAYMENT_PAYPAL_ADDRESS_OVERRIDE', '1', 'If set to 1, the customer shipping address selected in Zen Cart will override the customer PayPal-stored address book. The customer will see their address from Zen Cart, but will NOT be able to edit it at PayPal.<br>(An invalid address will be treated by PayPal as not-supplied, or override=0)<br>0=No Override<br>1=ZC address overrides PayPal address choices', '6', '18', 'zen_cfg_select_option(array(\'0\',\'1\'), ', now())"<span style="color: #000000;">);</span><span style="color: #008080;">260</span>     <span style="color: #800080;">$db</span>->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Shipping Address Requirements?', 'MODULE_PAYMENT_PAYPAL_ADDRESS_REQUIRED', '2', 'The buyers shipping address. If set to 0 your customer will be prompted to include a shipping address. If set to 1 your customer will not be asked for a shipping address. If set to 2 your customer will be required to provide a shipping address.<br>0=Prompt<br>1=Not Asked<br>2=Required<br><br><strong>NOTE: If you allow your customers to enter their own shipping address, then MAKE SURE you PERSONALLY manually verify the PayPal confirmation details to verify the proper address when filling orders. When using Website Payments Standard (IPN), Zen Cart does not know if they choose an alternate shipping address at PayPal vs the one entered when placing an order.</strong>', '6', '20', 'zen_cfg_select_option(array(\'0\',\'1\',\'2\'), ', now())"<span style="color: #000000;">);</span><span style="color: #008080;">261</span>     <span style="color: #800080;">$db</span>->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Detailed Line Items in Cart', 'MODULE_PAYMENT_PAYPAL_DETAILED_CART', 'No', 'Do you want to give line-item details to PayPal?  If set to True, line-item details will be shared with PayPal if no discounts apply and if tax and shipping are simple. Otherwise an Aggregate cart summary will be sent.', '6', '22', 'zen_cfg_select_option(array(\'No\',\'Yes\'), ', now())"<span style="color: #000000;">);</span><span style="color: #008080;">262</span>     <span style="color: #800080;">$db</span>->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Page Style', 'MODULE_PAYMENT_PAYPAL_PAGE_STYLE', 'Primary', 'Sets the Custom Payment Page Style for payment pages. The value of page_style is the same as the Page Style Name you chose when adding or editing the page style. You can add and edit Custom Payment Page Styles from the Profile subtab of the My Account tab on the PayPal site. If you would like to always reference your Primary style, set this to \"primary.\" If you would like to reference the default PayPal page style, set this to \"paypal\".', '6', '25', now())"<span style="color: #000000;">);</span><span style="color: #008080;">263</span>     <span style="color: #800080;">$db</span>->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Mode for PayPal web services<br><br>Default:<br><code>www.paypal.com/cgi-bin/webscr</code><br>or<br><code>www.paypal.com/us/cgi-bin/webscr</code><br>or for the UK,<br><code>www.paypal.com/uk/cgi-bin/webscr</code>', 'MODULE_PAYMENT_PAYPAL_HANDLER', 'www.paypal.com/cgi-bin/webscr', 'Choose the URL for PayPal live processing', '6', '73', '', now())"<span style="color: #000000;">);</span><span style="color: #008080;">264</span>     <span style="color: #008000;">//</span><span style="color: #008000;"> sandbox:  www.sandbox.paypal.com/cgi-bin/webscr</span><span style="color: #008080;">265</span>     <span style="color: #800080;">$db</span>->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, use_function) values ('PDT Token (Payment Data Transfer)', 'MODULE_PAYMENT_PAYPAL_PDTTOKEN', '', 'Enter your PDT Token value here in order to activate transactions immediately after processing (if they pass validation).', '6', '25', now(), 'zen_cfg_password_display')"<span style="color: #000000;">);</span><span style="color: #008080;">266</span>     <span style="color: #008000;">//</span><span style="color: #008000;"> Paypal testing options here</span><span style="color: #008080;">267</span>     <span style="color: #800080;">$db</span>->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Debug Mode', 'MODULE_PAYMENT_PAYPAL_IPN_DEBUG', 'Off', 'Enable debug logging? <br>NOTE: This can REALLY clutter your email inbox!<br>Logging goes to the /includes/modules/payment/paypal/logs folder<br>Email goes to the store-owner address.<br>Email option NOT recommended.<br><strong>Leave OFF for normal operation.</strong>', '6', '71', 'zen_cfg_select_option(array(\'Off\',\'Log File\',\'Log and Email\'), ', now())"<span style="color: #000000;">);</span><span style="color: #008080;">268</span>     <span style="color: #800080;">$db</span>->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Debug Email Address', 'MODULE_PAYMENT_PAYPAL_DEBUG_EMAIL_ADDRESS','".STORE_OWNER_EMAIL_ADDRESS."', 'The email address to use for PayPal debugging', '6', '72', now())"<span style="color: #000000;">);</span><span style="color: #008080;">269</span> <span style="color: #008080;">270</span>     <span style="color: #800080;">$this</span>->notify('NOTIFY_PAYMENT_PAYPAL_INSTALLED'<span style="color: #000000;">);</span><span style="color: #008080;">271</span> <span style="color: #000000;">  }</span><span style="color: #008080;">272</span>   <span style="color: #008000;">/*</span><span style="color: #008000;">*</span><span style="color: #008080;">273</span> <span style="color: #008000;">   * Remove the module and all its settings</span><span style="color: #008080;">274</span> <span style="color: #008000;">    *</span><span style="color: #008080;">275</span>     <span style="color: #008000;">*/</span><span style="color: #008080;">276</span>   <span style="color: #0000ff;">function</span><span style="color: #000000;"> remove() {</span><span style="color: #008080;">277</span>     <span style="color: #0000ff;">global</span> <span style="color: #800080;">$db</span><span style="color: #000000;">;</span><span style="color: #008080;">278</span>     <span style="color: #800080;">$db</span>->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key LIKE 'MODULE\_PAYMENT\_PAYPAL\_%'"<span style="color: #000000;">);</span><span style="color: #008080;">279</span>     <span style="color: #800080;">$this</span>->notify('NOTIFY_PAYMENT_PAYPAL_UNINSTALLED'<span style="color: #000000;">);</span><span style="color: #008080;">280</span> <span style="color: #000000;">  }</span><span style="color: #008080;">281</span>   <span style="color: #008000;">/*</span><span style="color: #008000;">*</span><span style="color: #008080;">282</span> <span style="color: #008000;">   * Internal list of configuration keys used for configuration of the module</span><span style="color: #008080;">283</span> <span style="color: #008000;">   *</span><span style="color: #008080;">284</span> <span style="color: #008000;">   * @return array</span><span style="color: #008080;">285</span>     <span style="color: #008000;">*/</span><span style="color: #008080;">286</span>   <span style="color: #0000ff;">function</span><span style="color: #000000;"> keys() {</span><span style="color: #008080;">287</span>     <span style="color: #800080;">$keys_list</span> = <span style="color: #0000ff;">array</span><span style="color: #000000;">(</span><span style="color: #008080;">288</span>                        'MODULE_PAYMENT_PAYPAL_STATUS',<span style="color: #008080;">289</span>                        'MODULE_PAYMENT_PAYPAL_BUSINESS_ID',<span style="color: #008080;">290</span>                        'MODULE_PAYMENT_PAYPAL_PDTTOKEN',<span style="color: #008080;">291</span>                        'MODULE_PAYMENT_PAYPAL_CURRENCY',<span style="color: #008080;">292</span>                        'MODULE_PAYMENT_PAYPAL_ZONE',<span style="color: #008080;">293</span>                        'MODULE_PAYMENT_PAYPAL_PROCESSING_STATUS_ID',<span style="color: #008080;">294</span>                        'MODULE_PAYMENT_PAYPAL_ORDER_STATUS_ID',<span style="color: #008080;">295</span>                        'MODULE_PAYMENT_PAYPAL_REFUND_ORDER_STATUS_ID',<span style="color: #008080;">296</span>                        'MODULE_PAYMENT_PAYPAL_SORT_ORDER',<span style="color: #008080;">297</span>                        'MODULE_PAYMENT_PAYPAL_DETAILED_CART',<span style="color: #008080;">298</span>                        'MODULE_PAYMENT_PAYPAL_ADDRESS_OVERRIDE' ,<span style="color: #008080;">299</span>                        'MODULE_PAYMENT_PAYPAL_ADDRESS_REQUIRED' ,<span style="color: #008080;">300</span>                        'MODULE_PAYMENT_PAYPAL_PAGE_STYLE' ,<span style="color: #008080;">301</span>                        'MODULE_PAYMENT_PAYPAL_HANDLER',<span style="color: #008080;">302</span>                        'MODULE_PAYMENT_PAYPAL_IPN_DEBUG',<span style="color: #008080;">303</span> <span style="color: #000000;">                        );</span><span style="color: #008080;">304</span> <span style="color: #008080;">305</span>     <span style="color: #008000;">//</span><span style="color: #008000;"> Paypal testing/debug options go here:</span><span style="color: #008080;">306</span>     <span style="color: #0000ff;">if</span> (IS_ADMIN_FLAG === <span style="color: #0000ff;">true</span><span style="color: #000000;">) {</span><span style="color: #008080;">307</span>       <span style="color: #0000ff;">if</span> (<span style="color: #0000ff;">isset</span>(<span style="color: #800080;">$_GET</span>['debug']) && <span style="color: #800080;">$_GET</span>['debug']=='on'<span style="color: #000000;">) {</span><span style="color: #008080;">308</span>         <span style="color: #800080;">$keys_list</span>[]='MODULE_PAYMENT_PAYPAL_DEBUG_EMAIL_ADDRESS';  <span style="color: #008000;">/*</span><span style="color: #008000;"> this defaults to store-owner-email-address </span><span style="color: #008000;">*/</span><span style="color: #008080;">309</span> <span style="color: #000000;">      }</span><span style="color: #008080;">310</span> <span style="color: #000000;">    }</span><span style="color: #008080;">311</span>     <span style="color: #0000ff;">return</span> <span style="color: #800080;">$keys_list</span><span style="color: #000000;">;</span><span style="color: #008080;">312</span> <span style="color: #000000;">  }</span><span style="color: #008080;">313</span> <span style="color: #008080;">314</span>   <span style="color: #0000ff;">function</span> _getPDTresults(<span style="color: #800080;">$orderAmount</span>, <span style="color: #800080;">$my_currency</span>, <span style="color: #800080;">$pdtTX</span><span style="color: #000000;">) {</span><span style="color: #008080;">315</span>     <span style="color: #0000ff;">global</span> <span style="color: #800080;">$db</span><span style="color: #000000;">;</span><span style="color: #008080;">316</span>     <span style="color: #800080;">$ipnData</span>  = ipn_postback('PDT', <span style="color: #800080;">$pdtTX</span><span style="color: #000000;">);</span><span style="color: #008080;">317</span>     <span style="color: #800080;">$respdata</span> = <span style="color: #800080;">$ipnData</span>['info'<span style="color: #000000;">];</span><span style="color: #008080;">318</span> <span style="color: #008080;">319</span>     <span style="color: #008000;">//</span><span style="color: #008000;"> parse the data</span><span style="color: #008080;">320</span>     <span style="color: #800080;">$lines</span> = <span style="color: #008080;">explode</span>("\n", <span style="color: #800080;">$respdata</span><span style="color: #000000;">);</span><span style="color: #008080;">321</span>     <span style="color: #800080;">$this</span>->pdtData = <span style="color: #0000ff;">array</span><span style="color: #000000;">();</span><span style="color: #008080;">322</span>     <span style="color: #0000ff;">for</span> (<span style="color: #800080;">$i</span>=1; <span style="color: #800080;">$i</span>count(<span style="color: #800080;">$lines</span>);<span style="color: #800080;">$i</span>++<span style="color: #000000;">){</span><span style="color: #008080;">323</span>       <span style="color: #0000ff;">if</span> (!<span style="color: #008080;">strstr</span>(<span style="color: #800080;">$lines</span>[<span style="color: #800080;">$i</span>], "=")) <span style="color: #0000ff;">continue</span><span style="color: #000000;">;</span><span style="color: #008080;">324</span>       <span style="color: #0000ff;">list</span>(<span style="color: #800080;">$key</span>,<span style="color: #800080;">$val</span>) = <span style="color: #008080;">explode</span>("=", <span style="color: #800080;">$lines</span>[<span style="color: #800080;">$i</span><span style="color: #000000;">]);</span><span style="color: #008080;">325</span>       <span style="color: #800080;">$this</span>->pdtData[<span style="color: #008080;">urldecode</span>(<span style="color: #800080;">$key</span>)] = <span style="color: #008080;">urldecode</span>(<span style="color: #800080;">$val</span><span style="color: #000000;">);</span><span style="color: #008080;">326</span> <span style="color: #000000;">    }</span><span style="color: #008080;">327</span> <span style="color: #008080;">328</span>     <span style="color: #0000ff;">if</span> (<span style="color: #800080;">$this</span>->pdtData['txn_id'] == '' || <span style="color: #800080;">$this</span>->pdtData['payment_status'] == ''<span style="co"></span>
登入後複製
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

華為GT3 Pro和GT4的差異是什麼? 華為GT3 Pro和GT4的差異是什麼? Dec 29, 2023 pm 02:27 PM

許多用戶在選擇智慧型手錶的時候都會選擇的華為的品牌,其中華為GT3pro和GT4都是非常熱門的選擇,不少用戶都很好奇華為GT3pro和GT4有什麼區別,下面就給大家介紹一下二者。華為GT3pro和GT4有什麼差別一、外觀GT4:46mm和41mm,材質是玻璃鏡板+不鏽鋼機身+高分纖維後殼。 GT3pro:46.6mm和42.9mm,材質是藍寶石玻璃鏡+鈦金屬機身/陶瓷機身+陶瓷後殼二、健康GT4:採用最新的華為Truseen5.5+演算法,結果會更加的精準。 GT3pro:多了ECG心電圖和血管及安

修復:截圖工具在 Windows 11 中不起作用 修復:截圖工具在 Windows 11 中不起作用 Aug 24, 2023 am 09:48 AM

為什麼截圖工具在Windows11上不起作用了解問題的根本原因有助於找到正確的解決方案。以下是截圖工具可能無法正常工作的主要原因:對焦助手已開啟:這可以防止截圖工具開啟。應用程式損壞:如果截圖工具在啟動時崩潰,則可能已損壞。過時的圖形驅動程式:不相容的驅動程式可能會幹擾截圖工具。來自其他應用程式的干擾:其他正在運行的應用程式可能與截圖工具衝突。憑證已過期:升級過程中的錯誤可能會導致此issu簡單的解決方案這些適合大多數用戶,不需要任何特殊的技術知識。 1.更新視窗與Microsoft應用程式商店應用程

如何修復無法連線到iPhone上的App Store錯誤 如何修復無法連線到iPhone上的App Store錯誤 Jul 29, 2023 am 08:22 AM

第1部分:初始故障排除步驟檢查蘋果的系統狀態:在深入研究複雜的解決方案之前,讓我們先從基礎知識開始。問題可能不在於您的設備;蘋果的伺服器可能會關閉。造訪Apple的系統狀態頁面,查看AppStore是否正常運作。如果有問題,您所能做的就是等待Apple修復它。檢查您的網路連接:確保您擁有穩定的網路連接,因為「無法連接到AppStore」問題有時可歸因於連接不良。嘗試在Wi-Fi和行動數據之間切換或重置網路設定(「常規」>「重置」>「重置網路設定」>設定)。更新您的iOS版本:

php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 Jun 13, 2016 am 10:23 AM

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code

watch4pro好還是gt好 watch4pro好還是gt好 Sep 26, 2023 pm 02:45 PM

watch4pro和gt各自具有不使用的特點和適用場景,如果注重功能的全面性、高性能和時尚外觀,同時願意承擔較高的價格,那麼Watch 4 Pro可能更適合。如果對功能要求不高,更注重電池續航力和價格的合理性,那麼GT系列可能更適合。最終的選擇應根據個人需求、預算和喜好來決定,建議在購買前仔細考慮自己的需求,並參考各種產品的評測和比較,以做出更明智的選擇。

如何使用 iPadOS 17.4 優化 iPad 電池壽命 如何使用 iPadOS 17.4 優化 iPad 電池壽命 Mar 21, 2024 pm 10:31 PM

如何使用iPadOS17.4优化iPad电池寿命延长电池续航时间是移动设备体验的关键,iPad是一个很好的例子。如果您觉得iPad电池消耗速度过快,不用担心,在iPadOS17.4中有许多技巧和调整可以显著延长设备的运行时间。本深入指南的目标不仅仅是提供信息,而是改变您使用iPad的方式,增强您的整体电池管理,并确保您可以在无需充电的情况下更长时间地依赖您的设备。通过采用此处概述的做法,您朝着更高效、更谨慎地使用技术迈出了一步,这些技术是根据您的个人需求和使用模式量身定制的。识别主要的能量消耗者

请教怎么修改url某一参数的参数值呢?是要拆开了再拼回去吗 请教怎么修改url某一参数的参数值呢?是要拆开了再拼回去吗 Jun 13, 2016 am 10:24 AM

请问如何修改url某一参数的参数值呢?是要拆开了再拼回去吗?那么请问如何修改url某一参数的参数值呢?是要拆开了再拼回去吗?http://127.0.0.1/myo/newuser.php?mod=search&type=fastone比如现在我要修改mod=new要怎么做呢?------解决方案--------------------发送了请求

Microsoft正在推出Windows 11 23H2版本到有Copilot的發布預覽頻道 Microsoft正在推出Windows 11 23H2版本到有Copilot的發布預覽頻道 Sep 28, 2023 pm 07:17 PM

每個人都在期待今天的Windows1123H2發布。事實上,Microsoft剛剛啟動了發布預覽版的更新,這是正式發布階段之前最接近的頻道。被稱為Build22631的Microsoft表示,他們正在推出新的更名聊天應用程序,電話鏈接和一起玩小部件,這些小部件在過去幾個月中已在其他內部渠道中進行了測試。 「這個新的更新將具有與Windows11版本22H2相同的服務分支和程式碼庫,並將與所有新宣布的功能累積,包括Windows中的Copilot(預覽版),」Microsoft承諾。雷德蒙官員進一

See all articles