Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Regularly importing data from .CSV using CRON

Parent Feed: 

In the last article we managed to set up all commerce types and additional modules to import the data from our csv files. Now we need to do this regularly in order to provide users with the latest updates from our remote Hotellinx server.

Importing data from the server and writing them into the csv files is done by hook_cron() in our custom module from the first article. We want to do this once every hour, so we use the ultimate cron module in order to set up different execution times for different cronjobs.

Feeds can also be called via cron which imports the data every hour. As mentioned in the second article, the feeds have to be imported in the correct order for the Commerce variations to actually become visible. Unfortunately, we cannot specify the order in the feeds module but because we repeat this process every hour, it takes maximal two hours for the variations to be correctly imported.

Author: 
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web