Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Correct the text output to be nicer..


Nathali

Recommended Posts

Hi,

 

Could someone help please?

 

I would like please to correct my Error text output:

 

The syntex is:

 

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_NETPAY_TEXT_ERROR_MESSAGE . ' code='.$reply_code.' '.$reply_str), 'SSL', true, false));

 

This is the Output text that I get if the payment process did not succeed..

 

So I try to use "<br>" in the text message and it doesn't do a line break to the text output so I get a long text string which is not right.

 

What should I do please to force it to do a line break that my error message will look better?

 

Thanks a lot and great day !

 

Nathali

Best Regards,

Nathali

Link to comment
Share on other sites

Hi,

 

Could someone help please?

 

I would like please to correct my Error text output:

 

The syntex is:

 

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_NETPAY_TEXT_ERROR_MESSAGE . ' code='.$reply_code.' '.$reply_str), 'SSL', true, false));

 

This is the Output text that I get if the payment process did not succeed..

 

So I try to use "<br>" in the text message and it doesn't do a line break to the text output so I get a long text string which is not right.

 

What should I do please to force it to do a line break that my error message will look better?

 

Thanks a lot and great day !

 

Nathali

 

I will try to explain better. The message that I get is:

 

התשלום בכרטיס האשראי נכשל!!!כפי שבוודאי הבחנת, קרתה תקלה במהלך חיוב כרטיס האשראי שלך, אנא נסה שוב או השתמש בכרטיס אחר שברשותך. עימך הסליחה.

 

AND I would like to use a line break <br> And I can't do it !

 

If someone could help please?

 

Regards,

Nathali

Best Regards,

Nathali

Link to comment
Share on other sites

It looks like the error message is being sent as part of the url string. urlencode() is making the string safe so not allowing <br>. In short, you can't do it.

 

Thanks a lot Peter for reply!

 

Is there a way to pass it?

 

Thanks again Peter !

Best Regards,

Nathali

Link to comment
Share on other sites

Hi Nathali,

 

If that message is passed to the url, there's not a lot you can do to it. However, if you are seeing output to the page, then you can format that. If that is true, you are trying to add the line break in the wrong place.

Link to comment
Share on other sites

Hi Nathali,

 

If that message is passed to the url, there's not a lot you can do to it. However, if you are seeing output to the page, then you can format that. If that is true, you are trying to add the line break in the wrong place.

 

YES. I am seeing output to the page then how should I change it please??

Best Regards,

Nathali

Link to comment
Share on other sites

What you are seeing printed to the page isn't from the code you posted so probably not that constant.

 

Look in the includes/languages/modules/payment/netpay.php file (as a guess) and see if the message you are getting is there. If it is but isn't associated with the constant MODULE_PAYMENT_NETPAY_TEXT_ERROR_MESSAGE, add your line break there.

 

If it is associated with that constant or the message isn't there at all, look in the actual module file, includes/modules/payment/netpay.php and it may be be hard coded there. If it is, add your line break there.

Link to comment
Share on other sites

What you are seeing printed to the page isn't from the code you posted so probably not that constant.

 

Look in the includes/languages/modules/payment/netpay.php file (as a guess) and see if the message you are getting is there. If it is but isn't associated with the constant MODULE_PAYMENT_NETPAY_TEXT_ERROR_MESSAGE, add your line break there.

 

If it is associated with that constant or the message isn't there at all, look in the actual module file, includes/modules/payment/netpay.php and it may be be hard coded there. If it is, add your line break there.

 

Hi Peter !

 

Thanks for your reply !

 

I changed it as you said, and put it at the DEFINE command and it gave me the error message like that:

 

Credit Card transaction failed !!!<br>As you may notice, An error has occured while trying to process your Credit Card.<br> Please Try again or you can use another Credit Card.

 

Any advise please?

 

Thanks Nathali

Best Regards,

Nathali

Link to comment
Share on other sites

Sorry Nat but I am a bit lost.

 

This is how your original message looks to me:

 

nathali.png

 

Now, is it this that is printed to the page?

 

Credit Card transaction failed !!!<br>As you may notice, An error has occured while trying to process your Credit Card.<br> Please Try again or you can use another Credit Card.

 

Can you post the language file that this is defined in?

Link to comment
Share on other sites

Sorry Nat but I am a bit lost.

 

This is how your original message looks to me:

 

nathali.png

 

Now, is it this that is printed to the page?

 

 

 

Can you post the language file that this is defined in?

 

Hi Peter, thanks for your reply !

 

I will explain:

 

In netpay.php file that in folder /public_html/includes/modules/payment I have the below function

 

function before_process() {

 

global $HTTP_GET_VARS;

 

$reply_code = $HTTP_GET_VARS['Reply'];

 

$my_message = MODULE_PAYMENT_NETPAY_TRANSACTION_MESSAGE;

 

if ( $reply_code !== '000') {

$reply_str = MODULE_PAYMENT_NETPAY_TEXT_ERROR_MESSAGE;

 

$reply_str .= $my_message;

 

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . '

code='.$reply_code.' '.$reply_str), 'SSL', true, false);

 

}

}

 

And in folder /public_html/includes/languages/english/modules/payment I have netpay.php file

with the define commands below:

 

define('MODULE_PAYMENT_NETPAY_TEXT_ERROR_MESSAGE','Credit Card transaction failed !!!<br>');

 

define('MODULE_PAYMENT_NETPAY_TRANSACTION_MESSAGE','As you may notice, An error has occured while trying to process your Credit Card.<br> Please Try again or you can use another Credit Card. ');

 

Now when I have an error on the payment process I get this output message:

Credit Card transaction failed !!!<br>As you may notice, An error has occured while trying to process your Credit Card.<br> Please Try again or you can use another Credit Card.

 

The output ignore the <br> (line break)

 

This is my problem..!

 

Thanks Peter for helping me..

 

Best Regards,

Nathali

Best Regards,

Nathali

Link to comment
Share on other sites

Hi Nathali,

 

In your folder /public_html/includes/languages/english/modules/payment/netpay.php file

 

Try changing this:

define('MODULE_PAYMENT_NETPAY_TEXT_ERROR_MESSAGE','Credit Card transaction failed !!!<br>');

 

define('MODULE_PAYMENT_NETPAY_TRANSACTION_MESSAGE','As you may notice, An error has occured while trying to process your Credit Card.<br> Please Try again or you can use another Credit Card. ');

 

To This:

define('MODULE_PAYMENT_NETPAY_TEXT_ERROR_MESSAGE','Credit Card transaction failed !!!\n');

 

define('MODULE_PAYMENT_NETPAY_TRANSACTION_MESSAGE','As you may notice, An error has occured while trying to process your Credit Card.\n Please Try again or you can use another Credit Card.'); (remove the space after Card.)

 

Hopefully that will work for you! ;)

- :: Jim :: -

- My Toolbox ~ Adobe Web Bundle, XAMPP & WinMerge | Install ~ osC v2.3.3.4 -

Link to comment
Share on other sites

Hi Nathali,

 

In your folder /public_html/includes/languages/english/modules/payment/netpay.php file

 

Try changing this:

define('MODULE_PAYMENT_NETPAY_TEXT_ERROR_MESSAGE','Credit Card transaction failed !!!<br>');

 

define('MODULE_PAYMENT_NETPAY_TRANSACTION_MESSAGE','As you may notice, An error has occured while trying to process your Credit Card.<br> Please Try again or you can use another Credit Card. ');

 

To This:

define('MODULE_PAYMENT_NETPAY_TEXT_ERROR_MESSAGE','Credit Card transaction failed !!!\n');

 

define('MODULE_PAYMENT_NETPAY_TRANSACTION_MESSAGE','As you may notice, An error has occured while trying to process your Credit Card.\n Please Try again or you can use another Credit Card.'); (remove the space after Card.)

 

Hopefully that will work for you! ;)

 

Hi JIM !

 

Thanks for your reply !

 

I tried the code and now it gives me this output:

 

code= Credit Card transaction failed !!!\\nAs you may notice, An error has occured while trying to process your Credit Card.\\n Please Try again or you can use another Credit Card.

 

Any advise please ??

 

Thanks again for your kind help ;-)

 

Nathali

Best Regards,

Nathali

Link to comment
Share on other sites

\n will add a new line to the HTML output, not the output to the browser. I'm not sure why we can't get a line break using <br>, maybe we can use nl2br() somewhere. I did notice that the returning string hasn't been through stripslashes(), not that that is the problem but something to look at.

When I get a spare hour, I'll have a closer look at the contribution and checkout_payment.php. See if I can find a solution. Unless someone else comes up with something first.

Link to comment
Share on other sites

\n will add a new line to the HTML output, not the output to the browser. I'm not sure why we can't get a line break using <br>, maybe we can use nl2br() somewhere. I did notice that the returning string hasn't been through stripslashes(), not that that is the problem but something to look at.

When I get a spare hour, I'll have a closer look at the contribution and checkout_payment.php. See if I can find a solution. Unless someone else comes up with something first.

 

Thank you very much Peter for your kind reply !!!

 

Best regards & great day,

 

Nathali

Best Regards,

Nathali

Link to comment
Share on other sites

Hi Nathali,

 

Well, there's no mystery to why the line breaks aren't doing anything, yet it isn't something I noticed before. The message is passed through htmlspecialchars() which converts special characters to HTML entities. So the characters < and > are translated as '<' and '>' What I don't know is why it is necessary here.

 

Look in checkout_payment.php and you will see this line of code:

 

<td class="main" width="100%" valign="top"><?php echo tep_output_string_protected($error['error']); ?></td>

 

If you remove the function tep_output_string_protected() it will output a line break <br> as you require:

 

<td class="main" width="100%" valign="top"><?php echo $error['error']; ?></td>

 

As I said, I'm not sure why the message needs htmlspecialchars(), being as it is only echoed to the page but there must be a reason. If someone more knowledgeable than me is reading this, please chip in with some wisdom.

Link to comment
Share on other sites

Hi Nathali,

 

Well, there's no mystery to why the line breaks aren't doing anything, yet it isn't something I noticed before. The message is passed through htmlspecialchars() which converts special characters to HTML entities. So the characters < and > are translated as '<' and '>' What I don't know is why it is necessary here.

 

Look in checkout_payment.php and you will see this line of code:

 

<td class="main" width="100%" valign="top"><?php echo tep_output_string_protected($error['error']); ?></td>

 

If you remove the function tep_output_string_protected() it will output a line break <br> as you require:

 

<td class="main" width="100%" valign="top"><?php echo $error['error']; ?></td>

 

As I said, I'm not sure why the message needs htmlspecialchars(), being as it is only echoed to the page but there must be a reason. If someone more knowledgeable than me is reading this, please chip in with some wisdom.

 

Hi Peter !!

 

Thank you very much for your help !! you are very kind !!

 

As you said:

"As I said, I'm not sure why the message needs htmlspecialchars(), being as it is only echoed to the page but there must be a reason. If someone more knowledgeable than me is reading this, please chip in with some wisdom."

 

You are absolutely right! , there should be a reason, so I don't know if it will be good that I change the code right away...

I hope that someone will help us to illuminate this "mystery" :-)

 

I really appreciate your kind help Peter !

 

Wish you all the best dear..

 

Regards,

Nathali

Best Regards,

Nathali

Link to comment
Share on other sites

No worries Nat, happy to help.

 

I can't see any reason why that output needs protecting but you need to make your own decisions. Me personally, I will remove the function from where I don't think it is necessary.

 

All the best!

Link to comment
Share on other sites

No worries Nat, happy to help.

 

I can't see any reason why that output needs protecting but you need to make your own decisions. Me personally, I will remove the function from where I don't think it is necessary.

 

All the best!

 

Thanks Peter for the advise!

 

See you,

Nathali ;-)

Best Regards,

Nathali

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...