Please help us to make AbanteCart Ideal Open Source Ecommerce Solution for everyone.

Support AbanteCart eCommerce

Author Topic: Convert CRLF in description to <br>  (Read 615 times)

Offline raj@ad4u.co.uk

  • Newbie
  • *
  • Posts: 20
  • Karma: +5/-0
    • View Profile
Convert CRLF in description to <br>
« on: May 01, 2018, 04:57:46 PM »
Items manually added where the user types a CRLF in the description can turn the export products file into a nightmare for importing in other software, like a php script to create a google merchant feed.

$products = file_get_contents('C:\$_LaptopSpareParts_Shop\products.txt');
$n=preg_match_all('/(\"[^\"]+?\")/',$products,$match);  //this searches for all "..crlf..."
$k=20;

foreach($match[1] as $m){
    if(strpos($m,"\r\n"))   
        $products = str_replace($m,str_replace("\r\n","<br>",$m),$products);
}


Hope this helps.


Raj

Offline Basara

  • Administrator
  • Hero Member
  • *****
  • Posts: 3728
  • Karma: +184/-0
    • View Profile
Re: Convert CRLF in description to <br>
« Reply #1 on: May 02, 2018, 01:56:54 AM »
Hello.
When you run export what CSV delimiter you use? And what is nightmare ?
“Chuck Norris is so amazing.”
― Mother Teresa