WT JShopping Bitrix 24 PRO CRON

Downloads 2947 Hits 2890 CTR 102% Plg Free

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.

WT JShopping Bitrix 24 PRO CRON

Description

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.

Bitrix 24 API requests limit

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.

Approximate time of updating of goods depending on their quantity and complexity

Product typeNumber of productsAPI RequestsTask complete expected time (seconds)
Simple product without variations 1 2 1s
  100 2 100s (~1.7min)
  3000 2 3000s (~50min)
Simple product with1 (main) variation 1 2 1s
  100 2 100s (~1.7min)
  3000 2 3000s (~50min)
Product with 1 (main) variation and 1 attribute 1 4 2s
  100 4 200s (~3.4min)
  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)

Installation

The installation is done using the standard Joomla extension installer.

Setup

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.

Joomla 4.1 task plugins for task scheduler

Go to the menu System - Management - Task Scheduler.

,Task Scheduler in Joomla 4.1

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. 

Plugin settings for updating prices and joomshopping balances from Bitrix 24

Save the task. You can start it manually using the "run" button from the task list.

Task list in Joomla 4 task scheduler

Important

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.

Setting up the juxtaposition of jumshopping and bitrix 24 products for synchronization

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.

Product card jumshopping bundle of goods with the bitrix 24 product catalog

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

crontab -e

In the console editor that opens, add the line

* * * * * php /path/to/site/public_html/cli/joomla.php scheduler:run

cron tab e ssh

Five asterisks mean every minute access to the filejoomla.php , which is used to run Joomla CLI scripts. Thescheduler: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. 

Joomla

Extension type:
Plugin
Folder:
Task
Joomla version:
4.1, 4.2

What's new

Taking into account the limits of the Bitrix 24 REST API

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 of the 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.
It will take about 1.7 minutes to update the data of 100 simple products.

Related extensions

WebTolk Joomla Extensions

89 Extensions
11 Categories
395 Versions released
380564 Downloads
Cart
Cart is empty