1

I'm currently setting up an Akeneo (2.1) instance that needs to communicate with an e-commerce solution. I was wondering what the best practices are when it comes to importing and exporting data. The documentation kind of lacks in this; it tells how you can set it up, but I'm missing practical use cases here.

Here's what I'm thinking of:

  • I want our customer to be able to upload their images / CSV files using an FTP connection.
  • Akeneo should ideally only start importing when a mutation in this (FTP) destination folder is detected.
  • Exporting should only be done once or twice a day, and upon completing the archive should be transfered with (s)FTP to a different location

I'm currently having trouble on how to implement this flow in Akeneo. Because if I look at what comes out of the box I can come up with the following:

  • I can setup an FTP account that ends up in `app/uploads/product/` and allow the customer to upload to that location
  • Akeneo does not detect file system changes, so I can only setup a cronjob that tries to import every hour or something. The drawback of this approach is that Akeneo will copy the CSV file(s) every time to `app/archive/import`. If you have big CSV files this can cause for some increment in disk usage.
  • I can setup a cronjob to export twice a day, but again: Akeneo will create archives on every export, so `app/archive/export` will grow even bigger every day. Please note that my customer has 4GB+ assets (images, documents, etc.). Does Akeneo cleanup the `app/archive`-folder every now and then?
  • Every exported archive comes in a new folder (with an every incremented job number (`app/archive/export/csv_product_export/28/` for example)), so I'm kind of wondering how I can detect for this new folder and how I can trigger to uploading of the archive to the remote (S)FTP server after the export is complete.

I was just wondering how other people who work with Akeneo handled these challenges. I know I can write my own custom bundle and hook into a ton of events or write shell scripts that do lot of the magic for me, but I am wondering what Akeneo itself already offers regarding this subject.

Any thoughts / ideas / suggestions / experiences on this topic are welcome!

Giel Berkers
  • 2,852
  • 3
  • 39
  • 58

1 Answers1

0

To answer your questions:

  • Akeneo doesn't need to have csv uploaded in the app/uploads/product/ folder. You can define the csv location in the import profile. That way you can use whatever location you want.
  • To import images, you need to zip them with the csv file (to see how the structure of the archive should look like, you can export some products with media on demo.akeneo.com)
  • Setting up a cronjob seems to be a good idea. If the disk usage is a problem, this cronjob could also clean the folder after the import.
  • To export twice a day, you can use the export builder to only export products that have been updated since last export (delta export). That way, you don't use too much space for nothing.
  • Again, the app/archive/export/csv_product_export/28/ path is only for internal use. This is a working directory used by Akeneo during the export (before zip for example) and the final file (csv or zip) is moved to the defined destination (in job configuration).

With all those informations, here is my recommendation:

  • Write a simple bash/php script to detect change in a folder and if there is one, move the file to another location and launch the import.
  • If you want to handle images, you can add to your script a way to generate the zip file with the good format
  • Then to export to your ecommerce, setup a cronjob to export every hours and export only new or updated products to the desired destination.

Another way would be to use the new REST API which is well documented here: https://api.akeneo.com/

Julien Sanchez
  • 843
  • 4
  • 12