support

Convert CRLF in description to <br>

Started by raj@ad4u.co.uk, May 01, 2018, 04:57:46 PM

Previous topic - Next topic

raj@ad4u.co.uk

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

Basara

Hello.
When you run export what CSV delimiter you use? And what is nightmare ?

Forum Rules Code of conduct
AbanteCart.com 2010 -