Jump to content
Sign in to follow this  
spooker8

Setting up more then 1 bank for Bank Transfer module

Recommended Posts

Hi there,

I'm trying to modify the Bank Transfer module to set up more then 1 bank for the bank transfer module.

i have plan to set up about 5 different banks ,

 

i tried to duplicate the code and changing the variables and class name , almost succeeded but unable to see the zones or sort order.

its all blank

can someone help me out plsssss

 

I have added "2" to all the names , so create a duplicate , no idea where i went wrong ,

hope to hear from soneone soon , thank youuuuuuuuuuuuuuuuuuuuu

 

<?php
/*
 $Id: TRANSFER.php,v 1.10 2003/01/29 19:57:14 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

 Copyright © 2003 osCommerce

 Released under the GNU General Public License
*/

 class transfer2{
   var $code, $title, $description, $enabled;

// class constructor
   function transfer2() {
     global $order;

     $this->code = 'transfer2';
     $this->title = MODULE_PAYMENT_TRANSFER_TEXT_TITLE2;
     $this->description = MODULE_PAYMENT_TRANSFER_TEXT_DESCRIPTION2;
     $this->sort_order = MODULE_PAYMENT_TRANSFER_SORT_ORDER2;
     $this->enabled = ((MODULE_PAYMENT_TRANSFER_STATUS2 == 'True') ? true : false);

     if ((int)MODULE_PAYMENT_TRANSFER_ORDER_STATUS_ID2 > 0) {
       $this->order_status = MODULE_PAYMENT_TRANSFER_ORDER_STATUS_ID2;
     }

     if (is_object($order)) $this->update_status();

     $this->email_footer = MODULE_PAYMENT_TRANSFER_TEXT_EMAIL_FOOTER2;
   }

// class methods
   function update_status() {
     global $order;

     if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_TRANSFER_ZONE2 > 0) ) {
       $check_flag = false;
       $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_TRANSFER_ZONE . "' and zone_country_id = '" . $order2->billing['country']['id'] . "' order by zone_id");
       while ($check = tep_db_fetch_array($check_query)) {
         if ($check['zone_id'] < 1) {
           $check_flag = true;
           break;
         } elseif ($check['zone_id'] == $order->billing['zone_id']) {
           $check_flag = true;
           break;
         }
       }

       if ($check_flag == false) {
         $this->enabled = false;
       }
     }
   }

   function javascript_validation() {
     return false;
   }

   function selection() {
     return array('id' => $this->code,
                  'module' => $this->title);
   }

   function pre_confirmation_check() {
     return false;
   }

   function confirmation() {
     return array('title' => MODULE_PAYMENT_TRANSFER_TEXT_DESCRIPTION2);
   }

   function process_button() {
     return false;
   }

   function before_process() {
     return false;
   }

   function after_process() {
     return false;
   }

   function get_error() {
     return false;
   }

   function check() {
     if (!isset($this->_check)) {
       $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_TRANSFER_STATUS2'");
       $this->_check = tep_db_num_rows($check_query);
     }
     return $this->_check;
   }

   function install() {
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Bank Transfer Module', 'MODULE_PAYMENT_TRANSFER_STATUS2', 'True', 'Do you want to accept Bank Transfer or Deposits?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now());");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Payable to:', 'MODULE_PAYMENT_TRANSFER_PAYTO2', '', 'Who is the bank account owner?', '6', '1', now());");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Account #:', 'MODULE_PAYMENT_TRANSFER_ACCOUNT2', '', 'What is the account number to deposit to?', '6', '1', now());");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Bank:', 'MODULE_PAYMENT_TRANSFER_BANK2', '', 'Name of the bank', '6', '1', now());");

  tep_db_query("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_TRANSFER_SORT_ORDER2', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");

  tep_db_query("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_TRANSFER_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");

  tep_db_query("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_TRANSFER_ORDER_STATUS_ID2', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())");
   }

   function remove() {
     tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
   }

   function keys() {
     return array('MODULE_PAYMENT_TRANSFER_PAYTO2', 'MODULE_PAYMENT_TRANSFER_ACCOUNT2', 'MODULE_PAYMENT_TRANSFER_BANK2', 'MODULE_PAYMENT_TRANSFER_STATUS2', 'MODULE_PAYMENT_TRANSFER_ZONE2', 'MODULE_PAYMENT_TRANSFER_ORDER_STATUS_ID2', 'MODULE_PAYMENT_TRANSFER_SORT_ORDER2');
   }
 }
?>

Share this post


Link to post
Share on other sites

i would be interesting in how you solved this, as i need about 5 different bank transfer modules


If it don't fit - Get a bigger hammer

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×