Auto-Detect the Most Recent File from Directory and Import It to OpenCart
Taking into account the fact that there is no built-in import possibility, so considering the extension to mass add/update you have to think on different needs that might occur.
Store Manager for OpenCart, for instance, offers wide import functionality. The most popular features are:
- import from the files of multiple formats - CSV, XML, XLS, XLSX, ODS, TXT
- useful mapping feature that allows you to have your columns named differently than database fields
- use local and remote files that might be stored at your suppliers’ servers
- possibility to configure automated imports running on cron using addon
In this article we will describe one more situation where you will not go without Store Manager as its functionality might be really handy for you.
Task: Import the latest file local/remote directory into OpenCart dynamically
For example, your supplier put file with inventory changes for you into some folder at his server and sends you link with access details to get it. Each time, new file is added to that source directory and it contains in its name some variable part that holds the value of its creation date:
In case you have set up automated import, most likely you would like mass upload tool to pick up latest file instead of editing settings or asking provider to edit and replace the file with needed name each time he adds new one.
Even if your import sheets are stored locally and you can avoid re-naming them and make the most recent file of the folder to be detected dynamically.
Solution: Settings for picking the latest file from the folder
So what is the solution? How this can be done? The answer is by using special file ‘mask’ to substitute the variable part/name of file in Store Manager import settings.
- Launch Import/Export Wizard of Store Manager for OpenCart
- Choose path to local or remote directory and instead of file name or its variable part put ‘mask’ - in our case this will be asterisk symbol (*)
- Move to the next step where you can preview the result.
Have a look at these examples:
The most recent file added to local folder ‘Import’ at your PC.
The latest file from remote server that starts with the word ‘products’.
Step-by-step import instructions check here -
Result: Directory contents is scanned and latest file is auto-picked.
This way your you can save these configured settings and use for automated imports without manual changes done.