How to Schedule Exports from Magento

Automating Exports From Magento for Products & Customers (Premium)

Howdy ,

In this blog post we have something a little different than normal.  We are going to be showing you how you can automatically export Inventory or Customer data from Magento at set times, and also get the exported data emailed to you.

The Video Tutorial

The video on how to do this is a Premium tutorial as it is quite an advanced area and smaller businesses will not need this functionality. If you have premium membership you will be able to watch this below.

In this video tutorial you will learn how to:

  1. Setup this script and obtain the copy & paste cron job link you need
  2. Identify the Magento Dataflow profile ID
  3. Customise the settings as needed
  4. Create a cron job in cPanel

Note: If you don’t see the step-by-step video tutorial above, you needed to be logged in and have an active Premium account.

What Can You Export?

The export tool that we’re using is the Dataflow profile from Magento and by applying a cron job to this we can set the export to run at set times throughout the day / week or month.

By using the dataflow profile we have access to two different banks of information.  We have:

1. Inventory data – Such as SKU, Stock quantity and pricing etc

2. Customer data – Such as customer name, address, email address etc

What could we use this for?

There are a number of reasons why you may find this type of information useful and you could apply it in a number of different ways.

Just a few of the reasons that we brainstormed in a matter of minutes were:

  • Monitoring stock levels – receiving emails for products that were running low on stock notifying you to order in more
  • Setting up an export to notify your trade customers of quantities and pricing amongst your lines
  • Sending pricing and stock updates to any external websites you may have not managed on Magento.
  • Downloading a CSV of prices for an Amazon repricing tool
  • To email product data to your remote staff members daily or weekly depending on their job roles
  • For external processing (  export > process > magmi import folder  )
  • Using the code as base to make it do what you want ( it’s written in PHP and can be modified accordingly )

If you are following us along in the video above then you will need the code.  As promised just click the button below and you can gain instant access to the code.

A Special Note for Large Amounts of Customers/Products

We’re adding this as a sensible note if you have thousands of products and/or customers then go careful with this script.

This PHP script will do what it’s told to do and if your webhosting has no time out on running cron jobs (which all decent Magento hosting won’t) and depending on the numbers of products or customers that are met by the conditions you set in your Magento Dataflow profile, you could export all of your inventory or customers and the file sizes and time it takes to run this export could become large and take quite some time.

Be sensible here and try and limit the number of products you are exporting on large catalogs as the likelihood is that you don’t need to know about ALL the customers or ALL the products. and always allow a sensible amount of time for the script to complete.

Oh and a little tip not mentioned in the video tutorial, you can set Magento Dataflow profiles to FTP the completed file for you to a remote host.

Enjoy!

Matt & Dave

11 replies
  1. Hershil Shah
    Hershil Shah says:

    I have followed all the steps but get the following error:
    Parse error: syntax error, unexpected ‘@’ in /home/ledlight/public_html/custom_scripts/dataflow_scheduled_export.php on line 26
    Not sure if this is due to an error in the code which is attached to the tutorial or it is an error on my part – I have reviewed all the edits I made to the code template and they all seem correct. Furthermore, the only “@” in the code is that in my email address.
    Thanks in advance.
    Hershil

    Reply
  2. Dale Holden
    Dale Holden says:

    HI Matt

    Not sure what is going on if i run it from the browser i get an email no problem.

    In Cron i do not get an email ??

    I copied the path and entered the email in the script that is listed in my cron email they are the samw!

    Reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *