Cron. General Presentation

What is Cron?

In your site Control Panel, it is possible to configure the automatic launch of the PHP program at a determined time:

If you configure Crontab to launch the admin/cron.php program, which is part of the plugin, the plugin will be able to download the price list at a certain time from URL or via FTP and process it according to the supplier form settings.

This way the product prices and quantities are updated automatically without human intervention. It is enough to specify the path to the file on the server in the settings: and the frequency of Crontab start:

Please don't ask us how to set the path to the file correctly: each hosting does it differently, it's better to ask the hosting technical support.

A Crontab job on the server is an "alarm clock" that periodically runs the cron.php plugin program. On this, the functions of Crontab end, the program cron.php does the rest of the work.

The cron.php program may not start if:

  • the time set in the supplier form settings has not come
  • the supplier form is busy processing the price list,

but Crontab will every minute or every 5 minutes keep trying to run the program so that if timeout occurs to push the plugin to work further.

Notice 1

If Crontab is configured to start every 5 minutes, there will be a 5-minute pause in case of a timeout. When processing a large price list, If there are 10 timeouts, 50 minutes will be lost.

Notice 2

The cron.php program can be run manually (used for debugging) from the browser's address bar:

Therefore, it is recommended to rename the cron.php file to something different (only known to you) so that a third party cannot run it.

For example:  cron121212.php

Work algorithm summary:

  • Crontab starts the program admin/cron.php
  • cron.php checks which supplier form should be running at a given time
  • Downloads the price list and if the price list is downloaded successfully, consecutively executes the tasks specified in the supplier form in the "Cron" tab.

Cron. Algorithm and Terms

Task list

For each supplier form, a task list can be set. The main task processes the price list according to the supplier's form first page settings. You can add up to 3 preliminary and up to 6 final tasks. Preliminary tasks are performed before price list processing and final tasks after.

Each task list is configured in the supplier form "Cron" tab and is applicable for a specific price list.

Each price list has its own task list:

Work algorithm

As you know, any price list can be processed by its supplier form by pressing the button "Start from admin/uploads":

This launch method is used if the price list is larger than the hosting limits.

The price list is uploaded in advance to the site using FTP, to the admin/uploads folder and renamed to 14.xml , 14.xls or 14.xlsx, or 14.csv depending on the file format, where 14 is the supplier's form number.

You can manage Cron work on suppliers list page, enabling and disabling cron for specific supplier form:

The number in brackets (0) means the execution priority.

Cron work rules

  • Cron executes all tasks that are enabled, according to the priority and the specified execution time.
  • No task can start executing until the previous one finishes, so the task start time is set not with an accuracy of a minute but with with an accuracy of 1 hour.
  • The old price list is automatically deleted before the new price list is downloaded.
  • None of the preliminary or final tasks will be performed if the price list download fails.
  • A detailed report on the Cron work can be viewed on the server, in the folder admin/uploads

The main Cron settings and its work summary results are displayed on the suppliers-list page:

  1. Price list processing date and time.
  2. Number of lines in report / errors files (see Report).
  3. The task start settings: hour number, week number, month number (comma-separated values are allowed).

Cron. Task Report

As a result of running cron.php, a report is generated on the server in the admin/uploads folder - file log_cron.tmp

The file opens with "Notepad" or "Notepad++"(or any text editor) and contains a record of each task execution time and details about the processed command. For example:

here you can see the supplier form "Wheels10" task list processing results

  1. At 01:25, the preliminary task was completed. In our example, this is tool number 166 - "Quick zero quantity of products"
  2. At 01:28, form No. 5 "Wheels10" price list processing was completed.
  3. At 01:35, the final task tool 75 "Set % special price in Field1 for customer groups in Field2" was completed

Tool numbers can be seen using the "Inspect Element" browser tool:

The log folder contains detailed price list processing reports, report and errors files marked with supplier form number to which they refer:

in this case, the supplier form "Wheels10" has the number 5

Cron. Task Settings

The actions list for the scheduled supplier form processing is should be set in the "Cron" tab:

Preliminary tasks

Preliminary tasks are actions from the tools list that are performed before processing the price list.

Usually, in the preliminary task, tools like: "Quick zero quantity of products", "Set products quantity as input in Field1", "Disable special prices", and "Reset quantity in Options" are included:

In our example, from 3:00 to 3:59 in the morning, all supplier No.1 "Ukrainian Catholic University" products will be set with quantity 0 (see the previous image).

Main task

You can enter an e-mail in the "Execution notice" field so that the plugin sends messages about Cron's work results:

The price list processing is configured in task #4 "Main task":

it is enough to fill in the price list link and its format.

A link with a dynamic date.

For example, a supplier provides a price list link like this:

where the date changes every day.

In such cases, you should replace the date in the link with the [date] text:[date].xml

uncomment the admin/cron.php file at this line:

and adjust the date format in the string:

$dd = date('Y-m-d', $mk);

for example in this case:

$dd = date('d-m-Y', $mk);


To access a price list via FTP, you have to also enter its name, since the folder may contain several price lists intended for other stores or for other purposes:

If you do not need to download the price list, because it is already in the admin/uploads folder (it was downloaded earlier by another plugin), it is enough to fill in its name and not specify the source:

No one Preliminary and Final task will not be completed if the price list download fails and the price list is missing in the admin/uploads folder (see cron algorithm).

In very rare cases, there may be a need to execute only Preliminary and/or Final tasks without processing the price list. In such cases, just skip setting the Main task:

Final tasks

It is possible to complete up to 6 final tasks after price list processing. Here are some useful examples:

1. After processing the price list, among this supplier products, there may be products that have not been updated due to their missing in the price list. These products' quantity should be reset so they do not appear in the store as "In stock":

  • Field1 has a period of 2 hours in case the price list will be processed for more than one hour
  • button - in position "Only this supplier", so that the plugin does not reset other suppliers' products.

2. After the price list processing, there may be products that are almost out of stock. If you don't want to risk putting them up in stock, add this task:

  • products with quantity 0 or 1 will be disabled
  • applies only to the products of this supplier "Only this".

3. The product quantity can be specified more flexibly:

  • to the product names, the quantity of which is equal to 1, 2, 3 or 4 will be added the text from Field 1 (out of stock)
  • applies to all products in the store, regardless of which supplier they belong to.

4. If you are a supplier and provide price lists to client stores, then these couple of tasks will make it possible to automate the process:

  • first, the products are exported to the file admin/uploads/ex.xml with your margin to the prices 0.3%
  • the resulting price list, named products.xml, is copied to the FOLDER folder, which is located at the site root
  • discount can be set using a negative markup percentage, for example: -0.3

Cron. Time Settings

Crontab in the Control Panel should be set to run at the maximum frequency allowed on your host. Ideally, it should attempt to run every minute the admin/cron.php program which is included in this module.

The admin/cron.php program does not</strong > run if:

  • the program is already running
  • among all cron job tasks, there is no one that should be running at this hour.

Task start time

It is configured individually in each supplier form, in the "Cron" tab:

(no spaces allowed, character * means "each").


  • start the task at any minute: from 5:00 to 5:59
  • start the task at any minute: from 13:00 to 13:59
  • start the task at any minute: from 19:00 to 19:59
  • Monday(1), Wednesday(3) and Friday(5) only
  • every week

This setting starts the task for the first time on Monday, at 5:00, if the previous task has finished running. Otherwise, it may start later, any minute between 5:00 and 5:59.

The cron time on the server may not match the time in your time zone, and may not match the server time:

That way the "GMT:" field should be set by trying.


The task start time can be denoted by *. This means that the task must start immediately after the previous task ends. Thus, it is possible to run all tasks in a cycle, based on their priority.

But in order to prevent only the task with priority 1 from being executed all the time, you need to set a period during which no task can be executed again.

By default, the cron.php program has a period of 240 minutes, which means that each task can be re-executed no earlier than after 4 hours.

By default, the program assumes that all your tasks will be completed within 4 hours. You can adjust this in the admin/cron.php file at this line:


For example, if the period is set to 4 hours, then this time setting does not make sense:

because if the package starts at 2 o'clock in the morning, then its next start is possible not earlier than 6 o'clock in the morning.


Often when debugging, cron is run from the browser:

Cron. Buttons

Cron task management

You can manage the cron tasks work using three buttons located above the suppliers' list:

  1. Restarts the tasks' execution sequence, the execution starts from the beginning. The Period starts counting from zero.
  2. Continues tasks executing from where they stopped.
  3. Stops executing tasks. It is used in cases when it is necessary to urgently execute any Instrument or process an unscheduled price list. The task progress is recorded so when you click the "Cron Continue" button, the process will continue from the same place where it was stopped.

If after clicking the "Cron Hold" button, it lights up in red, then the command was not executed and it needs to be repeated after some time when the running cron task ends or a timeout occurs.

Unscheduled task start

You can start one specific cron task by clicking the "Cron Start" button on the supplier form:

This button is designed to be able to start processing large price lists without constantly pressing F5 when timeouts occur.


Cron. Troubleshooting

The stability of cron work is highly dependent on the server. More precisely, from the server software settings.

It often happens that the price list processing is interrupted on the file's first lines for no apparent reason, but after restarting the server, the cron tasks start working fine again... for a while.

Issues and solutions

Issue 1: Price list processing is interrupted.

Solution: Run the price list downloaded by cron by clicking the button "Start from admin/uploads".

  • If the problem reappears, then cron has nothing to do with it, look for the answer in the price list encoding or enable functions PHP mbstring in the Host's Control Panel.
  • If the price list has been processed to the end, run the cron from the browser (see at the end of the page). Look for errors in System -> Maintenance -> Error log, discuss them with hosting support.
  • Try connecting to the cron.php file without using wget, like this:
    /usr/local/bin/php /home/аккаунт/domains/сайт/public_html/admin/cron.php
  • Ask tech support to disable the ModSecurity feature
  • Click the "Cron reset" button
  • Update the admin/cron.php file if a new version is available
  • Go to each supplier form and click "Save"
  • Restart the server

Issue 2: The cron.php program does not download the price list.

Solution: Try with moving the file name directly into the link:

Ask the supplier to remove special characters from the login and password

Usergio Copyright © 2022