Answer the question
In order to leave comments, you need to log in
How to set up the import of prices from excel to the database?
Good afternoon.
There are several different price files in excel, the import of which needs to be configured in the database.
The problem is that all files have a different structure, number of positions, etc.
What are the options for implementing such functionality?
Answer the question
In order to leave comments, you need to log in
Apparently the files come from different sources?
In this case, it makes sense to write a Product class that does almost nothing, only describes the main fields and has methods write_to_base() and, possibly, check_presence_in_base().
Next, a separate parser is written for each file source, which parses the file into an array of such objects and for each one in turn calls the check_presence_in_base() method, and if the answer is negative, it calls write_to_base().
If you need to not only add new objects, but also update old ones, then the logic of the second paragraph becomes a little more complicated, but not critical.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question