Maison > développement back-end > tutoriel php > Zencart先生成订单后付款,相仿淘宝后台修改订单价格

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

WBOY
Libérer: 2016-06-13 12:22:48
original
1554 Les gens l'ont consulté

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>
Copier après la connexion

 

要增加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>
Copier après la connexion

 

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>
Copier après la connexion
Étiquettes associées:
source:php.cn
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal