PHP Code:
<?php
class accountholder {
var $code, $title, $description, $enabled;
// class constructor
function accountholder() {
global $order;
$this->code = 'accountholder';
$this->title = MODULE_PAYMENT_ACCOUNTHOLDER_TEXT_TITLE;
if (IS_ADMIN_FLAG === true && (MODULE_PAYMENT_ACCOUNTHOLDER_PAYTO == 'Just pay the rest when you can' || MODULE_PAYMENT_ACCOUNTHOLDER_PAYTO == '')) $this->title .= '<span class="alert"> </span>';
$this->description = MODULE_PAYMENT_ACCOUNTHOLDER_TEXT_DESCRIPTION;
$this->sort_order = MODULE_PAYMENT_ACCOUNTHOLDER_SORT_ORDER;
$this->enabled = ((MODULE_PAYMENT_ACCOUNTHOLDER_STATUS == 'True') ? true : false);
if (!IS_ADMIN_FLAG) {
global $cart;
if ($_SESSION['cart']->show_weight() == 0) {
$this->enabled = false;
}
}
// bof: disable based on Order Amount
// use $order->info['subtotal'] or $order->info['subtotal']
if (!IS_ADMIN_FLAG && $order->info['subtotal'] < 100.00) {
$this->enabled = false;
}
//echo 'I SEE ' . 'Subtotal: ' . $order->info['subtotal'] . ' Total: ' . $order->info['total'] . '<br>';
// eof: disable based on Order Amount
if ((int)MODULE_PAYMENT_ACCOUNTHOLDER_ORDER_STATUS_ID > 0) {
$this->order_status = MODULE_PAYMENT_ACCOUNTHOLDER_ORDER_STATUS_ID;
}
if (is_object($order)) $this->update_status();
$this->email_footer = MODULE_PAYMENT_ACCOUNTHOLDER_TEXT_EMAIL_FOOTER;
}
// class methods
function update_status() {
global $order, $db;
if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_ACCOUNTHOLDER_ZONE > 0) ) {
$check_flag = false;
$check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_ACCOUNTHOLDER_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");
while (!$check->EOF) {
if ($check->fields['zone_id'] < 1) {
$check_flag = true;
break;
} elseif ($check->fields['zone_id'] == $order->billing['zone_id']) {
$check_flag = true;
break;
}
$check->MoveNext();
}
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_ACCOUNTHOLDER_TEXT_DESCRIPTION);
}
function process_button() {
return false;
}
function before_process() {
return false;
}
function after_process() {
return false;
}
function get_error() {
return false;
}
function check() {
global $db;
if (!isset($this->_check)) {
$check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_ACCOUNTHOLDER_STATUS'");
$this->_check = $check_query->RecordCount();
}
return $this->_check;
}
function install() {
global $db;
$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 Account Holder Module', 'MODULE_PAYMENT_ACCOUNTHOLDER_STATUS', 'True', 'Do you want to activate the Account Holder payment option?', '6', '1', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now());");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Make Payable to:', 'MODULE_PAYMENT_ACCOUNTHOLDER_PAYTO', 'Just pay the rest when you can', 'Who should payments be made payable to?', '6', '1', now());");
$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_ACCOUNTHOLDER_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
$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_ACCOUNTHOLDER_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())");
$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_ACCOUNTHOLDER_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())");
}
function remove() {
global $db;
$db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
return array('MODULE_PAYMENT_ACCOUNTHOLDER_STATUS', 'MODULE_PAYMENT_ACCOUNTHOLDER_ZONE', 'MODULE_PAYMENT_ACCOUNTHOLDER_ORDER_STATUS_ID', 'MODULE_PAYMENT_ACCOUNTHOLDER_SORT_ORDER', 'MODULE_PAYMENT_ACCOUNTHOLDER_PAYTO');
}
}
?>
/includes/languages/english/modules/payment/accountholder.php
PHP Code:
<?php
define('NAVBAR_TITLE_1', 'Checkout - Step 1');
define('NAVBAR_TITLE_2', 'Payment Method - Step 2');
define('HEADING_TITLE', 'Step 2 of 3 - Payment Information');
define('TABLE_HEADING_BILLING_ADDRESS', 'Billing Address');
define('TEXT_SELECTED_BILLING_DESTINATION', 'Your billing address is shown to the left. The billing address should match the address on your credit card statement. You can change the billing address by clicking the <em>Change Address</em> button.');
define('TITLE_BILLING_ADDRESS', 'Billing Address:');
define('TABLE_HEADING_PAYMENT_METHOD', 'Payment Method');
/*The following line can be adjusted to include/alter appropriate text description for the Account Holders Only payment option
DO NOT comment out the line... just alter the text description if necessary */
define('TEXT_SELECT_PAYMENT_METHOD', 'Please select a payment method for this order.<br /><br />Authorised Account Holders may use the <strong>Account Holders Only</strong> payment option.<br /><br />If you are <strong>not</strong> an Authorised Account Holder, your order may not be processed, so please choose other payment options.');
define('TITLE_PLEASE_SELECT', 'Please Select');
define('TEXT_ENTER_PAYMENT_INFORMATION', '');
define('TABLE_HEADING_COMMENTS', 'Special Instructions or Order Comments');
define('TITLE_NO_PAYMENT_OPTIONS_AVAILABLE', 'Not Available At This Time');
define('TEXT_NO_PAYMENT_OPTIONS_AVAILABLE','<span class="alert">Sorry, we are not accepting payments from your region at this time.</span><br />Please contact us for alternate arrangements.');
define('TITLE_CONTINUE_CHECKOUT_PROCEDURE', '<strong>Continue to Step 3</strong>');
define('TEXT_CONTINUE_CHECKOUT_PROCEDURE', '- to confirm your order.');
define('TABLE_HEADING_CONDITIONS', '<span class="termsconditions">Terms and Conditions</span>');
define('TEXT_CONDITIONS_DESCRIPTION', '<span class="termsdescription">Please acknowledge the terms and conditions bound to this order by ticking the following box. The terms and conditions can be read <a href="' . zen_href_link(FILENAME_CONDITIONS, '', 'SSL') . '"><span class="pseudolink">here</span></a>.');
define('TEXT_CONDITIONS_CONFIRM', '<span class="termsiagree">I have read and agreed to the terms and conditions bound to this order.</span>');
define('TEXT_CHECKOUT_AMOUNT_DUE', 'Total Amount Due: ');
define('TEXT_YOUR_TOTAL','Your Total');
?>