JEWbacca Posted August 17, 2010 Posted August 17, 2010 Can anyone suggest a payment module that has a single input field? I can edit what the module is called as what the customer can see, but I need there to be an input field where the customer can type in a check number and then that number be reflected in the admin order page. Thanks in advance for your help! Regards, Nate
Jan Zonjee Posted August 17, 2010 Posted August 17, 2010 Can anyone suggest a payment module that has a single input field? Adapt the old credit card module that is no longer used for live shops?
Guest Posted August 18, 2010 Posted August 18, 2010 Nate, You can also change the language on the comment box and reduce the size of it to accept a cheque number. OR you can alter the purchase order module to require a check number: http://addons.oscommerce.com/info/5710 Chris
JEWbacca Posted August 20, 2010 Author Posted August 20, 2010 Adapt the old credit card module that is no longer used for live shops? Jan, I took your advise and modified the old cc payment module to collect this info as you suggested. Works perfect, with one issue -- validation between the CC module and the new single input module seem to be conflicting as they both use the function "javascript_validation()." When one is disabled the validation works, but when they are both enabled neither seem to be using the validation. To address this I tried the following: 1. renamed the function in the new module to "new_javascript_validation" 2. declared the new function in checkout_payment.php (<?php echo $payment_modules->new_javascript_validation(); ?>) 3. created a new function by copy/pasting the original "javascript_validation" function in /classes/payment.php and renaming it to "new_javascript_validation" That said, I must have missed something as it creates errors when trying to complete the checkout process. Any ideas?
JEWbacca Posted August 20, 2010 Author Posted August 20, 2010 Another thing I attempted was using && to define two functions rather than copy/pasting and renaming in /classes/payment.php. So instead of this: function javascript_validation() { I tried this: function javascript_validation() && new_javascript_validation() { This didn't work either though. Also, i'm not sure if the fact that the function includes a function (check_form) is causing me not to be able to copy/paste/rename it. Here is the original function as included in /classes/payment.php. function javascript_validation() { $js = ''; if (is_array($this->modules)) { $js = '<script language="javascript"><!-- ' . "\n" . 'function check_form() {' . "\n" . ' var error = 0;' . "\n" . ' var error_message = "' . JS_ERROR . '";' . "\n" . ' var payment_value = null;' . "\n" . ' if (document.checkout_payment.payment.length) {' . "\n" . ' for (var i=0; i<document.checkout_payment.payment.length; i++) {' . "\n" . ' if (document.checkout_payment.payment[i].checked) {' . "\n" . ' payment_value = document.checkout_payment.payment[i].value;' . "\n" . ' }' . "\n" . ' }' . "\n" . ' } else if (document.checkout_payment.payment.checked) {' . "\n" . ' payment_value = document.checkout_payment.payment.value;' . "\n" . ' } else if (document.checkout_payment.payment.value) {' . "\n" . ' payment_value = document.checkout_payment.payment.value;' . "\n" . ' }' . "\n\n"; reset($this->modules); while (list(, $value) = each($this->modules)) { $class = substr($value, 0, strrpos($value, '.')); if ($GLOBALS[$class]->enabled) { $js .= $GLOBALS[$class]->javascript_validation(); } } $js .= "\n" . ' if (payment_value == null) {' . "\n" . ' error_message = error_message + "' . JS_ERROR_NO_PAYMENT_MODULE_SELECTED . '";' . "\n" . ' error = 1;' . "\n" . ' }' . "\n\n" . ' if (error == 1) {' . "\n" . ' alert(error_message);' . "\n" . ' return false;' . "\n" . ' } else {' . "\n" . ' return true;' . "\n" . ' }' . "\n" . '}' . "\n" . '//--></script>' . "\n"; } return $js; } function selection() { $selection_array = array(); if (is_array($this->modules)) { reset($this->modules); while (list(, $value) = each($this->modules)) { $class = substr($value, 0, strrpos($value, '.')); if ($GLOBALS[$class]->enabled) { $selection = $GLOBALS[$class]->selection(); if (is_array($selection)) $selection_array[] = $selection; } } } return $selection_array; }
Jan Zonjee Posted August 21, 2010 Posted August 21, 2010 Nate, Works perfect, with one issue -- validation between the CC module and the new single input module seem to be conflicting as they both use the function "javascript_validation()." When one is disabled the validation works, but when they are both enabled neither seem to be using the validation. Not a clue really. I have very, very little experience with payment modules. From the code you showed it seems that the javascript code off all modules is concatenated on checkout_payment.php Likely, there is a JavaScript clash in there. Perhaps using the same variable names or something silly like that. Isn't there a Firefox addon (Firebug?) that can help with JavaScript errors? Perhaps showing the complete Javascript code on checkout_payment.php (or wherever you have the problem) might give us a clue too. I don't think using a new name for the functions will do any good. That said, do you need any Javascript validation on the check number? Perhaps just checking if an x number of numbers has been filled in?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.