Jump to content
Latest News: (loading..)
cDGo IT Consultancy

Add line breaks to comments during checkout

Recommended Posts

Hi,

I'm trying to add some text to the comments during checkout.
The only issue which occurs is that line breaks do not work.
\n or <br> are plain visible, while the "shift enter" linebreaks from the textarea input just work as expected.
It sounds really easy to do, but I'm overseeing it, any help is appreciated.


Building great webshops for customers with opensource backoffice application for a robotic accounting solution including POS
Migrating osC 2.x webshops to 2.3.4.x
osCommerce dedicated hosting/colocation + turnkey solutions + building addons per request

Share this post


Link to post
Share on other sites

Try nl2br

 


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest current code (community-supported responsive 2.3.4.1BS Edge) here

 

Share this post


Link to post
Share on other sites

Hi Burt,

Tried that before, but didn't work, but maybe doing it on the wrong place or wrong way.

On checkout_shipping.php page I manually enter:
Line 1
Line 2
Line 3

In checkout_shipping.php:
    $comments = '';
    if (tep_not_null($_POST['comments'])) {
      $comments .= tep_db_prepare_input($_POST['comments']);
    }

After that I'm trying to do something like:
$comments .= '\n\r' . $key . ': ' . $value;

On the checkout_payment.php page the comments look like:
Line 1
Line 2
Line 3\n\rkey: value


Building great webshops for customers with opensource backoffice application for a robotic accounting solution including POS
Migrating osC 2.x webshops to 2.3.4.x
osCommerce dedicated hosting/colocation + turnkey solutions + building addons per request

Share this post


Link to post
Share on other sites

$comments .= $key . ': ' . $value . PHP_EOL;


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest current code (community-supported responsive 2.3.4.1BS Edge) here

 

Share this post


Link to post
Share on other sites

You solved it like a boss!


Building great webshops for customers with opensource backoffice application for a robotic accounting solution including POS
Migrating osC 2.x webshops to 2.3.4.x
osCommerce dedicated hosting/colocation + turnkey solutions + building addons per request

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×