Re: updating articles from csv [was: Re: Everyone on gmail is receiving the messages, but no one else is.]
In Germany and at FoodCoopNL we use the "external database"
option, found on top of the supplier list (which should really
become a preference to enable or not within Foodsoft). This works
with the sharedlists application, which manages supplier article
information. It also contains methods to synchronise this with
supplier (there is a German standard using FTP, and in NL we parse
email attachments). https://github.com/bennibu/sharedlists (Germany) https://github.com/foodcoop-adam/sharedlists (NL)
In the NL repository, look at the lib/*_file.rb files for a number
of import formats (it may take some heuristics to parse article
information from the spreadsheets that some farmers send).
Another way would be to use the upload articles functionality in
Foodsoft. It wouldn't be hard to add support for different file
formats (just like sharedlists has now). Then, after writing an
import filter, you could upload articles directly from the csv
(bonus if #113
were fixed to allow updating articles too). The "make articles
(un)available" option would be useful here.
On 28-09-14 09:12, Angelo [via foodsoft] wrote:
I'm trying to automate the updating of pricing and
availability information from our biggest supplier. They have a
csv that they make available, so we were going have a routne to
copy it into a blank table, manipulate it, then copy it to the
production database. Maybe weekly, or biweekly. We were going to
Use Foodsoft CSV upload using a pre-selection from the
supplier's articles. At this moment, you need to delete all
articles, then import new CSV when updating them (#113).
Install sharedlists (from this fork
perhaps), create user using rails console, create a supplier,
write an import filter for your supplier's file-format (which
could split "8 x 16 ozs" into unit="16 ozs" ans unit_quantity=8,
for example) (see lib/*_file.rb), and import it (could even be
automated by email or ftp).
Write your own script to update Foodsoft database from the
supplier database. Preferably do this in rails, since that makes
sure the correct database structure is maintained (like managing
the ArticlePrice association). Or output a CSV, which you upload