Jump to content

[SOLVED] How to delete break lines in product descriptions (Exporting CSV Module)


Recommended Posts

Hello everybody.

I am developing a module to be able to download custom data about the products to a CSV file. I find the problem when trying to insert the description (long) field in the CSV.

This field is added in the database as html text and stores newlines within itself, and this for a CSV file is a very bad thing, since it takes each newline as a new item.

I'm looking for a PHP or SQL function similar to strip_tags or trim to help me remove this line break before putting the information in the final CSV.

Thank you in advance for your help.

Edited by jesusroldan
Problem solved (see edit history)
Link to comment
Share on other sites

14 minutes ago, jesusroldan said:

Hello everybody.

I am developing a module to be able to download custom data about the products to a CSV file. I find the problem when trying to insert the description (long) field in the CSV.

This field is added in the database as html text and stores newlines within itself, and this for a CSV file is a very bad thing, since it takes each newline as a new item.

I'm looking for a PHP or SQL function similar to strip_tags or trim to help me remove this line break before putting the information in the final CSV.

Thank you in advance for your help.

 

I have solved the problem using this SQL statement:

SELECT 
REPLACE(REPLACE(description,CHAR(13),' '),CHAR(10),' ')
FROM ps_product_lang;

 I've been faster than the forum hehehe

Link to comment
Share on other sites

  • jesusroldan changed the title to [SOLVED] How to delete break lines in product descriptions (Exporting CSV Module)

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
×
×
  • Create New...