Jump to content
Sign in to follow this  
Gidgidonihah

Customer Specific Payment Options

Recommended Posts

I wrote my own hack that only allows the COD payment module to be shown for a customer if it is turned on for that specific customer in the admin.

 

The problem with this is that I have to pass the customer id number to the constructor of the payment class and in doing so for some reason the cc payment module will now accept ANYTHING as a valid credit card number.

 

I really have no idea what would cause this or where to start so any ideas or help would be greatly appreciated.

Share this post


Link to post
Share on other sites
I wrote my own hack that only allows the COD payment module to be shown for a customer if it is turned on for that specific customer in the admin.

 

The problem with this is that I have to pass the customer id number to the constructor of the payment class and in doing so for some reason the cc payment module will now accept ANYTHING as a valid credit card number.

 

I really have no idea what would cause this or where to start so any ideas or help would be greatly appreciated.

I have no clue either, but this is how it was done in Separate Pricing Per Customer (where both payment options for a group and indivdual customers can be set). Perhaps it gives you an idea on how to fix yours.

  class payment {
var $modules, $selected_module;

// class constructor
function payment($module = '') {
  global $payment, $language, $PHP_SELF;

  if (defined('MODULE_PAYMENT_INSTALLED') && tep_not_null(MODULE_PAYMENT_INSTALLED)) {
 // BOF Separate Pricing Per Customer, next line original code
 //	   $this->modules = explode(';', MODULE_PAYMENT_INSTALLED);
 global $sppc_customer_group_id, $customer_id;
 if(!tep_session_is_registered('sppc_customer_group_id')) { 
 $customer_group_id = '0';
 } else {
  $customer_group_id = $sppc_customer_group_id;
 }
  $customer_payment_query = tep_db_query("select IF(c.customers_payment_allowed <> '', c.customers_payment_allowed, cg.group_payment_allowed) as payment_allowed from " . TABLE_CUSTOMERS . " c, " . TABLE_CUSTOMERS_GROUPS . " cg where c.customers_id = '" . $customer_id . "' and cg.customers_group_id =  '" . $customer_group_id . "'");
  if ($customer_payment = tep_db_fetch_array($customer_payment_query)  ) {  
   if (tep_not_null($customer_payment['payment_allowed'])) {
  $temp_payment_array = explode(';', $customer_payment['payment_allowed']);
  $installed_modules = explode(';', MODULE_PAYMENT_INSTALLED);
  for ($n = 0; $n < sizeof($installed_modules); $n++) {
	  // check to see if a payment method is not de-installed
	  if ( in_array($installed_modules[$n], $temp_payment_array ) ) {
		  $payment_array[] = $installed_modules[$n];
	  }
  } // end for loop
  $this->modules = $payment_array;
  } else {  
   $this->modules = explode(';', MODULE_PAYMENT_INSTALLED);
  }
  } else { // default
   $this->modules = explode(';', MODULE_PAYMENT_INSTALLED);
  }
 // EOF Separate Pricing Per Customer

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  

×