[Skip to main content](#vessel-content)

#   Too many &lt;br/&gt; in address textarea

##

- **[lousyfool](/forum/user/28604-lousyfool "View lousyfool's Profile")**
- [![lousyfool's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar28604.jpg)](/forum/user/28604-lousyfool "View lousyfool's Profile") Topic Author
- [ Offline](/forum/user/28604-lousyfool)

Less More

- Posts: 2143
- Thank you received: 746
-
- [](http://www.inphase.one)
-

11 years 2 months ago [\#214134](#214134) by [lousyfool](/forum/user/28604-lousyfool "View lousyfool's Profile")  *[Too many &lt;br/&gt; in address textarea](/forum/33-customers/879270-too-many-br-in-address-textarea#214134 "-- url of the page with the problem -- : local -- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.4.4 -- PHP version -- : 5.5.3  Hi,  I need to use text area fields in addresses. If I do, the HTML output has double  in between the lines of textarea content, like e.g.  I looked into classes/address.php, and now I know where the usual  is coming from, but I'm not clever enough to get rid of the second one in between textarea content lines...  Can you help, please? If it's from &quot;outside HikaShop&quot;, perhaps it makes sense to amend the HikaShop code, so the regular  separating fields doesn't get applied to textarea content?  Thanks!")* was created by *[lousyfool](/forum/user/28604-lousyfool "View lousyfool's Profile")*

-- url of the page with the problem -- : local
-- HikaShop version -- : 2.5.0
-- Joomla version -- : 3.4.4
-- PHP version -- : 5.5.3

Hi,

I need to use text area fields in addresses. If I do, the HTML output has double &lt;br/&gt; in between the lines of textarea content, like e.g. Code:

Regular Text Field &lt;br/&gt; Textarea Line 1 &lt;br/&gt; &lt;br/&gt; Textarea Line 2 &lt;br/&gt; &lt;br/&gt; Textarea Line 3 &lt;br/&gt; Regular Text Field

I looked into classes/address.php, and now I know where the usual &lt;br/&gt; is coming from, but I'm not clever enough to get rid of the second one in between textarea content lines...

Can you help, please?
If it's from "outside HikaShop", perhaps it makes sense to amend the HikaShop code, so the regular &lt;br/&gt; separating fields doesn't get applied to textarea content?

Thanks!

---

Need help with customisations of layouts, style or other site development? [ PM me!](/component/uddeim/?task=new)
(Don't forget to turn on [ "E-mail notification of new messages"](/component/uddeim/?task=settings))

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMzLWN1c3RvbWVycy84NzkyNzAtdG9vLW1hbnktYnItaW4tYWRkcmVzcy10ZXh0YXJlYT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86586
- Thank you received: 14325
-
-

11 years 2 months ago [\#214135](#214135) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Too many &lt;br/&gt; in address textarea](/forum/33-customers/879270-too-many-br-in-address-textarea#214135 "-- url of the page with the problem -- : local -- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.4.4 -- PHP version -- : 5.5.3  Hi,  I need to use text area fields in addresses. If I do, the HTML output has double  in between the lines of textarea content, like e.g.  I looked into classes/address.php, and now I know where the usual  is coming from, but I'm not clever enough to get rid of the second one in between textarea content lines...  Can you help, please? If it's from &quot;outside HikaShop&quot;, perhaps it makes sense to amend the HikaShop code, so the regular  separating fields doesn't get applied to textarea content?  Thanks!")*

Hi,

Try to change the line: Code:

$html = str_replace("\n\n","\n",trim(str_replace("\r\n","\n", trim(preg_replace('#{(?:(?!}).)*}#i','',$html))),"\n"));

to:
Code:

$html = str_replace("\n\n","\n",str_replace("\n\n","\n",trim(str_replace("\r\n","\n", trim(preg_replace('#{(?:(?!}).)*}#i','',$html))),"\n")));

in the file administrator/components/com_hikashop/classes/address.php

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMzLWN1c3RvbWVycy84NzkyNzAtdG9vLW1hbnktYnItaW4tYWRkcmVzcy10ZXh0YXJlYT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[lousyfool](/forum/user/28604-lousyfool "View lousyfool's Profile")**
- [![lousyfool's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar28604.jpg)](/forum/user/28604-lousyfool "View lousyfool's Profile") Topic Author
- [ Offline](/forum/user/28604-lousyfool)

Less More

- Posts: 2143
- Thank you received: 746
-
- [](http://www.inphase.one)
-

11 years 2 months ago [\#214188](#214188) by [lousyfool](/forum/user/28604-lousyfool "View lousyfool's Profile")  Replied by *[lousyfool](/forum/user/28604-lousyfool "View lousyfool's Profile")* on topic *[Too many &lt;br/&gt; in address textarea](/forum/33-customers/879270-too-many-br-in-address-textarea#214188 "-- url of the page with the problem -- : local -- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.4.4 -- PHP version -- : 5.5.3  Hi,  I need to use text area fields in addresses. If I do, the HTML output has double  in between the lines of textarea content, like e.g.  I looked into classes/address.php, and now I know where the usual  is coming from, but I'm not clever enough to get rid of the second one in between textarea content lines...  Can you help, please? If it's from &quot;outside HikaShop&quot;, perhaps it makes sense to amend the HikaShop code, so the regular  separating fields doesn't get applied to textarea content?  Thanks!")*

Thanks Nicolas,

But unfortunately it doesn't change anything... ![:(](/media/kunena/emoticons/22.png ":(")

Other ideas very welcome!

---

Need help with customisations of layouts, style or other site development? [ PM me!](/component/uddeim/?task=new)
(Don't forget to turn on [ "E-mail notification of new messages"](/component/uddeim/?task=settings))

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMzLWN1c3RvbWVycy84NzkyNzAtdG9vLW1hbnktYnItaW4tYWRkcmVzcy10ZXh0YXJlYT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86586
- Thank you received: 14325
-
-

11 years 2 months ago [\#214235](#214235) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Too many &lt;br/&gt; in address textarea](/forum/33-customers/879270-too-many-br-in-address-textarea#214235 "-- url of the page with the problem -- : local -- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.4.4 -- PHP version -- : 5.5.3  Hi,  I need to use text area fields in addresses. If I do, the HTML output has double  in between the lines of textarea content, like e.g.  I looked into classes/address.php, and now I know where the usual  is coming from, but I'm not clever enough to get rid of the second one in between textarea content lines...  Can you help, please? If it's from &quot;outside HikaShop&quot;, perhaps it makes sense to amend the HikaShop code, so the regular  separating fields doesn't get applied to textarea content?  Thanks!")*

Then, a few lines below, change the line:
return $html;
to:
return str_replace('&lt;br/&gt;&lt;br/&gt;','&lt;br/&gt;',$html);

The following user(s) said Thank You: [lousyfool](/forum/user/28604-lousyfool "View lousyfool's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMzLWN1c3RvbWVycy84NzkyNzAtdG9vLW1hbnktYnItaW4tYWRkcmVzcy10ZXh0YXJlYT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[lousyfool](/forum/user/28604-lousyfool "View lousyfool's Profile")**
- [![lousyfool's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar28604.jpg)](/forum/user/28604-lousyfool "View lousyfool's Profile") Topic Author
- [ Offline](/forum/user/28604-lousyfool)

Less More

- Posts: 2143
- Thank you received: 746
-
- [](http://www.inphase.one)
-

11 years 2 months ago [\#214281](#214281) by [lousyfool](/forum/user/28604-lousyfool "View lousyfool's Profile")  Replied by *[lousyfool](/forum/user/28604-lousyfool "View lousyfool's Profile")* on topic *[Too many &lt;br/&gt; in address textarea](/forum/33-customers/879270-too-many-br-in-address-textarea#214281 "-- url of the page with the problem -- : local -- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.4.4 -- PHP version -- : 5.5.3  Hi,  I need to use text area fields in addresses. If I do, the HTML output has double  in between the lines of textarea content, like e.g.  I looked into classes/address.php, and now I know where the usual  is coming from, but I'm not clever enough to get rid of the second one in between textarea content lines...  Can you help, please? If it's from &quot;outside HikaShop&quot;, perhaps it makes sense to amend the HikaShop code, so the regular  separating fields doesn't get applied to textarea content?  Thanks!")*

Almost, Nicolas, almost...

But damn close, indeed. While your line wouldn't work as is, I first tried around a bit because generally all sorts of replacement would work, of course, just '&lt;br/&gt;&lt;br/&gt;' wouldn't do anything at all, no matter what.

Finally, nl2br came first to mind, then onto my (googled) screen. Some more trial and error, and here is the only combo of line breaks that works (note the extra space): Code:

return str_replace('&lt;br /&gt;&lt;br/&gt;','&lt;br/&gt;',$html);

Oh well, what a space more or less can do. Also note, I have no proof that it's due to nl2br, I'm just saying that after [ looking this up](http://php.net/manual/en/function.nl2br.php) a lightbulb went on in my head and I started playing with spaces... and there it was. After juggling it for a good hour, here's one more snippet I won't forget so soon, lol!

Thanks for your patience and for getting me not only "on the way" but all the way with only a single space left to the finish line, hehe! ![:cheer:](/media/kunena/emoticons/2.png ":cheer:")

---

Need help with customisations of layouts, style or other site development? [ PM me!](/component/uddeim/?task=new)
(Don't forget to turn on [ "E-mail notification of new messages"](/component/uddeim/?task=settings))

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMzLWN1c3RvbWVycy84NzkyNzAtdG9vLW1hbnktYnItaW4tYWRkcmVzcy10ZXh0YXJlYT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.068 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
