Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Help with modifying a payment method


gtilflm

Recommended Posts

Hello everyone. I'm trying to insert some code to have it where a payment method will only dispaly/work if the user answered a certain way when they created their account. I'm using the extra fields mod and basically, if they answered "yes" to one of the questions, I want the payment method to display.

 

I'm modifying the "po.php" payment page and I've copy/pasted the code below. I've made adjustments to the bold areas.

 

Any thoughts would be appreciated.

 

<?php

/*

$Id: cc.php,v 1.1.1.1 2004/03/04 23:41:17 ccwjr Exp $

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

Copyright © 2003 osCommerce

Released under the GNU General Public License

*/

 

//Added for state funded check

$state_funded = tep_db_query("SELECT value, fields_id FROM " . TABLE_CUSTOMERS_TO_EXTRA_FIELDS . " where customers_id ='" . $customer_id . "'");

//end added

 

class po {

var $code, $title, $description, $enabled;

// class constructor

function po() {

global $order;

$this->code = 'N/A Doing a FREE trial';

$this->title = MODULE_PAYMENT_PO_TEXT_TITLE;

$this->description = MODULE_PAYMENT_PO_TEXT_DESCRIPTION;

$this->email_footer = MODULE_PAYMENT_PO_TEXT_EMAIL_FOOTER;

$this->sort_order = MODULE_PAYMENT_PO_SORT_ORDER;

 

// Added for state funded check

// $this->enabled = ((MODULE_PAYMENT_INSTALLMENT_STATUS == 'True') ? true : false);

if(MODULE_PAYMENT_INSTALLMENT_STATUS == 'True'){

if(($state_funded->value) == yes){

$this->enabled = true;

} else {

$this->enabled = false;

}

} else {

$this->enabled = false;

}

;

 

// End added

 

 

}

// class methods

function selection() {

global $order;

$selection = array('id' => $this->code,

'module' => $this->title);

//'fields' => array(array('title' => MODULE_PAYMENT_PO_TEXT_NUMBER,

// 'field' => tep_draw_input_field('po_number', ''))));

return $selection;

}

function javascript_validation() {

/* $js = ' if (payment_value == "' . $this->code . '") {' . "\n" .

' var cc_owner = document.checkout_payment.cc_owner.value;' . "\n" .

' var cc_number = document.checkout_payment.cc_number.value;' . "\n" .

' if (cc_owner == "" || cc_owner.length < ' . CC_OWNER_MIN_LENGTH . ') {' . "\n" .

' error_message = error_message + "' . MODULE_PAYMENT_CC_TEXT_JS_CC_OWNER . '";' . "\n" .

' error = 1;' . "\n" .

' }' . "\n" .

' if (cc_number == "" || cc_number.length < ' . CC_NUMBER_MIN_LENGTH . ') {' . "\n" .

' error_message = error_message + "' . MODULE_PAYMENT_CC_TEXT_JS_CC_NUMBER . '";' . "\n" .

' error = 1;' . "\n" .

' }' . "\n" .

' }' . "\n";

*/

return $js;

}

function pre_confirmation_check()

{

/*

global $HTTP_POST_VARS;

global $order;

global $customer_id;

$error = '';

 

$check_credit = tep_db_query("SELECT customers_credit_account_status,customers_credit_status, customers_credit_left from " . TABLE_CUSTOMERS . " where customers_id ='" . $customer_id . "'");

 

$credit = tep_db_fetch_array($check_credit);

 

If ($credit['customers_credit_account_status'] =='1' )

{

If ($HTTP_POST_VARS['po_number'] == '')

{

$error = sprintf(MODULE_PAYMENT_PO_TEXT_ERROR_NO_NUMBER);

}

else

{

if ($credit['customers_credit_status'] == "1")

{

if ($order->info['total'] > $credit['customers_credit_left'])

{

$error = sprintf(MODULE_PAYMENT_PO_TEXT_ERROR_NOT_ENOUGH_CREDIT. $credit['customers_credit_left']);

}

}

else

{

$error = MODULE_PAYMENT_PO_TEXT_ERROR_CREDIT_DISABLED;

}

}

}

else

{

 

$error = sprintf(MODULE_PAYMENT_PO_TEXT_ERROR_NO_CREDIT_ACCOUNT);

}

If ($error)

{

$payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode($error) ;

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false));

}

*/

return false;

}

function confirmation() {

/*global $HTTP_POST_VARS;

$confirmation = array('title' => $this->title,

'fields' => array(array('title' => MODULE_PAYMENT_PO_TEXT_NUMBER,

'field' => $HTTP_POST_VARS['po_number'])));

return $confirmation;*/

return false;

}

function process_button() {

global $HTTP_POST_VARS;

$process_button_string = tep_draw_hidden_field('po_number', $HTTP_POST_VARS['po_number']);

return $process_button_string;

}

function before_process() {

global $HTTP_POST_VARS, $order;

 

$order ->info['po_number'] = $HTTP_POST_VARS['po_number'];

}

function after_process()

{

return false;

}

function get_error() {

global $HTTP_GET_VARS;

$error = array('title' => MODULE_PAYMENT_PO_TEXT_ERROR,

'error' => stripslashes(urldecode($HTTP_GET_VARS['error'])));

return $error;

}

function check() {

if (!isset($this->check)) {

$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_PO_STATUS'");

$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 credit account Module', 'MODULE_PAYMENT_PO_STATUS', 'True', 'Do you want to accept payments by credit account?', '6', '0', '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 ('Sort order of display.', 'MODULE_PAYMENT_PO_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0' , now())");

}

function remove() {

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

}

function keys() {

return array('MODULE_PAYMENT_PO_STATUS', 'MODULE_PAYMENT_PO_SORT_ORDER');

}

}

?>

Link to comment
Share on other sites

//Added for state funded check
$state_funded = tep_db_query("SELECT value, fields_id FROM " . TABLE_CUSTOMERS_TO_EXTRA_FIELDS . " where customers_id ='" . $customer_id . "'");
//end added

should be

//Added for state funded check
$state_funded_query = tep_db_query("SELECT value, fields_id FROM " . TABLE_CUSTOMERS_TO_EXTRA_FIELDS . " where customers_id ='" . $customer_id . "'");
$state_funded = tep_db_fetch_array($state_funded_query);
//end added

 

and

// Added for state funded check
// $this->enabled = ((MODULE_PAYMENT_INSTALLMENT_STATUS == 'True') ? true : false);
if(MODULE_PAYMENT_INSTALLMENT_STATUS == 'True'){
if(($state_funded->value) == yes){
$this->enabled = true;
} else {
$this->enabled = false;
}
} else {
$this->enabled = false;
}
;

// End added

should be

// Added for state funded check
// $this->enabled = ((MODULE_PAYMENT_INSTALLMENT_STATUS == 'True') ? true : false);
if( (MODULE_PAYMENT_INSTALLMENT_STATUS == 'True') && ($state_funded['value'] == 'yes') )
{
$this->enabled = true;
} else {
$this->enabled = false;
}
// End added

Link to comment
Share on other sites

The query will return all the pef records for that customer

 

where customers_id ='" . $customer_id . "'" AND field_id=1);

 

might be better

 

(change 1 as required)

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Link to comment
Share on other sites

Thanks for responding!

 

I tried to put your two solutions together and here's what I got......

 

 

//Added for state funded check
$state_funded_query = tep_db_query("SELECT value, fields_id FROM " . TABLE_CUSTOMERS_TO_EXTRA_FIELDS . " where customers_id ='" . $customer_id . "'" AND fields_id=7);
$state_funded = tep_db_fetch_array($state_funded_query);
//end added

 

and

 

// Added for state funded check (should it be "MODULE_PAYMENT_PO_STATUS"?)
//	  $this->enabled = ((MODULE_PAYMENT_INSTALLMENT_STATUS == 'True') ? true : false);
	if( (MODULE_PAYMENT_PO_STATUS == 'True') && ($state_funded['value'] == 'yes') )
		{
		$this->enabled = true;
		} else {
		$this->enabled = false;
		}
// End added

 

However, when I tried it out, I got:

 

Parse error: syntax error, unexpected '=' in /home/gtilflm/public_html/catalog/includes/modules/payment/po.php on line 11

 

Line 11 is the one containing:

 

$state_funded_query = tep_db_query("SELECT value, fields_id FROM " . TABLE_CUSTOMERS_TO_EXTRA_FIELDS . " where customers_id ='" . $customer_id . "'" AND fields_id=7);

 

 

Any other thoughts? Thanks again!

Link to comment
Share on other sites

Thats what you get when you follow my sql

 

:-)

 

 

Try

 

"' AND fields_id=7");

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Link to comment
Share on other sites

$state_funded_query = tep_db_query("SELECT value, fields_id FROM " . TABLE_CUSTOMERS_TO_EXTRA_FIELDS . " where customers_id ='" . $customer_id . "' AND fields_id=7");

Link to comment
Share on other sites

Thanks for helping out (both of you).

 

I tried it and it's still not working. Could it be because it's a payment method file? To test, I put the following into index.php before application top:

 

//Added for state funded check
$state_funded_query = tep_db_query("SELECT value, fields_id FROM " . TABLE_CUSTOMERS_TO_EXTRA_FIELDS . " where customers_id ='" . $customer_id . "' AND fields_id=7");
$state_funded = tep_db_fetch_array($state_funded_query);
//end added

// Added for state funded check (should it be "MODULE_PAYMENT_PO_STATUS"?)
	if( (MODULE_PAYMENT_PO_STATUS == 'True') && ($state_funded['value'] == 'yes') );
		{echo 'it worked';

		}
// End added

 

It returned "it worked" whether I was logged in or not. So obviously we're not getting data from the database.

 

There are no error message on checkout_payment.php though.

 

 

Any other ideas? Thanks again.

Edited by gtilflm
Link to comment
Share on other sites

I didn't spot that you didn't have an update function

 

You need to add the following:

function update_status() {
 global $customer_id;

 $state_funded_query = tep_db_query("SELECT value, fields_id FROM " . TABLE_CUSTOMERS_TO_EXTRA_FIELDS . " where customers_id ='" . $customer_id . "' AND fields_id=7");
 $state_funded = tep_db_fetch_array($state_funded_query);

 if( (MODULE_PAYMENT_PO_STATUS == 'True') && ($state_funded['value'] == 'yes') );
 {
$this->enabled = true;
 } else {
$this->enabled = false;		
 }
}

Edited by perfectpassion
Link to comment
Share on other sites

Tom, thanks for your continued help with this.

 

Still not working though. Every time I try to test this (whether it's on the po.php or index.php pages) I get an "Unexpected ELSE" error. Below is the entire code for the po.php file. Also, I double checked that the po payment module was enabled in admin during testing. Any other help you could give here would be much appreciated.

 

<?php
/*
 $Id: cc.php,v 1.1.1.1 2004/03/04 23:41:17 ccwjr Exp $
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com
 Copyright (c) 2003 osCommerce
 Released under the GNU General Public License
*/

function update_status() {
 global $customer_id;

 $state_funded_query = tep_db_query("SELECT value, fields_id FROM " . TABLE_CUSTOMERS_TO_EXTRA_FIELDS . " where customers_id ='" . $customer_id . "' AND fields_id=7");
 $state_funded = tep_db_fetch_array($state_funded_query);

 }

 class po {
var $code, $title, $description, $enabled;
// class constructor
function po() {
  global $order;
  $this->code = 'N/A  Doing a FREE trial';
  $this->title = MODULE_PAYMENT_PO_TEXT_TITLE;
  $this->description = MODULE_PAYMENT_PO_TEXT_DESCRIPTION;
  $this->email_footer = MODULE_PAYMENT_PO_TEXT_EMAIL_FOOTER;
  $this->sort_order = MODULE_PAYMENT_PO_SORT_ORDER;
 if( (MODULE_PAYMENT_PO_STATUS == 'True') && ($state_funded['value'] == 'yes') );
 {
$this->enabled = true;
 } else {
$this->enabled = false;		
 }
}
// class methods
function selection() {
  global $order;
  $selection = array('id' => $this->code,
					 'module' => $this->title);
					 //'fields' => array(array('title' => MODULE_PAYMENT_PO_TEXT_NUMBER,
					 //						'field' => tep_draw_input_field('po_number', ''))));
  return $selection;
}
function javascript_validation() {
 /* $js = '  if (payment_value == "' . $this->code . '") {' . "\n" .
		'	var cc_owner = document.checkout_payment.cc_owner.value;' . "\n" .
		'	var cc_number = document.checkout_payment.cc_number.value;' . "\n" .
		'	if (cc_owner == "" || cc_owner.length < ' . CC_OWNER_MIN_LENGTH . ') {' . "\n" .
		'	  error_message = error_message + "' . MODULE_PAYMENT_CC_TEXT_JS_CC_OWNER . '";' . "\n" .
		'	  error = 1;' . "\n" .
		'	}' . "\n" .
		'	if (cc_number == "" || cc_number.length < ' . CC_NUMBER_MIN_LENGTH . ') {' . "\n" .
		'	  error_message = error_message + "' . MODULE_PAYMENT_CC_TEXT_JS_CC_NUMBER . '";' . "\n" .
		'	  error = 1;' . "\n" .
		'	}' . "\n" .
		'  }' . "\n";
*/
  return $js;
}
function pre_confirmation_check() 
{
	/*
	global $HTTP_POST_VARS;
	global $order;
	global $customer_id;
	$error = '';

	$check_credit = tep_db_query("SELECT customers_credit_account_status,customers_credit_status, customers_credit_left from " . TABLE_CUSTOMERS . " where customers_id ='" . $customer_id . "'");

	$credit = tep_db_fetch_array($check_credit);

	If ($credit['customers_credit_account_status'] =='1' )
	{
		If ($HTTP_POST_VARS['po_number'] == '')
		{
			$error = sprintf(MODULE_PAYMENT_PO_TEXT_ERROR_NO_NUMBER);
		}
		else
		{
			if ($credit['customers_credit_status'] == "1")
			{
				if ($order->info['total'] > $credit['customers_credit_left'])
				{
					$error = sprintf(MODULE_PAYMENT_PO_TEXT_ERROR_NOT_ENOUGH_CREDIT. $credit['customers_credit_left']);
				}
			}
			else 
			{
				$error = MODULE_PAYMENT_PO_TEXT_ERROR_CREDIT_DISABLED;
			}
		}
	}
	else
	{

		$error = sprintf(MODULE_PAYMENT_PO_TEXT_ERROR_NO_CREDIT_ACCOUNT);
	}
  If ($error)
  {
	   $payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode($error);
	  tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false));
	}
	*/
	return false;
}
function confirmation() {
  /*global $HTTP_POST_VARS;
  $confirmation = array('title' => $this->title,
						'fields' => array(array('title' => MODULE_PAYMENT_PO_TEXT_NUMBER,
												'field' => $HTTP_POST_VARS['po_number'])));
  return $confirmation;*/
  return false;
}
function process_button() {
  global $HTTP_POST_VARS;
  $process_button_string = tep_draw_hidden_field('po_number', $HTTP_POST_VARS['po_number']);
  return $process_button_string;
}
function before_process() {
  global $HTTP_POST_VARS, $order;

$order ->info['po_number'] = $HTTP_POST_VARS['po_number'];
}
function after_process() 
{
	return false;
}
function get_error() {
  global $HTTP_GET_VARS;
  $error = array('title' => MODULE_PAYMENT_PO_TEXT_ERROR,
				 'error' => stripslashes(urldecode($HTTP_GET_VARS['error'])));
  return $error;
}
function check() {
  if (!isset($this->check)) {
	$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_PO_STATUS'");
	$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 credit account Module', 'MODULE_PAYMENT_PO_STATUS', 'True', 'Do you want to accept payments by credit account?', '6', '0', '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 ('Sort order of display.', 'MODULE_PAYMENT_PO_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0' , now())");
}
function remove() {
  tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
  return array('MODULE_PAYMENT_PO_STATUS', 'MODULE_PAYMENT_PO_SORT_ORDER');
}
 }
?>

 

 

Thanks again

 

 

 

 

 

 

 

 

I didn't spot that you didn't have an update function

 

You need to add the following:

function update_status() {
 global $customer_id;

 $state_funded_query = tep_db_query("SELECT value, fields_id FROM " . TABLE_CUSTOMERS_TO_EXTRA_FIELDS . " where customers_id ='" . $customer_id . "' AND fields_id=7");
 $state_funded = tep_db_fetch_array($state_funded_query);

 if( (MODULE_PAYMENT_PO_STATUS == 'True') && ($state_funded['value'] == 'yes') );
 {
$this->enabled = true;
 } else {
$this->enabled = false;		
 }
}

Link to comment
Share on other sites

The new function was added in the wrong place, it should be:

<?php
/*
 $Id: cc.php,v 1.1.1.1 2004/03/04 23:41:17 ccwjr 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 po {
   var $code, $title, $description, $enabled;

// class constructor
   function po() {
     global $order;
     $this->code = 'N/A  Doing a FREE trial';
     $this->title = MODULE_PAYMENT_PO_TEXT_TITLE;
     $this->description = MODULE_PAYMENT_PO_TEXT_DESCRIPTION;
     $this->email_footer = MODULE_PAYMENT_PO_TEXT_EMAIL_FOOTER;
     $this->sort_order = MODULE_PAYMENT_PO_SORT_ORDER;

     $state_funded_query = tep_db_query("SELECT value, fields_id FROM " . TABLE_CUSTOMERS_TO_EXTRA_FIELDS . " where customers_id ='" . $customer_id . "' AND fields_id=7");
     $state_funded = tep_db_fetch_array($state_funded_query);
     if( (MODULE_PAYMENT_PO_STATUS == 'True') && ($state_funded['value'] == 'yes') );
     {
       $this->enabled = true;
     } else {
       $this->enabled = false;        
     }
 }

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

   $state_funded_query = tep_db_query("SELECT value, fields_id FROM " . TABLE_CUSTOMERS_TO_EXTRA_FIELDS . " where customers_id ='" . $customer_id . "' AND fields_id=7");
   $state_funded = tep_db_fetch_array($state_funded_query);

   if( (MODULE_PAYMENT_PO_STATUS == 'True') && ($state_funded['value'] == 'yes') );
   {
     $this->enabled = true;
   } else {
     $this->enabled = false;        
   }
 }

   function selection() {
     global $order;
     $selection = array('id' => $this->code,
                        'module' => $this->title);
                        //'fields' => array(array('title' => MODULE_PAYMENT_PO_TEXT_NUMBER,
                        //                        'field' => tep_draw_input_field('po_number', ''))));
     return $selection;
   }
   function javascript_validation() {
    /* $js = '  if (payment_value == "' . $this->code . '") {' . "\n" .
           '    var cc_owner = document.checkout_payment.cc_owner.value;' . "\n" .
           '    var cc_number = document.checkout_payment.cc_number.value;' . "\n" .
           '    if (cc_owner == "" || cc_owner.length < ' . CC_OWNER_MIN_LENGTH . ') {' . "\n" .
           '      error_message = error_message + "' . MODULE_PAYMENT_CC_TEXT_JS_CC_OWNER . '";' . "\n" .
           '      error = 1;' . "\n" .
           '    }' . "\n" .
           '    if (cc_number == "" || cc_number.length < ' . CC_NUMBER_MIN_LENGTH . ') {' . "\n" .
           '      error_message = error_message + "' . MODULE_PAYMENT_CC_TEXT_JS_CC_NUMBER . '";' . "\n" .
           '      error = 1;' . "\n" .
           '    }' . "\n" .
           '  }' . "\n";
   */
     return $js;
   }
   function pre_confirmation_check()
   {
       /*
       global $HTTP_POST_VARS;
       global $order;
       global $customer_id;
       $error = '';

       $check_credit = tep_db_query("SELECT customers_credit_account_status,customers_credit_status, customers_credit_left from " . TABLE_CUSTOMERS . " where customers_id ='" . $customer_id . "'");

       $credit = tep_db_fetch_array($check_credit);

       If ($credit['customers_credit_account_status'] =='1' )
       {
           If ($HTTP_POST_VARS['po_number'] == '')
           {
               $error = sprintf(MODULE_PAYMENT_PO_TEXT_ERROR_NO_NUMBER);
           }
           else
           {
               if ($credit['customers_credit_status'] == "1")
               {
                   if ($order->info['total'] > $credit['customers_credit_left'])
                   {
                       $error = sprintf(MODULE_PAYMENT_PO_TEXT_ERROR_NOT_ENOUGH_CREDIT. $credit['customers_credit_left']);
                   }
               }
               else
               {
                   $error = MODULE_PAYMENT_PO_TEXT_ERROR_CREDIT_DISABLED;
               }
           }
       }
       else
       {

           $error = sprintf(MODULE_PAYMENT_PO_TEXT_ERROR_NO_CREDIT_ACCOUNT);
       }
     If ($error)
     {
          $payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode($error);
         tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false));
       }
       */
       return false;
   }

   function confirmation() {
     /*global $HTTP_POST_VARS;
     $confirmation = array('title' => $this->title,
                           'fields' => array(array('title' => MODULE_PAYMENT_PO_TEXT_NUMBER,
                                                   'field' => $HTTP_POST_VARS['po_number'])));
     return $confirmation;*/
     return false;
   }

   function process_button() {
     global $HTTP_POST_VARS;
     $process_button_string = tep_draw_hidden_field('po_number', $HTTP_POST_VARS['po_number']);
     return $process_button_string;
   }

   function before_process() {
     global $HTTP_POST_VARS, $order;

   $order->info['po_number'] = $HTTP_POST_VARS['po_number'];
   }

   function after_process()
   {
       return false;
   }

   function get_error() {
     global $HTTP_GET_VARS;
     $error = array('title' => MODULE_PAYMENT_PO_TEXT_ERROR,
                    'error' => stripslashes(urldecode($HTTP_GET_VARS['error'])));
     return $error;
   }

   function check() {
     if (!isset($this->check)) {
       $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_PO_STATUS'");
       $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 credit account Module', 'MODULE_PAYMENT_PO_STATUS', 'True', 'Do you want to accept payments by credit account?', '6', '0', '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 ('Sort order of display.', 'MODULE_PAYMENT_PO_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0' , now())");
   }

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

   function keys() {
     return array('MODULE_PAYMENT_PO_STATUS', 'MODULE_PAYMENT_PO_SORT_ORDER');
   }
 }
?>

Link to comment
Share on other sites

Tom,

 

Thanks for your continued help w/ this.

 

I copy/pasted the code your gave, but I get the following in the admin under payment modules and on checkout_payment.php:

 

Parse error: syntax error, unexpected T_ELSE in /home/gtilflm/public_html/catalog/includes/modules/payment/po.php on line 26 (the line with the first "else")

 

and

 

Parse error: syntax error, unexpected T_ELSE in /home/gtilflm/public_html/catalog/includes/modules/payment/po.php on line 40 (the line with the second "else")

 

 

When I commented those "elses" out, I did not get the error anymore, but it also did not work. I've been getting that "else error" since the beginning of all of this.

 

Any other thoughts would be appreciated.

 

Thanks.

Link to comment
Share on other sites

Sorry that is entirely my typo

 

Please replace

if( (MODULE_PAYMENT_PO_STATUS == 'True') && ($state_funded['value'] == 'yes') );

with

if( (MODULE_PAYMENT_PO_STATUS == 'True') && ($state_funded['value'] == 'yes') )

(i.e. remove the semi-colon)

Link to comment
Share on other sites

Tom,

 

Ok. Removing the semi-colons stopped the errors...... but it's not working. I set the payment status to true in admin and it does not display no matter if the customer's value is "yes" or "no".

 

Thanks for your continued help with this.

 

 

 

Burt,

 

How would you suggest doing it with a session?

 

 

 

Thanks.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...