For online stores working with warehouses, it is important to display to customers the current prices and the number of goods available for order. As a rule, the accounting of goods is carried out in a specialized accounting system. This is most often realized by updating prices and balances on a schedule using CRON technology. The server CRON allows you to run update scripts according to a specified schedule.
Starting with Joomla 4.1, a built-in task scheduler appears in the CMS core, which can be run by CRON. Tasks launched in this way do not load the web server and do not have a limit on the execution time of the script. The Joomla 4.1 task Scheduler functionality is expanded with the help of additional plugins.
This plugin is a task plugin for Joomla 4.1 and is designed to work with warehouse accounting in CRM Bitrix 24 by API. The plugin only works together with the WT JoomShopping Bitrix 24 PRO plugin.
To get the price and balances, different methods of the Bitrix 24 API are used, so there are 2 API requests.
In practice, it takes from 0.3 to 0.65 seconds to update the price and quantity of one product. The web server usually has a limit on the script execution time of 60 seconds.
Consider this and the number of your products when choosing the task scheduler mode.
The installation is done using the standard Joomla extension installer.
Go to the menu System - Management - Plugins, filter plugins by type
task. Make sure that the WT Joomshopping Bitrix 24 PRO CRON plugin is enabled.
Go to the menu System - Management - Task Scheduler.
Create a new task "Updating JoomShopping product data from Bitrix 24". Specify which JoomShopping product data should be received from Bitrix 24. Set how often prices and balances should be updated.
Save the task. You can start it manually using the "run" button from the task list.
Please note that this plugin is an addition to the WT Joomshopping Bitrix 24 PRO plugin and uses its CRM access settings. Also, it is with the help of the plugin WT Joomshopping Bitrix 24 PRO that the matching of JoomShopping and Bitrix 24 products is configured.
In each product card, when editing, a "Bitrix 24" tab is added, in which you can configure the matching of products. Automatic receipt of prices and balances is not possible without product comparison settings.
Joomla 4.1 Task Scheduler Settings
Joomla 4.1 scheduler can work in several modes:
- Tasks are started by the link. You can get the link in the Task scheduler settings.
- "Lazy Scheduler" - tasks are started for execution when users are active on the site (both on the frontend and backend). This mode can be used for tasks that are not demanding of server resources and do not take much time.
- Running scheduler tasks using Joomla 4 CLI. Recommended option.
Running Joomla 4 scheduler tasks using CRON and CLI script
In this mode, the launch and execution of tasks does not use the resources of the web server, so no matter how long and voluminous the task is, the site will continue to work normally for visitors. In other cases, performing "heavy" tasks can lead to "brakes" on the site.
To start the task scheduler using the CLI, you need to connect to your server via SSH and run the command:
php /path/to/site/public_html/cli/joomla.php scheduler:run
To add a task to the server CRON, run the command
In the console editor that opens, add the line
* * * * * php /path/to/site/public_html/cli/joomla.php scheduler:run
Five asterisks mean every minute access to the
filejoomla.php , which is used to run Joomla CLI scripts. The
scheduler:run command allows you to run scheduler tasks from the Joomla 4 admin panel. So you configure the server CRON once, and then you configure all the tasks from the admin panel of your site on Joomla 4.
The server CRON accesses the file once a minute. However, if in the task settings in the Joomla task scheduler there is a task execution once a day or once every few hours, then in fact the task will be executed according to the Joomla settings.
The frequency of running the server CRON should be set for the most frequent task.