S
S
SergPro2018-05-07 16:07:08
SQL
SergPro, 2018-05-07 16:07:08

Update Wordpress tables from XML - how to implement?

The task is to update tables in WordPress records using cron from xml upload.
As far as I understand, WordPress does not have a plugin for conveniently storing information in a post, with the ability to access it from the outside, change it. There are additional fields, but you will have to make a lot of templates, since the pages with tables may differ. Moreover, each line in the table has two parameters - article and price.
The first way that came to mind is SQL query, parsing and updating. Moreover, parsing in several levels - first you need to grab a table, then take a row in a cycle, find values ​​in it, replace them with new ones, then collect new SQL in the same cycle, and at the end, after iterating through the array of strings, write to the database.
Another way is to use shortcodes, but you will have to re-create the tables. As a result, theoretically, the shortcode will be easier to get from the table. The process will be as follows: the records are retrieved with a SQL query, then the shortcode with ID = 1C ID is set to a value, and after bypassing the array, the updated SQL is saved.
Am I thinking right? Is there a simpler, prettier way? What type of shortcode is best to use? Maybe you should use multi-level shortcodes (then you won’t have to produce a bunch of separate shortcodes with id, three are enough: tr, id, price)?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question