Thanks! Below is the approach I took after reading your suggestions. One question, if I wanted to create a VIPCOD payment module by duplicating the cod.php file into a vipcod.php file, what do I need to modify within the vipcod.php (and any other files) in other for the additional payment module to be recongnized by Zen Cart admin? Here's my code:
VIPCOD - Done in Zen Cart 1.3.8a:
-
Modified the customers table and added int(1) (default=0) field named customers_cod
-
Modified: /public_html/store/includes/modules/pages/login/header_php.php
Replaced:
$check_customer_query = "SELECT customers_id, customers_firstname, customers_lastname, customers_password,
customers_email_address, customers_default_address_id,
customers_authorization, customers_referral
FROM " . TABLE_CUSTOMERS . "
WHERE customers_email_address = :emailAddress";
With:
$check_customer_query = "SELECT customers_id, customers_firstname, customers_lastname, customers_password,
customers_email_address, customers_default_address_id,
customers_authorization, customers_referral, customers_cod
FROM " . TABLE_CUSTOMERS . "
WHERE customers_email_address = :emailAddress";
Added:
$_SESSION['customer_cod'] = $check_customer->fields['customers_cod'];
After:
$_SESSION['customer_zone_id'] = $check_country->fields['entry_zone_id'];
-
Modified: /public_html/store/includes/modules/payment/cod.php
Added:
//--------------------------------------------------------------------------------
// MODDED - BT 12-29-2007 - Only customers that do not have the default 0 in the
// custom customers_cod field in the customers table are allowed to pay COD
if ($_SESSION['customer_cod'] == 0) $this->enabled = false;
//--------------------------------------------------------------------------------
After:
// class methods
function update_status() {
global $order, $db;
-
Now, only customers with customers_cod = 1 (or any value other than 0) will have COD available to them.
NOTE: This value is loaded as a SESSION variable only during logon. Therefore, if a customer is currently
logged on, they must log off and then back on for the value to be re-read into memory.
Bob Tabin
12-29-2007