Using CLI Commands

If you have access to your server CLI console (usually available on VPS server), you can use multiple useful features, such as:

  • Import/export all products with one command;
  • Delete multiple products with specific product reference prefix;
  • Start / Stop / Kill planned or running tasks etc.

CLI commands speed up the process when you are setting up new import/export. A progress bar shows the current status, estimated time remaining, memory usage, etc.

Wise2Sync:run will be most useful when you are setting up the integration. You do not have to wait for the heartbeats to complete the task. This is faster and you can see progress in CLI window instantly.

We recommend to always add --no-debug parameter to disable warnings about missing PrestaShop translations etc.

Wise2Sync:heartbeat

You've already used this command when installing extension and setting up CRON. But in case you want to execute Heartbeat manually from your console,  you can run this command:

$ php bin/console Wise2Sync:heartbeat --no-debug

Heartbeat command does not take any arguments or options.

Wise2Sync:run

There are multiple options this command takes:

Option Example Parameter(s) Explanation
--id_profile --id_profile=5 Runs profile (import or export) by selected profile ID.
--kill no value Kills any other running tasks before staring a new task.
--delete --delete=tasks
--delete=queues
--delete=products
Tasks - deletes all existing tasks ignoring their status.
Queues - deletes (truncates) queue table
Products - deletes all products with the reference prefix you set in module configuration section.

You can run --help argument see full list of options and arguments.

Below we will show you a few examples. Lets say  you've configured a new product export profile and would like to run it. Your profile ID is 2.

$ php bin/console Wise2Sync:run --id_profile=3 --no-debug
[19:53:31] Loaded "All Products Export" profile with the following parameters:
+--------------+------------+
| Parameter    | Value      |
+--------------+------------+
| Type         | Export     |
| id_profile   | 3          |
| skip_noimage | 0          |
| limit        | 100        |
| visibility   | Everywhere |
| only_active  | 1          |
| in_stock     | 0          |
| tax_included | 0          |
+--------------+------------+
[19:53:31] Continue with product Export? (y/n)  y
[19:53:35] Creating New Task...
[19:53:36] Added 100 products to Export Queue (default: 20.00 MiB - 264 ms)
[19:53:36] Processing Queue of 100 products...
 100/100 [============================] 100% 9 secs/9 secs 36.0 MiB
[OK] Export complete!

And for product import - the command would be very similar (note, that we delete any other existing tasks):

$ php bin/console Wise2Sync:run --id_profile=2 --delete=tasks --no-debug
[20:03:30] Found 1 task. Delete? (y/n) y
[20:03:32] All (1) tasks deleted successfully
[20:03:32] Loaded "Product Update #2" profile with the following parameters:
+-----------------+--------------------+
| Parameter       | Value              |
+-----------------+--------------------+
| Type            | Import             |
| id_profile      | 2                  |
| app_profile_id  | 932                |
| mode            | Update Stock&Price |
| limit           | 100                |
| disable_missing | 0                  |
+-----------------+--------------------+
[20:03:32] Continue with product Import? (y/n)  y
[20:03:36] Creating New Task...
[20:03:37] Added 100 products to import Queue. Mode: Update Stock&Price
[20:03:37] Processing Queue of 100 products...
 100/100 [============================] 100% 13 secs/13 secs 42.0 MiB
[OK] Import complete!

For security reasons we've disabled a possibility to run multiple instances of commands at the same time. You can not run two commands at the same time.

If you are confident and know what you are doing, you can set up Wise2Sync:run command to be executed by CRON in desired intervals. Then no Heartbeat CRON is needed.