Jump to content

Archived

This topic is now archived and is closed to further replies.

PupStar

One Page Checkout for osCommerce 2.3.1

Recommended Posts

Another thing I'm noticing between the checkout I have on 2.2 and 2.3.1 is the change address button in the checkout.

 

In 2.2, I can change address ON the checkout page. In 2.3.1, on two different sites, the change address button opens the checkout_shipping_address (or checkout_billing_address) page. Hmmmm, big difference. Wonder what was missed.

 

It may also be that my 2.2 site is using OPC1.4, where the other two are using OPC1.5. Not sure, but may investigate later, as it will be my personal preference to make these changes to all the sites. Again, it's just cleaner that way.

 

Unfortunately javascript and ajax is not my forte so this one maybe tricky for me urgh

Share this post


Link to post
Share on other sites

Couldn't sleep. Figured I'd play with this a bit.

 

Removed the update button in the shopping cart & the checkout cart. Quantity will automatically update when number is entered into field.

 

Uploaded change to the contribution page (http://addons.oscommerce.com/info/7993)

 

I think it slows it down a bit. What I did was a complete hack job and beyond my comprehension, but it worked nevertheless.

 

Temp test site for my OPC mod is here:

 

http://fulluvscents.com/OPC

Share this post


Link to post
Share on other sites

Couldn't sleep. Figured I'd play with this a bit.

 

Removed the update button in the shopping cart & the checkout cart. Quantity will automatically update when number is entered into field.

 

Uploaded change to the contribution page (http://addons.oscommerce.com/info/7993)

 

I think it slows it down a bit. What I did was a complete hack job and beyond my comprehension, but it worked nevertheless.

 

Temp test site for my OPC mod is here:

 

http://fulluvscents.com/OPC

 

Hmm I slept like a log for a change (whatever that saying means) (w00t)

 

I have just checked your test site and the layout is a bit screwed up in firefox, just thought you should know.

 

Also when updating the cart qty on OPC the ajax update kicks in when you place the cursor in the qty box (in firefox, not tested other browsers). So if you want to change the qty from 1 to 2 by pressing 'backspace' to delete the 1, the popup kicks in before you can enter 2.

 

Regards

 

Mark

Share this post


Link to post
Share on other sites

Hmmm, I use chrome. Didn't test other browsers. You're right about the layout in firefox. Also tried to test IE, and I can't log into a customer account in IE. I can log in from the checkout page (which is missing the login button), but not from the regular login.php page.

 

Crud.

 

I have a live site using this checkout too. It also has a bad layout in FF, but I have no problems logging in through IE. Suppose I'm off to fix these two problems (and maybe the missing login button as well).

Share this post


Link to post
Share on other sites

Fixed the FF layout issue and uploaded new package with the fix. It required separating the boxes with a span to keep the divs from laying on top of one another.

 

Can't for the life of me figure out why I can't log into a customer account in IE on the OPC test site. I have no problem with any other live or test site so it isn't in the browser settings. It also isn't in the login.php file as this matches the other sites exactly. Blah.

 

Regarding the autoupdate, it doesn't activate until you press a key on the keyboard. This is the way it's always been. It works like that in my 2.2 site as well.

 

If you cursor to the box and press the backspace key, it will activate. If you select the existing quantity and overwrite it by keying another number, this also activates it. If you want to enter a 2 digit quantity, you have to be quick on the trigger because if you're slow, then it will activate at the first keystroke. If you want to change it to say 100, then forget it. It won't let you get three digits before activating. The mod could be set up to give the user the option of auto-update or manual update... Personally I like the auto, even with it's sensitivities. But, I could see others not liking it.

Share this post


Link to post
Share on other sites

Fixed the FF layout issue and uploaded new package with the fix. It required separating the boxes with a span to keep the divs from laying on top of one another.

 

Not sure if you see it but there are still issues with the layout in firefox, they show on my laptop but do not have another pc available to check on a different screen.

 

Can't for the life of me figure out why I can't log into a customer account in IE on the OPC test site. I have no problem with any other live or test site so it isn't in the browser settings. It also isn't in the login.php file as this matches the other sites exactly. Blah.

 

This is a strange one because my test site logs in perfectly with IE (although there are other errors >_< )

 

Regarding the autoupdate, it doesn't activate until you press a key on the keyboard. This is the way it's always been. It works like that in my 2.2 site as well.

 

If you cursor to the box and press the backspace key, it will activate. If you select the existing quantity and overwrite it by keying another number, this also activates it. If you want to enter a 2 digit quantity, you have to be quick on the trigger because if you're slow, then it will activate at the first keystroke. If you want to change it to say 100, then forget it. It won't let you get three digits before activating. The mod could be set up to give the user the option of auto-update or manual update... Personally I like the auto, even with it's sensitivities. But, I could see others not liking it.

 

Hmm I may stick with the update button as I am not entirely comfortable with this update, like you say 'to each their own'

 

Mark

Share this post


Link to post
Share on other sites

Hi guys

 

My comments from several posts ago are probably water under the bridge already, but just some thoughts:

 

The way this thread was going, it looked like Pupstar first 'announced' that he was working on a One Page Checkout (OPC) contribution, then fulluvscents appeared saying "Oh I've already done one" - and that's when I jumped in by encouraging Pupstar to not abandon his contribution, and I listed what I didn't like about fulluvscents contrib.

 

Fulluvscents, you were a bit oversensitive to my comments. Your contrib is an excellent one, and after spending literally several days researching and testing checkout contributions (I even kept a spreadsheet and installed several OsCommerece test sites) I even shortlisted yours to use on my site, but eventually decided against it of things that weren't right for my particular needs. That's not a criticism and you shouldn't be offended, and I was hoping that the *new* contrib that PupStar was working on was going to address my issues -- if it ever saw the light of day now that he was about to "give up" because you had already done one.

 

Nevertheless, good luck with your contributions, and I'm probably stuck on osCommerce 2.2 anyway so this contrib probably doesn't apply to me.

 

Cheers!

Share this post


Link to post
Share on other sites

Yup, water under the bridge. Today's beef is with welfare recipients, completely capable people, taking advantage of the system who complain about government spending and/or the HASSLE of getting free handouts. Haha. Oh yeah, and the fact that it always rains when I have work to do outside.

Share this post


Link to post
Share on other sites

Hi guys

 

My comments from several posts ago are probably water under the bridge already, but just some thoughts:

 

The way this thread was going, it looked like Pupstar first 'announced' that he was working on a One Page Checkout (OPC) contribution, then fulluvscents appeared saying "Oh I've already done one" - and that's when I jumped in by encouraging Pupstar to not abandon his contribution, and I listed what I didn't like about fulluvscents contrib.

 

It did actually turn out that myself and fulluvscents version of OPC were pretty much identical, the only difference being I had prettified my version to be more in line with the 2.3.1 template structure and look.

 

Fulluvscents, you were a bit oversensitive to my comments. Your contrib is an excellent one, and after spending literally several days researching and testing checkout contributions (I even kept a spreadsheet and installed several OsCommerece test sites) I even shortlisted yours to use on my site, but eventually decided against it of things that weren't right for my particular needs. That's not a criticism and you shouldn't be offended, and I was hoping that the *new* contrib that PupStar was working on was going to address my issues -- if it ever saw the light of day now that he was about to "give up" because you had already done one.

 

Nope never given up, just merged both versions (which works pretty sweet).

 

I do now have a test site up and running (behind a secure login) which I am happy for you to have a look at, send me a pm if interested.

 

Nevertheless, good luck with your contributions, and I'm probably stuck on osCommerce 2.2 anyway so this contrib probably doesn't apply to me.

 

Cheers!

 

If you really need to get this working to your exact requirements you could always try approaching a couple of the more well known forum members who do this for a living and they could quote you accordingly.

 

Mark

Share this post


Link to post
Share on other sites

Fulluvscents, put 2 or more different items in your cart on your live site, got to checkout page. If you put a "-" in front of the less expensive item it subtracts from your total but keeps the item in the cart. It will complete an order also. Here's a solution that validates the input. I like the way the cart part works in opc 1.4 vs 1.5 versus the buttons they have plus needing the update button.

 

In classes/onepage_checkout.php

find function updateCartProducts and add this after the foreach

   // Added conditionals for cart JW
     if (!is_numeric($pID) || !is_numeric($qty) ) {
       return false;
     }
     if ($qty <= 0) {
       $cart->remove($pID);
     }
     // END JW added

 

Now, I have a question for you. Does Authorize.net work for you using opc 1.5?


I'm not really a dog.

Share this post


Link to post
Share on other sites

Authorize.net works for me with OPC 1.4 in OSC 2.2rc2a, AND OPC 1.5 in OSC 2.3.1. None of the existing modules works with OPC, nor do any of the fixes which have been presented in the original support forums.

 

Here is my authorize.net CC module that I'm using with OPC 1.4 in osc 2.2rc2a. If it doesn't work in your version, let me know. My other script is significantly different.

 

<?php
 class authorizenet_cc_aim {
   var $code, $title, $description, $enabled;
   function authorizenet_cc_aim() {
     global $order;
     $this->signature = 'authorizenet|authorizenet_cc_aim|1.0|2.2';
     $this->code = 'authorizenet_cc_aim';
     $this->title = MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TEXT_TITLE;
     $this->public_title = MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TEXT_PUBLIC_TITLE;
     $this->description = MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TEXT_DESCRIPTION;
     $this->sort_order = MODULE_PAYMENT_AUTHORIZENET_CC_AIM_SORT_ORDER;
     $this->enabled = ((MODULE_PAYMENT_AUTHORIZENET_CC_AIM_STATUS == 'True') ? true : false);
     if ((int)MODULE_PAYMENT_AUTHORIZENET_CC_AIM_ORDER_STATUS_ID > 0) {
       $this->order_status = MODULE_PAYMENT_AUTHORIZENET_CC_AIM_ORDER_STATUS_ID;
     }
     if (is_object($order)) $this->update_status();
   }
   function update_status() {
     global $order;
// disable the module if  free downloads
     if ($this->enabled == true) {
       global $cart;
       if ($cart->show_total() == 0.00) {
         $this->enabled = false;
       }
     }

     if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_AUTHORIZENET_CC_AIM_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_AUTHORIZENET_CC_AIM_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() {
     return false;
   }
   function selection() {
     return array('id' => $this->code,
                  'module' => $this->public_title);
   }
   function pre_confirmation_check() {
     return false;
   }
   function confirmation() {
     global $order, $_POST;
     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)));
     }
     $confirmation = array('fields' => array(array('title' => MODULE_PAYMENT_AUTHORIZENET_CC_AIM_CREDIT_CARD_OWNER,
                                                   'field' => tep_draw_input_field('cc_owner', $order->billing['firstname'] . ' ' . $order->billing['lastname'])),
                                             array('title' => MODULE_PAYMENT_AUTHORIZENET_CC_AIM_CREDIT_CARD_NUMBER,
                                                   'field' => tep_draw_input_field('cc_number_nh-dns')),
                                             array('title' => MODULE_PAYMENT_AUTHORIZENET_CC_AIM_CREDIT_CARD_EXPIRES,
                                                   'field' => tep_draw_pull_down_menu('cc_expires_month', $expires_month) . ' ' . tep_draw_pull_down_menu('cc_expires_year', $expires_year)),
                                             array('title' => MODULE_PAYMENT_AUTHORIZENET_CC_AIM_CREDIT_CARD_CVC,
                                                   'field' => tep_draw_input_field('cc_cvc_nh-dns', '', 'size="5" maxlength="4"'))));
     return $confirmation;
   }
   function process_button() {
     return false;
   }
   function before_process() {
     global $_POST, $customer_id, $order, $sendto, $currency;
$last_order_id = tep_db_query("select * from ".TABLE_ORDERS." order by orders_id desc limit 1");
$last_inv = tep_db_fetch_array($last_order_id);
$invoiceNumber = $last_inv['orders_id'] + 1;
	$params = array('x_login' => substr(MODULE_PAYMENT_AUTHORIZENET_CC_AIM_LOGIN_ID, 0, 20),
                        'x_tran_key' => substr(MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TRANSACTION_KEY, 0, 16),
                      'x_version' => '3.1',
                      'x_delim_data' => 'TRUE',
                      'x_delim_char' => ',',
                      'x_encap_char' => '"',
                      'x_relay_response' => 'FALSE',
                      'x_first_name' => substr($order->billing['firstname'], 0, 50),
                      'x_last_name' => substr($order->billing['lastname'], 0, 50),
                      'x_company' => substr($order->billing['company'], 0, 50),
       	              'x_address' => substr($order->billing['street_address'], 0, 60),
                      'x_city' => substr($order->billing['city'], 0, 40),
               	      'x_state' => substr($order->billing['state'], 0, 40),
                      'x_zip' => substr($order->billing['postcode'], 0, 20),
                      'x_country' => substr($order->billing['country']['title'], 0, 60),
                      'x_phone' => substr($order->customer['telephone'], 0, 25),
                      'x_cust_id' => substr($customer_id, 0, 20),
			'x_invoice_num' => $invoiceNumber,
                      'x_customer_ip' => tep_get_ip_address(),
                      'x_email' => substr($order->customer['email_address'], 0, 255),
                      'x_description' => substr(STORE_NAME, 0, 255),
                      'x_amount' => substr($this->format_raw($order->info['total']), 0, 15),
                      'x_currency_code' => substr($currency, 0, 3),
                      'x_method' => 'CC',
                      'x_type' => ((MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TRANSACTION_METHOD == 'Capture') ? 'AUTH_CAPTURE' : 'AUTH_ONLY'),
                      'x_card_num' => substr($_POST['cc_number_nh-dns'], 0, 22),
                      'x_exp_date' => $_POST['cc_expires_month'] . $_POST['cc_expires_year'],
                      'x_card_code' => substr($_POST['cc_cvc_nh-dns'], 0, 4));
     if (is_numeric($sendto) && ($sendto > 0)) {
       $params['x_ship_to_first_name'] = substr($order->delivery['firstname'], 0, 50);
       $params['x_ship_to_last_name'] = substr($order->delivery['lastname'], 0, 50);
       $params['x_ship_to_company'] = substr($order->delivery['company'], 0, 50);
       $params['x_ship_to_address'] = substr($order->delivery['street_address'], 0, 60);
       $params['x_ship_to_city'] = substr($order->delivery['city'], 0, 40);
       $params['x_ship_to_state'] = substr($order->delivery['state'], 0, 40);
       $params['x_ship_to_zip'] = substr($order->delivery['postcode'], 0, 20);
       $params['x_ship_to_country'] = substr($order->delivery['country']['title'], 0, 60);
     }
     if (MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TRANSACTION_MODE == 'Test') {
       $params['x_test_request'] = 'TRUE';
     }
     $tax_value = 0;
     foreach ($order->info['tax_groups'] as $key => $value) {
       if ($value > 0) {
         $tax_value += $this->format_raw($value);
       }
     }
     if ($tax_value > 0) {
       $params['x_tax'] = $this->format_raw($tax_value);
     }
     $params['x_freight'] = $this->format_raw($order->info['shipping_cost']);
     $post_string = '';
     foreach ($params as $key => $value) {
       $post_string .= $key . '=' . urlencode(trim($value)) . '&';
     }
     $post_string = substr($post_string, 0, -1);
     for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
       $post_string .= '&x_line_item=' . urlencode($i+1) . '<|>' . urlencode(substr($order->products[$i]['name'], 0, 31)) . '<|>' . urlencode(substr($order->products[$i]['name'], 0, 255)) . '<|>' . urlencode($order->products[$i]['qty']) . '<|>' . urlencode($this->format_raw($order->products[$i]['final_price'])) . '<|>' . urlencode($order->products[$i]['tax'] > 0 ? 'YES' : 'NO');
     }
     switch (MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TRANSACTION_SERVER) {
       case 'Live':
         $gateway_url = 'https://secure.authorize.net/gateway/transact.dll';
         break;
       default:
         $gateway_url = 'https://test.authorize.net/gateway/transact.dll';
         break;
     }
     $transaction_response = $this->sendTransactionToGateway($gateway_url, $post_string);
     if (!empty($transaction_response)) {
       $regs = preg_split("/,(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))/", $transaction_response);
       foreach ($regs as $key => $value) {
         $regs[$key] = substr($value, 1, -1); // remove double quotes
       }
     } else {
       $regs = array('-1', '-1', '-1');
     }
     $error = false;
     if ($regs[0] == '1') {
       if (tep_not_null(MODULE_PAYMENT_AUTHORIZENET_CC_AIM_MD5_HASH)) {
         if (strtoupper($regs[37]) != strtoupper(md5(MODULE_PAYMENT_AUTHORIZENET_CC_AIM_MD5_HASH . MODULE_PAYMENT_AUTHORIZENET_CC_AIM_LOGIN_ID . $regs[6] . $this->format_raw($order->info['total'])))) {
           $error = 'general';
         }
       }
     } else {
       switch ($regs[2]) {
         case '7':
           $error = 'invalid_expiration_date';
           break;
         case '8':
           $error = 'expired';
           break;
         case '6':
         case '17':
         case '28':
           $error = 'declined';
           break;
         case '78':
           $error = 'cvc';
           break;
         default:
           $error = 'general';
           break;
       }
     }
     if ($error != false) {
       tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . $error, 'SSL'));
     }
   }
   function after_process() {
     return false;
   }
   function get_error() {
     global $_GET;
     $error_message = MODULE_PAYMENT_AUTHORIZENET_CC_AIM_ERROR_GENERAL;
     switch ($_GET['error']) {
       case 'invalid_expiration_date':
         $error_message = MODULE_PAYMENT_AUTHORIZENET_CC_AIM_ERROR_INVALID_EXP_DATE;
         break;
       case 'expired':
         $error_message = MODULE_PAYMENT_AUTHORIZENET_CC_AIM_ERROR_EXPIRED;
         break;
       case 'declined':
         $error_message = MODULE_PAYMENT_AUTHORIZENET_CC_AIM_ERROR_DECLINED;
         break;
       case 'cvc':
         $error_message = MODULE_PAYMENT_AUTHORIZENET_CC_AIM_ERROR_CVC;
         break;
       default:
         $error_message = MODULE_PAYMENT_AUTHORIZENET_CC_AIM_ERROR_GENERAL;
         break;
     }
     $error = array('title' => MODULE_PAYMENT_AUTHORIZENET_CC_AIM_ERROR_TITLE,
                    'error' => $error_message);
     return $error;
   }
   function check() {
     if (!isset($this->_check)) {
       $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_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 Authorize.net Credit Card AIM', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_STATUS', 'False', 'Do you want to accept Authorize.net Credit Card AIM 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 ('Login ID', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_LOGIN_ID', '', 'The login ID used for the Authorize.net service', '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 ('Transaction Key', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TRANSACTION_KEY', '', 'Transaction key used for encrypting data', '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 ('MD5 Hash', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_MD5_HASH', '', 'The MD5 hash value to verify transactions with', '6', '0', now())");
     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 ('Transaction Server', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TRANSACTION_SERVER', 'Live', 'Perform transactions on the live or test server. The test server should only be used by developers with Authorize.net test accounts.', '6', '0', 'tep_cfg_select_option(array(\'Live\', \'Test\'), ', now())");
     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 ('Transaction Mode', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TRANSACTION_MODE', 'Live', 'Transaction mode used for processing orders', '6', '0', 'tep_cfg_select_option(array(\'Live\', \'Test\'), ', now())");
     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 ('Transaction Method', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TRANSACTION_METHOD', 'Authorization', 'The processing method to use for each transaction.', '6', '0', 'tep_cfg_select_option(array(\'Authorization\', \'Capture\'), ', 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_AUTHORIZENET_CC_AIM_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_AUTHORIZENET_CC_AIM_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_AUTHORIZENET_CC_AIM_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())");
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('cURL Program Location', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_CURL', '/usr/bin/curl', 'The location to the cURL program application.', '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_AUTHORIZENET_CC_AIM_STATUS', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_LOGIN_ID', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TRANSACTION_KEY', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_MD5_HASH', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TRANSACTION_SERVER', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TRANSACTION_MODE', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TRANSACTION_METHOD', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_ZONE', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_ORDER_STATUS_ID', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_SORT_ORDER', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_CURL');
   }
   function _hmac($key, $data) {
     if (function_exists('mhash') && defined('MHASH_MD5')) {
       return bin2hex(mhash(MHASH_MD5, $data, $key));
     }
     $b = 64;
     if (strlen($key) > $B) {
       $key = pack("H*",md5($key));
     }
     $key = str_pad($key, $b, chr(0x00));
     $ipad = str_pad('', $b, chr(0x36));
     $opad = str_pad('', $b, chr(0x5c));
     $k_ipad = $key ^ $ipad ;
     $k_opad = $key ^ $opad;
     return md5($k_opad . pack("H*",md5($k_ipad . $data)));
   }
   function sendTransactionToGateway($url, $parameters) {
     $server = parse_url($url);
     if (isset($server['port']) === false) {
       $server['port'] = ($server['scheme'] == 'https') ? 443 : 80;
     }
     if (isset($server['path']) === false) {
       $server['path'] = '/';
     }
     if (isset($server['user']) && isset($server['pass'])) {
       $header[] = 'Authorization: Basic ' . base64_encode($server['user'] . ':' . $server['pass']);
     }
     if (function_exists('curl_init')) {
       $curl = curl_init($server['scheme'] . '://' . $server['host'] . $server['path'] . (isset($server['query']) ? '?' . $server['query'] : ''));
       curl_setopt($curl, CURLOPT_PORT, $server['port']);
       curl_setopt($curl, CURLOPT_HEADER, 0);
       curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
       curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
       curl_setopt($curl, CURLOPT_FORBID_REUSE, 1);
       curl_setopt($curl, CURLOPT_FRESH_CONNECT, 1);
       curl_setopt($curl, CURLOPT_POST, 1);
       curl_setopt($curl, CURLOPT_POSTFIELDS, $parameters);
       $result = curl_exec($curl);
       curl_close($curl);
     } else {
       exec(escapeshellarg(MODULE_PAYMENT_AUTHORIZENET_CC_AIM_CURL) . ' -d ' . escapeshellarg($parameters) . ' "' . $server['scheme'] . '://' . $server['host'] . $server['path'] . (isset($server['query']) ? '?' . $server['query'] : '') . '" -P ' . $server['port'] . ' -k', $result);
       $result = implode("\n", $result);
     }
     return $result;
   }
// format prices without currency formatting
   function format_raw($number, $currency_code = '', $currency_value = '') {
     global $currencies, $currency;
     if (empty($currency_code) || !$this->is_set($currency_code)) {
       $currency_code = $currency;
     }
     if (empty($currency_value) || !is_numeric($currency_value)) {
       $currency_value = $currencies->currencies[$currency_code]['value'];
     }
     return number_format(tep_round($number * $currency_value, $currencies->currencies[$currency_code]['decimal_places']), $currencies->currencies[$currency_code]['decimal_places'], '.', '');
   }
 }
?>

Share this post


Link to post
Share on other sites

My previous code was flawed. If there was an attribute it wouldn't update. This works without problems. I don't like the idea of it accepting a minus sign or zero, etc

   // Added conditionals for cart JW
     if (!is_numeric($qty) ) {
       return false;
     }
     if ($qty <= 0) {
       $cart->remove($pID);
     }
     // END JW added

 

Have you actually transmitted and gotten a result from A.net using opc1.5 and jquery 1.4.2 and ui 1.8.5? Because mine looks like it works but a.net doesn't get card numbers. I don't think my problem is in my a.net module but I'm on the trail to solving this. jquery 1.4.2+ is faster than 1.3.2

 

If your's works then my problem is probably in annother mod.


I'm not really a dog.

Share this post


Link to post
Share on other sites

Try this one. It's a completely different script. I have two different CC scripts running on different sites. This particular one is running on an OSC2.3.1 site with nearly the same OPC module that I uploaded, and is using js 1.4.2 and 1.8.5. I have FOUR authorize.net modules (CC, Echecks, ARB CC, and ARB echecks) and all four are running perfectly on that site.

 

I think I hacked out all of the stuff that was personalized in this, but if you run across something, hopefully, you'll be able to find it and hack it out.

 

This script does not perform a pre-confirmation check because it is not necessary. Anything that the pre-confirmation would have done, a.net will do using the AIM module, and a.net specifically states that pre-confirmations are not needed with the AIM module.

 

And it also includes a debug feature so that if there are any issues, you can turn on the debug and pin them down.

 

<?php

class authorizenet_cc_aim
{
var $code, $title, $public_title, $description, $enabled;
function authorizenet_cc_aim()
	{
	global $order;
	$this->code = 'authorizenet_cc_aim';
	$this->title = MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TEXT_TITLE;
	$this->public_title = MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TEXT_PUBLIC_TITLE;
	$this->description = MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TEXT_DESCRIPTION;
	$this->enabled = ((MODULE_PAYMENT_AUTHORIZENET_CC_AIM_STATUS == 'True') ? true : false);
	$this->sort_order = MODULE_PAYMENT_AUTHORIZENET_CC_AIM_SORT_ORDER;
	if ((int)MODULE_PAYMENT_AUTHORIZENET_CC_AIM_ORDER_STATUS_ID > 0)
		{
		$this->order_status = MODULE_PAYMENT_AUTHORIZENET_CC_AIM_ORDER_STATUS;
		}
	if (is_object($order)) $this->update_status();
	}

function update_status()
	{
	global $order;
	if ($this->enabled == true)
		{
		global $cart;
		if ($cart->show_total() == 0)
			{
			$this->enabled = false;
			}
		}
	if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_AUTHORIZENET_CC_AIM_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_AUTHORIZENET_CC_AIM_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()
	{
	return false;
	}

function selection()
	{
	return array(	'id' => $this->code,
			'module' => $this->public_title);
	}

function pre_confirmation_check()
	{
	return false;
	}

function confirmation()
	{
	global $order, $currencies;
	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)));
	}
	$confirmation = array(	'id' => $this->code,
				'module' => $this->title,
				'fields' => array(array('title' => MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TEXT_CREDIT_CARD_OWNER,
							'field' => tep_draw_input_field('authorizenet_cc_aim_cc_owner', $order->billing['firstname'] . ' ' . $order->billing['lastname'])),
				 		  array('title' => MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TEXT_CREDIT_CARD_NUMBER,
							'field' => tep_draw_input_field('authorizenet_cc_aim_cc_number')),
				 		  array('title' => MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TEXT_CREDIT_CARD_EXPIRES,
							'field' => tep_draw_pull_down_menu('authorizenet_cc_aim_cc_expires_month', $expires_month, $today['mon']) . ' ' . tep_draw_pull_down_menu('authorizenet_cc_aim_cc_expires_year', $expires_year)),
	return $confirmation;
	}

function process_button()
	{
	$process_button_string  = tep_draw_hidden_field('authorizenet_cc_aim_cc_expires_month', $this->cc_expires_month) . "\n";
	$process_button_string .= tep_draw_hidden_field('authorizenet_cc_aim_cc_expires_year', $this->cc_expires_year) . "\n";
	$process_button_string .= tep_draw_hidden_field('authorizenet_cc_aim_cc_number', $this->cc_card_number) . "\n";
	return $process_button_string;
	}

function before_process()
	{
	global $HTTP_POST_VARS, $customer_id, $order, $sendto, $currency;
	if (MODULE_PAYMENT_AUTHORIZENET_CC_AIM_SERVER == 'Test')
		{
		$posturl = 'https://test.authorize.net/gateway/transact.dll';
		}
	else
		{
		$posturl = 'https://secure.authorize.net/gateway/transact.dll';
		}
	$last_order_id = tep_db_query("select * from ".TABLE_ORDERS." order by orders_id desc limit 1");
	$last_inv = tep_db_fetch_array($last_order_id);
	$invoiceNumber = $last_inv['orders_id'] + 1;
	$params = array(
			'x_login' => substr(MODULE_PAYMENT_AUTHORIZENET_CC_AIM_LOGIN, 0, 20), 
			'x_tran_key' => substr(MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TXNKEY, 0, 16),
			'x_version' => '3.1',
			'x_delim_data' => 'TRUE',
			'x_delim_char' => ',',
			'x_encap_char' => '"',
			'x_relay_response' => 'FALSE',
			'x_first_name' => substr($order->billing['firstname'], 0, 50),
			'x_last_name' => substr($order->billing['lastname'], 0, 50),
			'x_company' => substr($order->billing['company'], 0, 50),
			'x_address' => substr($order->billing['street_address'], 0, 60),
			'x_city' => substr($order->billing['city'], 0, 40),
			'x_state' => substr($order->billing['state'], 0, 40),
			'x_zip' => substr($order->billing['postcode'], 0, 20),
			'x_country' => substr($order->billing['country']['title'], 0, 60),
			'x_phone' => substr($order->customer['telephone'], 0, 25),
			'x_cust_id' => substr($customer_id, 0, 20),
			'x_invoice_num' => $invoiceNumber,
			'x_customer_ip' => tep_get_ip_address(),
			'x_email' => substr($order->customer['email_address'], 0, 255),
			'x_description' => substr(STORE_NAME, 0, 255),
			'x_amount' => substr($order->info['total'], 0, 15),
			'x_currency_code' => substr($currency, 0, 3),
			'x_method' => 'CC',
			'x_type' => ((MODULE_PAYMENT_AUTHORIZENET_CC_AIM_METHOD == 'AUTH_CAPTURE') ? 'AUTH_CAPTURE' : 'AUTH_ONLY'),
			'x_card_num' => $HTTP_POST_VARS['authorizenet_cc_aim_cc_number'],
			'x_exp_date' => $HTTP_POST_VARS['authorizenet_cc_aim_cc_expires_month'] . $HTTP_POST_VARS['authorizenet_cc_aim_cc_expires_year'],
			'x_card_code' => $HTTP_POST_VARS['authorizenet_cc_aim_cc_cvc'],
			'x_email_customer' => ((MODULE_PAYMENT_AUTHORIZENET_CC_AIM_EMAIL_CUSTOMER == 'True') ? 'TRUE': 'FALSE'));
	if (is_numeric($sendto) && ($sendto > 0))
		{
		$params['x_ship_to_first_name'] = substr($order->delivery['firstname'], 0, 50);
		$params['x_ship_to_last_name'] = substr($order->delivery['lastname'], 0, 50);
		$params['x_ship_to_company'] = substr($order->delivery['company'], 0, 50);
		$params['x_ship_to_address'] = substr($order->delivery['street_address'], 0, 60);
		$params['x_ship_to_city'] = substr($order->delivery['city'], 0, 40);
		$params['x_ship_to_state'] = substr($order->delivery['state'], 0, 40);
		$params['x_ship_to_zip'] = substr($order->delivery['postcode'], 0, 20);
		$params['x_ship_to_country'] = substr($order->delivery['country']['title'], 0, 60);
		}
	if (MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TESTMODE == 'Test')
		{
		$params['x_test_request'] = 'TRUE';
		}
	$tax_value = 0;
	foreach ($order->info['tax_groups'] as $key => $value)
		{
		if ($value > 0)
			{
			$tax_value += $this->format_raw($value);
			}
		}
	if ($tax_value > 0)
		{
		$params['x_tax'] = $this->format_raw($tax_value);
		}
	$params['x_freight'] = $order->info['shipping_cost'];
	$content = '';
	foreach ($params as $key => $value)
		{
		$content .= $key . '=' . urlencode(trim($value)) . '&';
		}
	$content = substr($content, 0, -1);
	for ($i=0, $n=sizeof($order->products); $i<$n; $i++)
		{
		$content .= '&x_line_item=' . urlencode($i+1) . '<|>' . urlencode(substr($order->products[$i]['name'], 0, 31)) . '<|>' . urlencode(substr($order->products[$i]['name'], 0, 255)) . '<|>' . urlencode($order->products[$i]['qty']) . '<|>' . urlencode($order->products[$i]['final_price']) . '<|>' . urlencode($order->products[$i]['tax'] > 0 ? 'YES' : 'NO');
		}
	$response = $this->send_request_via_curl($posturl,$content);
	if (MODULE_PAYMENT_AUTHORIZENET_CC_AIM_DEBUG == 'On')
		{
		$fp = fopen('data.log', "a");
		fwrite($fp, "$response");
		fwrite($fp, "$content");
		fclose($fp);
		}
	if ($response)
		{
		$regs = preg_split("/,(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))/", $response);
		foreach ($regs as $key => $value)
			{
			$regs[$key] = substr($value, 1, -1); // remove double quotes
			}
		switch ($regs[0])
			{
			case '1':
			return;
			break;
			case '2':
			$this->error = MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TEXT_ERROR_DECLINED;
			tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode($this->error), 'SSL', true, false));
			break;
			case '3':
			$this->error = MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TEXT_ERROR_GENERAL;
			tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode($this->error), 'SSL', true, false));
			break;
			case '4':
			$this->error = MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TEXT_ERROR_REVIEW;
			tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode($this->error), 'SSL', true, false));
			break;
			default:
			$this->error = MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TEXT_ERROR_GENERAL;
			tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode($this->error), 'SSL', true, false));
			break;
			}
		}
	else
		{
		$this->error = MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TEXT_ERROR_GENERAL;
		tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode($this->error), 'SSL', true, false));
		}
	}

function after_process()
	{
	global $order, $customer_id, $currencies;
	$email_order =  '<font size=3>Written authorization is required for payment processing.  To complete your payment authorization, you must respond to this email with ACCEPT in the subject line.  Do NOT alter the content of this email.<br><br>'.
	  		'<font size=3>By responding to this email with ACCEPT in the subject line, you authorize '. STORE_NAME .' to debit your account for the amount of '. $currencies->format($order->info['total']) .' as prepayment for the estimated total of your services.  If the amount due for actual services rendered is less than this prepayment, then a refund will be issued for the difference.  If the amount due for actual services rendered is more than this prepayment, then the difference must be paid in full at the time of service.</font>';
	tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], MODULE_PAYMENT_AUTHORIZENET_CC_AIM_EMAIL_TEXT_SUBJECT, $email_order, MODULE_PAYMENT_AUTHORIZENET_CC_AIM_EMAIL_OWNER, MODULE_PAYMENT_AUTHORIZENET_CC_AIM_EMAIL);
	}

function get_error()
	{
	$error = array(	'title' => MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TEXT_ERROR,
			'error' => stripslashes(urldecode($this->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_AUTHORIZENET_CC_AIM_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 Authorize.net Module', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_STATUS', 'True', 'Do you want to accept Authorize.net Credit Card 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 ('Login Username', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_LOGIN', '', 'The login username used for the Authorize.net service', '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 ('Transaction Key', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TXNKEY', '', 'Transaction Key used for encrypting TP data', '6', '0', now())");
	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 ('Transaction Server', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_SERVER', 'Test', 'A developer account is required for the test server', '6', '0', 'tep_cfg_select_option(array(\'Live\', \'Test\'), ', 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_AUTHORIZENET_CC_AIM_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_AUTHORIZENET_CC_AIM_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '0', '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_AUTHORIZENET_CC_AIM_ORDER_STATUS', '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())");
	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 ('Transaction Mode', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TESTMODE', 'Production', 'Transaction mode used for processing orders', '6', '0', 'tep_cfg_select_option(array(\'Test\', \'Production\'), ', now())");
	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 ('Debug Mode', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_DEBUG', 'Off', 'Responses will be saved to catalog/data.log', '6', '13', 'tep_cfg_select_option(array(\'On\', \'Off\'), ', now())");
	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 ('Capture Mode', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_CAPTURE', 'AUTH_CAPTURE', 'Credit Card processing method. Authorize Only or Authorize and Capture (Collect Funds)', '6', '0', 'tep_cfg_select_option(array(\'AUTH_CAPTURE\', \'AUTH_ONLY\'), ', now())");
	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 ('Customer Notifications', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_EMAIL_CUSTOMER', 'False', 'Should Authorize.Net e-mail a receipt to the customer?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
	}

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

function keys()
	{
	return array('MODULE_PAYMENT_AUTHORIZENET_CC_AIM_STATUS', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_LOGIN', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TXNKEY', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_SERVER', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_SORT_ORDER', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_ZONE', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_ORDER_STATUS', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TESTMODE', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_DEBUG', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_CAPTURE', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_EMAIL_CUSTOMER', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_EMAIL_OWNER', 'MODULE_PAYMENT_AUTHORIZENET_CC_AIM_EMAIL');
	}

function send_request_via_curl($posturl,$content)
	{
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $posturl);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_HEADER, 0);
	curl_setopt($ch, CURLOPT_POSTFIELDS, $content);
	curl_setopt($ch, CURLOPT_POST, 1);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
	curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
	curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
	$response = curl_exec($ch);
	curl_close($ch);
	return $response;
	}
}
?>

Share this post


Link to post
Share on other sites

Well, your file didn't work for me but it got me but it kinda got me on the right track and I have it working so I appreciate your help. See process_button below

FYI, you have an error around line 20, it should be

     if ((int)MODULE_PAYMENT_AUTHORIZENET_CC_AIM_ORDER_STATUS_ID > 0) {
       $this->order_status = MODULE_PAYMENT_AUTHORIZENET_CC_AIM_ORDER_STATUS_ID;
     }

 

Here is what needs to be in the stock authorizenet_cc_aim module

   function process_button() {
     // Hidden fields on the checkout confirmation page
     $process_button_string = tep_draw_hidden_field('cc_expires_month', $_POST['cc_expires_month']) .
                              tep_draw_hidden_field('cc_expires_year', $_POST['cc_expires_year'], -2) .
                              tep_draw_hidden_field('cc_number_nh-dns', $this->cc_number_nh-dns) .
                              tep_draw_hidden_field('cc_cvc_nh-dns', $_POST['cc_cvc_nh-dns']);


     return $process_button_string;
   }


I'm not really a dog.

Share this post


Link to post
Share on other sites

Getting this error message:

 

Cannot redeclare class ot_shipping in /home/content/e/x/t/extramusical/html/catalog/includes/modules/order_total/ot_shipping.php on line 13

 

Here's the code the last line is 13

 

$Id$

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2007 osCommerce

 

Released under the GNU General Public License

*/

 

class ot_shipping {

var $title, $output;

 

function ot_shipping() {

Share this post


Link to post
Share on other sites

Hi all!

Has anyone got this Contrib working on V2.3.1????

or is it only me who got problem?

 

Im having swedish language so you know if thats the problem or not.

 

The problem is that ajax is messed up and email warning and shipping even if i fill out everything etc etc..

 

Regards

Tony

Share this post


Link to post
Share on other sites

I've got it working fine. Pupstar, I believe, also has a working version, probably a little different than the contribution here.

 

@ www.crossroads-music.org - It's hard to say where the ot_shipping problem lies. The script is declaring the class shipping twice. The code in ot_shipping is what it should be. The problem is wherever else it is being declared, when it shouldn't be. It could be in the OPC contrib, or in any number of other contributions you might have installed, if any. It's one of those things that is easier to debug from within the particular script than guessing at it with no actual knowledge of what you have or don't have. A lot of debugging (at least the way I do it) comes from sitewide searches of particular codes or phrases, and tweaking them until it's pinned down. If the problem isn't replicated on this end, it's hard to find it or fix it. At what point are you getting the error? When OPC loads, during the checkout process itself? What shipping modules are you using, do you have coupons or discounts, etc... Does it happen all the time, or only when certain things happen? See what I mean? Too many factors to point in any direction unless it can be pinned down.

 

@ El_Haso : This isn't a problem that I have personally run into on any sites. I do know that the original contributions had a problem with getting a "password does not match" error when there was no password error. I don't know if this is what you're getting or not. It could also be that you replaced the js codes when you shouldn't have, or you're calling on the wrong code (1.4.2 instead of 1.4.3), or something along those lines. In template_top, make sure the js file "includes" match the actual file names that you have in your site. The difficulty with this contribution is that 2.3.1 comes with js scripts. The contribution also includes it. Some need to be added some need to be replaced, but only if working with stock osc, and the code in template top need to call the correct js scripts.

Share this post


Link to post
Share on other sites

Hi fulluvscents

 

I tried to install your two contrubutions on a clean version of 2.3.1.

First, I wrote over the files with the Credit Class & Gift Voucher (CCGV 6.0_1.zip) but it looked like the basket hanging if I entered a discount code.

 

I was hoping that by installing One Page Checkout (OPC for 2.3.1 (2) (1)) that the coupon bug would be fixed. But after having installed the OPC then I get a 500 error from the server. In IE it stops at /checkout_shipping.php and in Google Chrome it stops on /checkout.php

 

Do you have any idea where the error might be or the reason for a 500 error?

 

Thanks for your contributions :thumbsup::)

 

Torgrim

Norway

Share this post


Link to post
Share on other sites

Torgrim,

 

If you are runing on a server using Mod_suphp, and you should be, check your permissions for the files and folders you uploaded. Suphp will error 500 if permissions are too high, so php files must be 600 or lower and folders must be 755 or lower. Just a thought.

 

You can also try setting only one simple payment like COD and a simple shipping.


I'm not really a dog.

Share this post


Link to post
Share on other sites

I've been experimenting with the OPC and just discovered the latest June 14 (v.10.4) version, which saved me a lot of work trying to fix it. Thank you, everyone for the hard work.

 

The biggest complaint I have is that the layout still uses a ton of nested tables, so I'm wondering if anybody would be interested in a complete rewrite that did away with tables altogether, used the <label> tag and allowed the whole form to be styled with an outside CSS file?

 

Definitely, it would reduce the bloated file size...

Share this post


Link to post
Share on other sites

I'd love to get some help getting the v10.4 to work... In return, I'd like to work with people to improve it.

 

I'm on Mac OS 10.5+ FireFox

 

I replicated a client site ( http://pbroadwayinc.org/store ) on my own server at http://rasadesign.com/catalog_2_3_1 and I'm not sure what's wrong, but it's not working. From my memory of earlier versions, it's the it's the JavaScript/Ajax, but several attempts at re-uploading from scratch have proved fruitless.

 

I'll go over it again on my own, but if anyone has an inspired answer, that would be great.

 

From a working version, I'll be happy to rework the code, strip the table tags, add label tags, develop a cross-browser CSS demo file, change the formatting so that country defaults to the country of origin for the store and shows up under the state and zip.

Share this post


Link to post
Share on other sites

I'd love to get some help getting the v10.4 to work... In return, I'd like to work with people to improve it.

 

I'm on Mac OS 10.5+ FireFox

 

I replicated a client site ( http://pbroadwayinc.org/store ) on my own server at http://rasadesign.com/catalog_2_3_1 and I'm not sure what's wrong, but it's not working. From my memory of earlier versions, it's the it's the JavaScript/Ajax, but several attempts at re-uploading from scratch have proved fruitless.

 

I'll go over it again on my own, but if anyone has an inspired answer, that would be great.

 

From a working version, I'll be happy to rework the code, strip the table tags, add label tags, develop a cross-browser CSS demo file, change the formatting so that country defaults to the country of origin for the store and shows up under the state and zip.

 

At a quick glance it looks as though you have not installed it correctly as when going to the checkout it still takes me to the login page.

 

Mark

Share this post


Link to post
Share on other sites

×