Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

<br> tags show up in text


themutantchair

Recommended Posts

I have a problem that happens on only one page.

 

If a customer enters an improper creditcard number, they receive the corresponding default error message. But, for some reason, the HTML is not correctly parsed, and it shows up on the page as following:

 

The first four digits of the number entered are: 6011<br>If that number is correct, we do not accept that type of credit card.<br>If it is wrong, please try again.

 

 

Any clue why this happens?

 

Thanks!

Link to comment
Share on other sites

Find the file that contains the actual text of that error message and examine it closely. You appear to be missing a delimiter, probably a quote mark => " <= or => ' <= in the PHP code, I can't remember which, or maybe the absence of an opening or closing PHP trigger => <?php <= or => ?> <= causing the HTML code to appear as text.

 

Charles

We stand in ignorance only for questions not asked. Plug up the leaks in your knowledge base and open up a flood of understanding.
Link to comment
Share on other sites

<br> (visible)  problem

in the file look for the following:

<br>

and change it with notepad or a better texteditor to:

<br>

 

The advice may look odd but try it anyway, it will work.

"If you're working on something new, then you are necessarily an amateur."

Link to comment
Share on other sites

is the warning or error showing up "in" the osCommerce page or is it a grey pop-up "ontop" of the osCommerce page?

 

Anyway try: checkout_payment.php or cc.php

 

Other method, try to find in wshich file the evil

<br>

is situated, by means of a suitable searchtool.

Suitable and free is *Agent Ransack* from <http://www.agentransack.com/>

Easy to handle, very good in finding offending words sentences etc which you like to change.

 

Open a good editor at the same time and drag the offending file from the left Ransack-window to the editor and you're off.

 

Beware: before changing something always back-up that file.

"If you're working on something new, then you are necessarily an amateur."

Link to comment
Share on other sites

It's a pink box in the oscommerce page.

 

I can't find <br> in any of the files; I opened all of them in editpad and did a search on all of them.

 

cc.php is the file that uses the credit card error message. It does some crazy functions on these; is this screwing everything up?

 

Here's what I see as the relavant code:

 

      $error = '';
     switch ($result) {
       case -1:
         $error = sprintf(TEXT_CCVAL_ERROR_UNKNOWN_CARD, substr($cc_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;

 

    function get_error() {
     global $HTTP_GET_VARS;

     $error = array('title' => MODULE_PAYMENT_CC_TEXT_ERROR,
                    'error' => stripslashes(urldecode($HTTP_GET_VARS['error'])));
                    'error' => urldecode($HTTP_GET_VARS['error']));

     return $error;
   }

Link to comment
Share on other sites

sorry, that second piece of code is actually as follows:

    function get_error() {
     global $HTTP_GET_VARS;

     $error = array('title' => MODULE_PAYMENT_CC_TEXT_ERROR,
                    'error' => stripslashes(urldecode($HTTP_GET_VARS['error'])));


     return $error;
   }

Link to comment
Share on other sites

Sorry Andy, can't help you, practically run out of my options :-(

 

The offending line as you said already is:

define('TEXT_CCVAL_ERROR_UNKNOWN_CARD', 'The first four digits of the number entered are: %s<br>If that number is correct, we do not accept that type of credit card.<br>If it is wrong, please try again.');

 

The <br> in there are causing a line break and do show up onscreen which should not be the case.

 

However if the line shows like this;

define('TEXT_CCVAL_ERROR_UNKNOWN_CARD', 'The first four digits of the number entered are: %s <br>If that number is correct, we do not accept that type of credit card. <br>If it is wrong, please try again.');

it's obvious and normal that the <br>'s are showing.

 

Reason + explanation: if you consult a HTML manual or the W3C.ORG specs, it is neccessary to show and let the readers see the <br>-tag, but if you try to do that using <br> that will cause a new line so you must first convert the left and right pointed bracket into < and >, otherwise readers wil not see the tag in question.

Look at the source of any manual where you see the <br> tag and than look in the source: you will see there always: <br>

 

Only last resort, maybe you have a back-up of the files in question?

 

Maybe using the file and folder comparison tool CSDIFF from <http://www.componentsoftware.com/Products/> will help you to establish the reason of the errors.

 

Or in case you installed a contribution which f....d-up english.php you could re-install english.php or remove the contri and see if the error is removed.

 

hth

"If you're working on something new, then you are necessarily an amateur."

Link to comment
Share on other sites

Searching w. Agent RanSack on *ERROR_UNKNOWN_CARD* I found some other files that maybe guilty:

authorizenet.php

ipayment.php

pm2checkout.php

psigate.php

 

maybe replacing these with the originals will help?

"If you're working on something new, then you are necessarily an amateur."

Link to comment
Share on other sites

Ideas always come 1-after-the-other:

What happens when you invoke expressly an error like in these sentences in english.php?

 

define('TEXT_CCVAL_ERROR_INVALID_DATE', 'The expiry date entered for the credit card is invalid.<br>Please check the date and try again.');

define('TEXT_CCVAL_ERROR_INVALID_NUMBER', 'The credit card number entered is invalid.<br>Please check the number and try again.');

 

Does <br> also show-up there?

 

BTW I'm using/comparing the error in version 2.2 ms2, is yours the same or an older/newer version?

"If you're working on something new, then you are necessarily an amateur."

Link to comment
Share on other sites

I've done it several times; when I invoke the error, that exact text appears. The <br>s and everything; that's the problem; they're not parsing.

 

I have 2.2 ms2 as well.

 

I'm only using the credit card module, I don't use the other modules like authorizenet, ipayment, etc.

Link to comment
Share on other sites

You might try posting that specific line copied and pasted directly from your english.php file here and see if anyone can see a problem with it.

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Link to comment
Share on other sites

There's really nothing special about it; it's the default:

 

define('TEXT_CCVAL_ERROR_INVALID_DATE', 'The expiry date entered for the credit card is invalid.<br>Please check the date and try again.');
define('TEXT_CCVAL_ERROR_INVALID_NUMBER', 'The credit card number entered is invalid.<br>Please check the number and try again.');
define('TEXT_CCVAL_ERROR_UNKNOWN_CARD', 'The first four digits of the number entered are: %s<br>If that number is correct, we do not accept that type of credit card.<br>If it is wrong, please try again.');

Link to comment
Share on other sites

OK, I'm using a v2.2 CVS snapshot from Feb 2003 - so that would be ms1. The OSC version number simply states that is that particular combo of files. The version number that really counts in comparing the stock code is the version number in the ID line at the top of each file. My ID line in the cc payment module, cc.php, reads

 

$Id: cc.php,v 1.53 2003/02/04 09:55:01 project3000 Exp $

 

and it works correctly when the errors are invoked - that is, the <b>'s are parsed correctly.

 

I have checked all the code you've posted against my code in cc.php v1.53 and it all matches exactly. This leads me to believe that, in fact, it may be a missing delimiter - or maybe an extra delimiter opening a literal text line, either somewhere in cc.php or one of the other .php files farther up the pecking order in this function which is causing the <br>'s to not be parsed. This might possibly due to an editing oversite in the developement of your OSC release? What you're describing sounds too much like a missing/extra delimiter problem in HTML. The two most treacherous typos are the " ' " and looking for an extra or missing space such as might be found in " => " vs. " = > "

 

I hope that helps, Charles

We stand in ignorance only for questions not asked. Plug up the leaks in your knowledge base and open up a flood of understanding.
Link to comment
Share on other sites

There is code in the error message handling that makes HTML display as text. You can either remove this code, or change the error text so that it does not have HTML. Sorry, I forget where the error handling code is, so I can't point out the line. If you search through the bug reports, you might find a solution, as this has been reported there.

 

Hth,

Matt

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...