D
D
Dmitry2016-09-07 22:39:52
PHP
Dmitry, 2016-09-07 22:39:52

The client wants to automate the upload of the catalog to the site via CSV, how to do this if there are complex descriptions?

The crux of the matter is this. The client wants to automate the upload of products to the site from a CSV file. At first glance, there are no problems - separate all fields with a semicolon and that's it. But what about the "description" field, which can contain a lot of text, html tags, punctuation marks (the same semicolon), etc.?
I’ll clarify that the question is not so much about processing on the site’s side, but about HOW to suggest to the client to prepare this file so that special characters are escaped in it as a result. After all, he can’t just create a table in Excel, type in texts and save it in CSV.
And he also wants the text to have html tags. The site has a visual editor in which you format the text and it adds the necessary tags, but if the client prepares the texts outside the file, how can he make the text already with html?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DevMan, 2016-09-07
@battrack

There are plenty of ready-made libs for working with cvs.
there is even a built-in function.

E
evnuh, 2016-09-07
@evnuh

The text of the field cannot contain a separator, so there will be no semicolon in your description, or it will be escaped and the csv reading function will understand this.
And what does "how to be" mean? As you need, so be it. You just need to shove it into the base - shove it as is. You need to leave only the text - filter and leave only the text. What is the point of the question?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question