OpenCart lessons, Seo, ZennoPoster, Blog

Parsing sites and filling data on CMS OpenCart via MYSQL

CMS OpenCart

The freelance exchange received an order to transfer data from several online stores and transfer them to the site under the control of CMS OpenCart. Before, of course, I did the loading of products and categories by entering the administrative panel of the resource, now I wanted to get a more universal solution that allows you to upload photos, text directly through MYSQL database. In addition, this method of uploading information allows you to do a similar process to other sites faster and more efficiently, because there are no options to make a mistake when changing elements, and, accordingly, their subsequent search on the page and correction.
opencart

So, we have 3 sources with text, images (titles, descriptions, characteristics, etc.) that need to be processed in the right way. For example, all text data must be changed before querying MYSQL database, because IT does not support special characters, etc.

OpenCart

The structure of CMS OpenCart is such that it is necessary not only to insert information line by line into the database, but also to bind items to the required element. So first I downloaded the categories, and only then the products themselves, with reference to the desired category. To do this, I just used transliteration (seo url of the page) and the tool to replace special characters with empty ones. Also I faced the problem of loading such symbols in categories, I had to escape them before implementing.
Since all actions were performed through the program :ZennoPoster:, you need to check the correctness of their input every time, because in case of an error, you can damage the entire site. Fortunately for this there is an internal debugging of all actions and you can always track the process of stopping the action.

tip: back up your site every day!

Correction

At one point it turned out that the site in some categories did not open, the same applied to the goods of the project. The most important problem was that the client did not take care of the daily backup of the site, which led to a return as much as a month ago! Therefore, I urge you to save data on a regular basis and in a timely manner-mistakes are made not only by people, but also by machines!
That as a result – on the one hand it was necessary to fill in information anew, with another-I considered all or almost all defects made earlier.

What software to use

What I definitely like about ZennoPoster is its versatility and speed. For example, I do not need to spend additional time switching between FTP-client to upload, say, images to the server, as well as use a separate solution for queries to the MYSQL database, because all these tools are already built into the program. In addition, the program is able to handle huge lists and tables, which always plays into the hands of the correct use. That is, with just one solution, you can upload images via FTP, and immediately bind them to the desired table in the database.

The results of the parsing and fill the data into OpenCart

The result of parsing sites was:

First, in the EXCEL table for each of the projects entered data such as url of the product, its name, description, characteristics, etc. Then selecting them in separate variables can be installed in the MYSQL database and bind to different elements. After that, a mandatory requirement is to check the correctness of the entered data, as well as the correction of possible defects. For example, I had a problem when binding the category id to a specific product, because the category id was in MYSQL by the name of the category, and the name of the category in turn depends on how to properly escape the specials.symbols. There were also errors when parsing the necessary images as the main photo of the goods.
The conclusion and the main result for me personally was that the versatility of loading data in any case is much better than the usual input through the administrative panel of the site, or dancing with tambourines with several programs.
Unfortunately, the client refused to wait for the implementation of the system because of the deadline and getting out here and there constant errors. However, it is loading through the database that directly speeds up the process, rather than the long way through the site’s admin panel…