Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

checkout_process.php and HTML addition


carlost

Recommended Posts

Hello!

 

Anyone have a clue as to how I can add a small amount of HTML to the checkout_process.php file.

 

I am using ECHO payment processing, and when a credit card payment is not accepted, for whatever reason, the "Transaction Denied" statement is posted through the checkout_process.php file.

 

What happens is the customer is shown the "Transaction Denied" text, and nothing else - leaving them stranded on the page.

 

I simply want to put a table with my logo, and a link back to the checkout_payment.php page - so that the customer can reenter payment info.

 

When I add the HTML, I end up with what I want appearance wise, BUT, with the following warning:

 

"Cannot modify header information - headers already sent by (output started at /home/xxxxx/public_html/checkout_process.php:182) in /home/ xxxxx /public_html/includes/functions/general.php on line 29"

 

This happens when testing using the OSC cc.php payment. When using the ECHO payment module - it will not go through at all, only giving me a ERROR response from ECHO.

 

Any thoughts, input would be much appreciated.

 

Thanks in advance.

 

Carlos Thomas

Link to comment
Share on other sites

There's not an easy answer to this one. As the code is designed, you can't have anything that creates output in checkout_process.php. Any text or HTML will cause an error in the redirect. What you should do is capture the error code that your processor is returning and redirect to an error page. The error page would then have an explanation of the problem and a link back to checkout_payment.php.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Thanks for the response Jim!

 

I haven't a clue as to how I might go about doing as you suggest. If you have any more time, and are so inclined, I would appreciate some details.

 

Regards,

 

Carlos

Link to comment
Share on other sites

I'm sorry that I can't give you more information. I'm not familiar with the ECHO module. Perhaps somebody who is more familiar with this module can help you fix it.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

What happens is the customer is shown the "Transaction Denied"  text, and nothing else - leaving them stranded on the page.

 

 

There is a way to get around this. I will try to get the code together and post it here tomorrow. I was dealing with the same thing so I modified the code to redirect back to the payment page and display an error just as if the user had entered an invalid card number or forgot to add cvv code.

Link to comment
Share on other sites

!!!MAKE BACKUPS OF YOUR FILES *BEFORE* YOU MAKE ANY CHANGES!!!

 

 

EDIT: includes/echo_class.php and add the following

 

ADD AFTER:

var $merchant_name;

var $version;

 

                var $DeclineMesssages;


               function EchoPHP() {
                    $this->LoadDeclineMessages();
               }

 

 

ADD AFTER:

 

function get_decline_code() {

return $this->GetEchoProp($this->echotype3, "decline_code");

}

 

                function get_decline_message() {
                       $code = str_replace('00','',$this->decline_code);
                       return $this->DeclineMessages[$code];
               }

 

 

ADD BEFORE:

 

} // end of class

?>

 

 

               function LoadDeclineMessages() {

                      $this->DeclineMessages = array(
'01' => 'The merchant must call the issuer before the transaction can be approved.',
'02' => 'The merchant must call the issuer before the transaction can be approved.',
'03' => 'The merchant ID is not valid.',
'04' => 'The card is listed on the Warning Bulletin.  Merchant may receive reward money by capturing the card.',
'05' => 'The transaction was declined without explanation by the card issuer. ',
'06' => 'The card issuer returned an error without further explanation.',
'07' => 'The card is listed on the Warning Bulletin.  Merchant may receive reward money by capturing the card.',
'08' => 'Honor with identification.',
'09' => 'Request in progress.',
'10' => 'Approved for partial amount.',
'11' => 'Approved, VIP program. ',
'12' => 'The requested transaction is not supported or is not valid for the card number presented.',
'13' => 'The amount exceeds the limits established by the issuer for this type of transaction.',
'14' => 'The issuer indicates that this card is not valid.',
'15' => 'The card issuer number is not valid.',
'16' => 'Approved, update track 3.',
'17' => 'Customer cancellation.',
'18' => 'Customer dispute.',
'19' => 'Customer should resubmit transaction.',
'20' => 'Invalid response.',
'21' => 'No action taken. The issuer declined with no other explanation.',
'22' => 'Suspected malfunction.',
'23' => 'Unacceptable transaction fee.',
'24' => 'File update not supported.',
'25' => 'Unable to locate record.',
'26' => 'Duplicate record.',
'27' => 'File update edit error.',
'28' => 'File update file locked.',
'29' => 'Not Used',
'30' => 'The host reported that the transaction was not formatted properly.',
'31' => 'Bank not supported by switch.',
'32' => 'Completed partially.',
'33' => 'The card is expired.  Merchant may receive reward money by capturing the card.',
'34' => 'The card issuer suspects fraud.  Merchant may receive reward money by capturing the card.',
'35' => 'Contact card issuer.  Merchant may receive reward money by capturing the card.',
'36' => 'The card is restricted by the issuer.  Merchant may receive reward money by capturing the card.',
'37' => 'Contact ECHO security.  Merchant may receive reward money by capturing the card.',
'38' => 'PIN attempts exceed issuer limits.  Merchant may receive reward money by capturing the card.',
'39' => 'No credit account.',
'40' => 'Requested function not supported.',
'41' => 'The card has been reported lost.',
'42' => 'No universal account.',
'43' => 'The card has been reported stolen.',
'44' => 'No investment account.',
'45' => 'Not Used',
'46' => 'Not Used',
'47' => 'Not Used',
'48' => 'Not Used',
'49' => 'Not Used',
'50' => 'Not Used',
'51' => 'The credit limit for this account has been exceeded.',
'52' => 'Not Used',
'53' => 'Not Used',
'54' => 'The card is expired.',
'55' => 'The cardholder PIN is incorrect.',
'56' => 'No card record.',
'57' => 'The card is not allowed the type of transaction requested.',
'58' => 'The Merchant is not allowed this type of transaction.',
'59' => 'Suspected fraud.',
'60' => 'Contact ECHO.',
'61' => 'The amount exceeds the allowed daily maximum.',
'62' => 'The card has been restricted.',
'63' => 'The card has been restricted.',
'64' => 'Original amount incorrect.',
'65' => 'The allowable number of daily transactions has been exceeded.',
'66' => 'Call acquirer security, call ECHO.',
'67' => 'Not Used',
'68' => 'Response received too late.',
'69' => 'Not Used',
'70' => 'Not Used',
'71' => 'Not Used',
'72' => 'Not Used',
'73' => 'Not Used',
'74' => 'Not Used',
'75' => 'The allowed number of PIN retries has been exceeded.',
'76' => 'The debit account does not exist.',
'77' => 'The credit account does not exist.',
'78' => 'The associated card number account is invalid or does not exist.',
'79' => 'Already reversed.',
'80' => 'Not Used',
'81' => 'Not Used',
'82' => 'Not Used',
'83' => 'Not Used',
'84' => 'The authorization life cycle is invalid.',
'85' => 'Not Used',
'86' => 'Cannot verify PIN.',
'87' => 'Network Unavailable.',
'88' => 'Not Used',
'89' => 'Ineligible to receive financial position information.',
'90' => 'Cut-off in progress.',
'91' => 'The bank is not available to authorize this transaction.',
'92' => 'The transaction cannot be routed to the authorizing agency. ',
'93' => 'Violation of law.',
'94' => 'Duplicate transaction.',
'95' => 'Reconcile error.',
'96' => 'A system error has occurred.',
'97' => 'Not Used',
'98' => 'Exceeds cash limit.');


              }

 

 

EDIT: includes/modules/payment/echo_cc.php and add the following

 

 

REPLACE:

 

 

if ($ECHO_ERROR) {

print(MODULE_PAYMENT_ECHO_CC_ERROR);

echo $echoPHP->get_echotype2();

die("");

}

 

WITH:

        if ($ECHO_ERROR) {

         $error = MODULE_PAYMENT_ECHO_CC_ERROR.$echoPHP->get_decline_message();
         $payment_error_return = 'payment_error=' . $this->code . '&error=' . $error . '&cc_owner=' . urlencode($_POST['cc_owner']) . '&cc_expires_month=' . $_POST['cc_expires_month'] . '&cc_expires_year=' . $_POST['cc_expires_year'];

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

 

 

EDIT: includes/functions/general.php

 

 

REPLACE:

 

function tep_output_string_protected($string) {

return tep_output_string($string, false, true);

}

 

 

WITH:

  function tep_output_string_protected($string) {
   return tep_output_string($string, false, true,false);
 }

 

 

 

 

ADD AFTER:

 

function tep_output_string_protected($string) {

return tep_output_string($string, false, true, false);

}

 

 

  function tep_output_string_protected2($string) {
   return tep_output_string($string, false, true, true);
 }

 

 

REPLACE: (entire function. Dont have original code)

 

function tep_output_string($string, $translate = false, $protected = false, $allowbrp = false) { .....

 

...

...

 

 

}

 

 

 

WITH:

  function tep_output_string($string, $translate = false, $protected = false, $allowbrp = false) {
   if ($protected == true) {
     $ret = htmlspecialchars($string);

       if ($allowbrp == true) {
          $ret = str_replace('<br>','<br>',$ret);
          $ret = str_replace('<p>','<br>',$ret);
       }

       return $ret;
   } else {
     if ($translate == false) {
       return tep_parse_input_field_data($string, array('"' => '"'));
     } else {
       return tep_parse_input_field_data($string, $translate);
     }
   }
 }

 

 

 

 

EDIT: checkout_payment.php

 

REPLACE: around 187 dont have original code.

 

from < tr > to < /tr >

 

 

 

WITH

      <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBoxNotice">
         <tr class="infoBoxNoticeContents">
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td class="mainError" width="100%" valign="top"><?php echo tep_output_string_protected2($error['error']); ?></td>
               <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>

 

 

 

EDIT: stylesheet.css

 

ADD:

 

TD.mainError, P.mainError {
 font-family: Verdana, Arial, sans-serif;
 color: #CC0000;
 font-weight: bold;
 font-size: 11px;
 line-height: 1.5;
}

Link to comment
Share on other sites

Hey Chris!

 

Thanks much for your time, your response.

 

I have implemented the changes - only to discover that ECHO cancelled my test account, apparently because I was using invalid credit card numbers to test.

 

I should get re-activated soon. And I?ll post my success. I can tell already that it's likely working as the response I am getting presently "Verification of your account FAILED. Please go back and reenter your credit card information." is now coming to the payment page (checkout_payment.php).

 

I am testing on a test website as my live site has been up and working for a while now.

 

Meanwhile there are a few other things I am wondering about concerning ECHO. I am assuming that you use them too.

 

Have you been incurring additional surcharges for commercial MC & Visa charges?

 

Do you know about the reduction when a "PO#" and "Sales Tax" field are used?

 

Appreciate any more input from your experience with them.

 

Thanks again.

 

Carlos

Link to comment
Share on other sites

Carlos,

 

I'm glad to hear that you got this working. I was pretty proud of myself when I finally got all of that to work. So its nice to hear that someone else will benefit from my work. Maybe I'll put it together as an enhancement package for others.

 

I've only been using ECHO for a short time and have processed about 5 orders. So I'm pretty new with the whole thing myself.

Link to comment
Share on other sites

  • 1 year later...

Chris,

 

I am have trouble with the ECHO module. Everytime I run an order the cart redirects to the login page. The contents remain in the cart and according to ECHO no transaction went through. Any ideas on this.

 

Is there a server setting I may be missing?

 

Thank you for your time.

 

---Coffee Celler

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...