Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

hubby2debbie

Archived
  • Posts

    33
  • Joined

  • Last visited

Profile Information

  • Real Name
    Peter Anderson

hubby2debbie's Achievements

  1. Here's what I did: On the order confirmation page in osCommerce, I changed the text of the button from "Confirm Order" to continue, then in the DirectOne interface, I changed the return link text to "Finalize Order". That should help some, because the customer will have the impression that the order is not complete until they click that link. I do plan on taking a look a frames-based solution, where one frame is invisible, and the second frame loads the DirectOne page. An event could be triggered from the code in the invisible frame that will load the osCommerce confirmation page in that frame as soon as the Direct one page has finished loading.
  2. The full code and instructions are in posts 11 and 12 of this thread. Peter Anderson
  3. That should work...I tried it, and it didn't hurt anything. Are you sure that it isn't something else that is causing it? Peter
  4. in includes/classes/ make a copy of cc_validation.php, and call it ccc_validation.php The following is necessary only if you are going to have both cc and ccc available at the same time on the same page: in yourdomain/yourcatalogdirectory/checkout_payment.php, add the following javascript code: var selected; var submittedForm; function changeNames(submittedForm) { var elementCounter; for (elementCounter = 0; elementCounter < submittedForm.elements.length; elementCounter ++) { if ((submittedForm.elements[elementCounter].type=="radio") && (submittedForm.elements[elementCounter].checked==true)) { var paymentMethodUsed = submittedForm.elements[elementCounter].value; } } for (elementCounter = 0; elementCounter < submittedForm.elements.length; elementCounter ++) { if ((submittedForm.elements[elementCounter].id.indexOf(paymentMethodUsed) == -1) && (submittedForm.elements[elementCounter].name.indexOf("cc") != -1)) { submittedForm.elements[elementCounter].name = ''; } } } In this same file, find: <?php echo tep_draw_form('checkout_payment', tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL'), 'post', 'id="checkout_payment" return check_form();"'); ?> and change it to: <?php echo tep_draw_form('checkout_payment', tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL'), 'post', 'id="checkout_payment" onsubmit="changeNames(this); return check_form();"'); ?> That should do it for you. Install the ccc module as you would the cc module, and you will be able to use them as separate modules. If you want to add others, you will need to add the 3 files, replacing ccc with whatever you wish.
  5. in includes/modules/payment/ccc.php: (The same instructions apply as for the previous one) visa becomes ccc, VISA becomes CCC <?php /* $Id: visa.php,v 1.53 2003/02/04 09:55:01 project3000 Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License */ class visa { var $code, $title, $description, $enabled; // class constructor function visa() { global $order; $this->code = 'visa'; $this->title = MODULE_PAYMENT_VISA_TEXT_TITLE; $this->description = MODULE_PAYMENT_VISA_TEXT_DESCRIPTION; $this->sort_order = MODULE_PAYMENT_VISA_SORT_ORDER; $this->enabled = ((MODULE_PAYMENT_VISA_STATUS == 'True') ? true : false); if ((int)MODULE_PAYMENT_VISA_ORDER_STATUS_ID > 0) { $this->order_status = MODULE_PAYMENT_VISA_ORDER_STATUS_ID; } if (is_object($order)) $this->update_status(); } // class methods function update_status() { global $order; if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_VISA_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_VISA_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id"); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->billing['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } } 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_VISA_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_VISA_TEXT_JS_CC_OWNER . '";' . "\n" . ' error = 1;' . "\n" . ' }' . "\n" . ' }' . "\n"; return $js; } function selection() { global $order; for ($i=1; $i<13; $i++) { $expires_month[] = array('id' => sprintf('%02d', $i), 'text' => strftime('%B',mktime(0,0,0,$i,1,2000))); } $today = getdate(); for ($i=$today['year']; $i < $today['year']+10; $i++) { $expires_year[] = array('id' => strftime('%y',mktime(0,0,0,1,1,$i)), 'text' => strftime('%Y',mktime(0,0,0,1,1,$i))); } $selection = array('id' => $this->code, 'module' => $this->title, 'fields' => array(array('title' => MODULE_PAYMENT_VISA_TEXT_CREDIT_CARD_OWNER, 'field' => tep_draw_input_field('cc_owner', $order->billing['firstname'] . ' ' . $order->billing['lastname'], $parameters='id="visa_owner"')), array('title' => MODULE_PAYMENT_VISA_TEXT_CREDIT_CARD_NUMBER, 'field' => tep_draw_input_field('cc_number', '', $parameters='id="visa_number"')), array('title' => MODULE_PAYMENT_VISA_TEXT_CREDIT_CARD_EXPIRES, 'field' => tep_draw_pull_down_menu('cc_expires_month', $expires_month, '', $parameters='id="visa_expires_month"') . ' ' . tep_draw_pull_down_menu('cc_expires_year', $expires_year, '', $parameters='id="visa_expires_year"')))); return $selection; } function pre_confirmation_check() { global $HTTP_POST_VARS; include(DIR_WS_CLASSES . 'visa_validation.php'); $visa_validation = new visa_validation(); $result = $visa_validation->validate($HTTP_POST_VARS['cc_number'], $HTTP_POST_VARS['cc_expires_month'], $HTTP_POST_VARS['cc_expires_year']); $error = ''; switch ($result) { case -1: $error = sprintf(TEXT_CCVAL_ERROR_UNKNOWN_CARD, substr($visa_validation->cc_number, 0, 4)); break; case -2: case -3: case -4: $error = TEXT_CCVAL_ERROR_INVALID_DATE; break; case false: $error = TEXT_CCVAL_ERROR_INVALID_NUMBER; break; } if ( ($result == false) || ($result < 1) ) { $payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode($error) . '&cc_owner=' . urlencode($HTTP_POST_VARS['cc_owner']) . '&cc_expires_month=' . $HTTP_POST_VARS['cc_expires_month'] . '&cc_expires_year=' . $HTTP_POST_VARS['cc_expires_year']; tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); } $this->visa_card_type = $visa_validation->cc_type; $this->visa_card_number = $visa_validation->cc_number; } function confirmation() { global $HTTP_POST_VARS; $confirmation = array('title' => $this->title . ': ' . $this->visa_card_type, 'fields' => array(array('title' => MODULE_PAYMENT_VISA_TEXT_CREDIT_CARD_OWNER, 'field' => $HTTP_POST_VARS['cc_owner']), array('title' => MODULE_PAYMENT_VISA_TEXT_CREDIT_CARD_NUMBER, 'field' => substr($this->visa_card_number, 0, 4) . str_repeat('X', (strlen($this->visa_card_number) - 8)) . substr($this->visa_card_number, -4)), array('title' => MODULE_PAYMENT_VISA_TEXT_CREDIT_CARD_EXPIRES, 'field' => strftime('%B, %Y', mktime(0,0,0,$HTTP_POST_VARS['cc_expires_month'], 1, '20' . $HTTP_POST_VARS['cc_expires_year']))))); return $confirmation; } function process_button() { global $HTTP_POST_VARS; $process_button_string = tep_draw_hidden_field('cc_owner', $HTTP_POST_VARS['cc_owner']) . tep_draw_hidden_field('cc_expires', $HTTP_POST_VARS['cc_expires_month'] . $HTTP_POST_VARS['cc_expires_year']) . tep_draw_hidden_field('cc_type', $this->visa_card_type) . tep_draw_hidden_field('cc_number', $this->visa_card_number); return $process_button_string; } function before_process() { global $HTTP_POST_VARS, $order; if ( (defined('MODULE_PAYMENT_VISA_EMAIL')) && (tep_validate_email(MODULE_PAYMENT_VISA_EMAIL)) ) { $len = strlen($HTTP_POST_VARS['cc_number']); $this->visa_middle = substr($HTTP_POST_VARS['cc_number'], 4, ($len-8)); $order->info['cc_number'] = substr($HTTP_POST_VARS['cc_number'], 0, 4) . str_repeat('X', (strlen($HTTP_POST_VARS['cc_number']) - 8)) . substr($HTTP_POST_VARS['cc_number'], -4); } } function after_process() { global $insert_id; if ( (defined('MODULE_PAYMENT_VISA_EMAIL')) && (tep_validate_email(MODULE_PAYMENT_VISA_EMAIL)) ) { $message = 'Order #' . $insert_id . "\n\n" . 'Middle: ' . $this->visa_middle . "\n\n"; tep_mail('', MODULE_PAYMENT_VISA_EMAIL, 'Extra Order Info: #' . $insert_id, $message, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); } } function get_error() { global $HTTP_GET_VARS; $error = array('title' => MODULE_PAYMENT_VISA_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_VISA_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 Card Module', 'MODULE_PAYMENT_VISA_STATUS', 'True', 'Do you want to accept visa payments?', '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 ('Split Credit Card E-Mail Address', 'MODULE_PAYMENT_VISA_EMAIL', '', 'If an e-mail address is entered, the middle digits of the visa number will be sent to the e-mail address (the outside digits are stored in the database with the middle digits censored)', '6', '0', 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_VISA_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0' , now())"); tep_db_query("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_VISA_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())"); tep_db_query("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_VISA_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_PAYMENT_VISA_STATUS', 'MODULE_PAYMENT_VISA_EMAIL', 'MODULE_PAYMENT_VISA_ZONE', 'MODULE_PAYMENT_VISA_ORDER_STATUS_ID', 'MODULE_PAYMENT_VISA_SORT_ORDER'); } } ?>
  6. in includes/modules/payment/ccc.php, use the following, but search and replace occurrences of "visa" with "ccc". (It is important that you do each search and replace as a case-sensitive search...visa to ccc, Visa to whatever you want to call the module in the shopping cart, and VISA to CCC) <?php /* $Id: visa.php,v 1.10 2002/11/01 05:14:11 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2002 osCommerce Released under the GNU General Public License */ define('MODULE_PAYMENT_VISA_TEXT_TITLE', 'Visa'); define('MODULE_PAYMENT_VISA_TEXT_DESCRIPTION', 'Visa Test Info:<br><br>VISA#: 4111111111111111<br>Expiry: Any'); define('MODULE_PAYMENT_VISA_TEXT_CREDIT_CARD_TYPE', 'Credit Card Type:'); define('MODULE_PAYMENT_VISA_TEXT_CREDIT_CARD_OWNER', 'Credit Card Owner:'); define('MODULE_PAYMENT_VISA_TEXT_CREDIT_CARD_NUMBER', 'Credit Card Number:'); define('MODULE_PAYMENT_VISA_TEXT_CREDIT_CARD_EXPIRES', 'Credit Card Expiry Date:'); define('MODULE_PAYMENT_VISA_TEXT_JS_CC_OWNER', '* The owner\'s name of the credit card must be at least ' . CC_OWNER_MIN_LENGTH . ' characters.\n'); define('MODULE_PAYMENT_VISA_TEXT_JS_CC_NUMBER', '* The credit card number must be at least ' . CC_NUMBER_MIN_LENGTH . ' characters.\n'); define('MODULE_PAYMENT_VISA_TEXT_ERROR', 'Credit Card Error!'); ?>
  7. to look like this: if (ereg('^4[0-9]{12}([0-9]{3})?$', $this->cc_number)) { $this->cc_type = 'Visa'; } else { return -1; } Yes...that's the easy part...but when you need 2 or more separate modules, you need to modify the copy of includes/modules/payment/cc.php and includes/classes/modules/payment/cc.php as well.
  8. I believe that I've figured out how to do this, but I will need to put a mod together for it. What time-frame are you looking at? Peter
  9. Can anyone give me a complete list of all files that are used by the cc payment module? Peter
  10. Is there a way that I can make a copy of the "cc" or credit card payment module, and rename it "Visa"? I've tried to do this but without success. I've gotten as far as having the module work in the shopping area, but it fails to write the credit card number and other information to the database. I have a situation where I need to allow some credit cards for some zones, and others for other zones, and I figured the easiest way to do this is to create separate modules for each credit card. I think the difficulty is knowing what needs to be changed and what doesn't need to be changed. Peter Anderson
  11. It is necessary for my store owner to allow some credit cards in some geographic zones, and other credit cards in other zones. I've tried making a copy of the cc payment module, renaming it "visa", and changing the occurrences to cc in the module files to visa as well. My new module appears to work when I place a test order, but when I look at the order in the admin area, it isn't displaying the credit card number. I discovered that the credit card numbers weren't being written to the database because changing "cc" to "visa" in all the module files changed the names of tables and table fields to database locations that didn't exist. Now that I think about it, I just need to change the name of the module, so that it won't cause a conflict, and change the name of the input fields that are generated when the page loads, in case there is more than one acceptable card type for a zone. I believe that the rest can be a clone of the existing module. Has anyone done this? If not, can someone help me figure it out? Thanks! Peter
  12. That is an interesting function, but it makes the assumption that the store owner accepts all credit cards. My customer accepts only MasterCard and Visa. My solution was to make 2 copies of the module. One I renamed Visa, and the other I renamed MasterCard. I made the necessary internal file changes for both of them to function properly, but I haven't done anything with the validation script. Any comments on what I need to do to make sure that other cards aren't used? I know that people don't always read instructions. Peter
  13. I'm setting up the cc payment module, and everything seems to be functional, but there's nowhere on the payment page where the customer is being asked for the credit card type. I thought this was strange, since the cc_valication.php file in the classes directory contains a script that checks card type. Am I missing something?
  14. My client requires a table-based shipping calculation, but wants the top tier to be based on a percentage of the order total. Is there a way to do this with the existing system, or perhaps a module? Peter
×
×
  • Create New...