Plugin for automatic regular updating of prices and balances of JoomShopping products from CRM Bitrix 24. It is recommended for working with a small number of products.
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.
Bitrix24 assumes a limit of 2 requests per second when accessing the API. If the limit is exceeded, the request is not executed, the API returns an error about exceeding the limit. As a result, some goods did not receive the updated value of prices and quantities. Now the script "sleeps" 0.5 seconds after each executed request. It takes 2 requests to update the price and quantity. Each attribute also requires 2 API requests. Accordingly, updating the product data now takes at least 1 second, as well as another 1 second for each attribute.
|Product type||Number of products||API Requests||Task complete expected time (seconds)|
|Simple product without variations||1||2||1s|
|Simple product with1 (main) variation||1||2||1s|
|Product with 1 (main) variation and 1 attribute||1||4||2s|
|3000||4||6000s (~100 min = 1h 40min)|
|Product with 1 (main) variation and 2 attributes||1||6||3s|
|100||6||300s (5 min)|
|3000||6||9000s (~150 min = 2h 30min)|
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 scheduler can work in several modes:
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.