[ Index ]
 

Code source de Zen Cart E-Commerce Shopping Cart 1.3.7.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/includes/modules/payment/ -> freecharger.php (source)

   1  <?php
   2  //

   3  // +----------------------------------------------------------------------+

   4  // |zen-cart Open Source E-commerce                                       |

   5  // +----------------------------------------------------------------------+

   6  // | Copyright (c) 2003 The zen-cart developers                           |

   7  // |                                                                      |

   8  // | http://www.zen-cart.com/index.php                                    |

   9  // |                                                                      |

  10  // | Portions Copyright (c) 2003 osCommerce                               |

  11  // +----------------------------------------------------------------------+

  12  // | This source file is subject to version 2.0 of the GPL license,       |

  13  // | that is bundled with this package in the file LICENSE, and is        |

  14  // | available through the world-wide-web at the following url:           |

  15  // | http://www.zen-cart.com/license/2_0.txt.                             |

  16  // | If you did not receive a copy of the zen-cart license and are unable |

  17  // | to obtain it through the world-wide-web, please send a note to       |

  18  // | license@zen-cart.com so we can mail you a copy immediately.          |

  19  // +----------------------------------------------------------------------+

  20  // $Id: freecharger.php 1105 2005-04-04 22:05:35Z birdbrain $

  21  //

  22  
  23    class freecharger {
  24      var $code, $title, $description, $enabled, $payment;
  25  
  26  // class constructor

  27      function freecharger() {
  28        global $order;
  29        $this->code = 'freecharger';
  30        $this->title = MODULE_PAYMENT_FREECHARGER_TEXT_TITLE;
  31        $this->description = MODULE_PAYMENT_FREECHARGER_TEXT_DESCRIPTION;
  32        $this->sort_order = MODULE_PAYMENT_FREECHARGER_SORT_ORDER;
  33        $this->enabled = ((MODULE_PAYMENT_FREECHARGER_STATUS == 'True') ? true : false);
  34  
  35        if ((int)MODULE_PAYMENT_FREECHARGER_ORDER_STATUS_ID > 0) {
  36          $this->order_status = MODULE_PAYMENT_FREECHARGER_ORDER_STATUS_ID;
  37          $payment='freecharger';
  38        } else {
  39          if ($payment=='freecharger') {
  40            $payment='';
  41          }
  42        }
  43  
  44        if (is_object($order)) $this->update_status();
  45  
  46        $this->email_footer = MODULE_PAYMENT_FREECHARGER_TEXT_EMAIL_FOOTER;
  47      }
  48  
  49  // class methods

  50      function update_status() {
  51        global $db;
  52        global $order;
  53  
  54        if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_FREECHARGER_ZONE > 0) ) {
  55          $check_flag = false;
  56          $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_FREECHARGER_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");
  57          while (!$check->EOF) {
  58            if ($check->fields['zone_id'] < 1) {
  59              $check_flag = true;
  60              break;
  61            } elseif ($check->fields['zone_id'] == $order->billing['zone_id']) {
  62              $check_flag = true;
  63              break;
  64            }
  65            $check->MoveNext();
  66          }
  67  
  68          if ($check_flag == false) {
  69            $this->enabled = false;
  70          }
  71        }
  72      }
  73  
  74      function javascript_validation() {
  75        return false;
  76      }
  77  
  78      function selection() {
  79        return array('id' => $this->code,
  80                     'module' => $this->title);
  81      }
  82  
  83      function pre_confirmation_check() {
  84        return false;
  85      }
  86  
  87      function confirmation() {
  88        return array('title' => MODULE_PAYMENT_FREECHARGER_TEXT_DESCRIPTION);
  89      }
  90  
  91      function process_button() {
  92        return false;
  93      }
  94  
  95      function before_process() {
  96        return false;
  97      }
  98  
  99      function after_process() {
 100        return false;
 101      }
 102  
 103      function get_error() {
 104        return false;
 105      }
 106  
 107      function check() {
 108        global $db;
 109        if (!isset($this->_check)) {
 110          $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_FREECHARGER_STATUS'");
 111          $this->_check = $check_query->RecordCount();
 112        }
 113        return $this->_check;
 114      }
 115  
 116      function install() {
 117        global $db;
 118        $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Free Charge Module', 'MODULE_PAYMENT_FREECHARGER_STATUS', 'True', 'Do you want to accept Free Charge payments?', '6', '1', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now());");
 119        $db->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_FREECHARGER_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
 120        $db->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_FREECHARGER_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())");
 121        $db->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_FREECHARGER_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())");
 122      }
 123  
 124      function remove() {
 125        global $db;
 126        $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
 127      }
 128  
 129      function keys() {
 130        return array('MODULE_PAYMENT_FREECHARGER_STATUS', 'MODULE_PAYMENT_FREECHARGER_ZONE', 'MODULE_PAYMENT_FREECHARGER_ORDER_STATUS_ID', 'MODULE_PAYMENT_FREECHARGER_SORT_ORDER');
 131      }
 132    }
 133  ?>


Généré le : Mon Nov 26 16:45:43 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics