Technical Resources

Technical Resources



99. Technical resources

Command lines

Inventory management extension comes with a few command lines.

They can be executed in console mode using php bin/magento CMD, where “CMD” has to be replaced with one of the available commands.

Warning

If you get this error running one of the following command lines : “Area code is already set”

Please open the php file containing the command code (these files are located in app\code\BoostMyShop\AdvancedStock\Console\Command\, and named as command lines names)

Then, find and replace the following line :

$this->_state->setAreaCode('adminhtml');

by :

try{
     $this->_state->setAreaCode('adminhtml');
}catch(\Exception $ex)
{
     //do nothing
}

Stock Discrepencies

php bin/magento bms_advancedstock:check_stock_discrepencies

Runs a report to check and display possible stock errors, available from Stores > Configuration > Boostmyshop > Advanced inventory > Stock discrepencies.

Note

You can also run this command line preceded by the same one with the --fix option at the end, to try to fix all errors found :

php bin/magento bms_advancedstock:check_stock_discrepencies --fix
php bin/magento bms_advancedstock:check_stock_discrepencies

More information on the stock discrepancies different probes : Stock discrepancies documentation

Note

If you get a “memory exhausted” error executing the stock discrepencies command line, like :

Fatal error: Allowed memory size of XXX bytes exhausted (tried to allocate XXX bytes)

You can solve this problem setting a “-d memory_limit” instruction at the start of the php command line :

php -d memory_limit=2G  bin/magento bms_advancedstock:check_stock_discrepencies --fix

If the problem persists, please increase the value from “2G” to an higher one, until it’s solved.

Fix Reservation

php bin/magento bms_advancedstock:fix_reservation

Check if there are some reservation problems (products over/under reserved).

Refresh Qty To Ship

php bin/magento bms_advancedstock:refresh_quantity_to_ship

Update products “quantity to ship” for all warehouses.

Refresh Sellable Qty

php bin/magento bms_advancedstock:refresh_sellable_quantity

Update products “Sellable quantity” in Magento, based on the quantity available in the different warehouses.

Refresh Sales History

php bin/magento bms_advancedstock:refresh_sales_history

Refresh products “Sales History” statistics.

Note

Statistics are NOT updated automatically by default, you have to create a cron task to automate this update.

Import Warehouse Stock

php bin/magento bms_advancedstock:warehouse_import --warehouse_id X --file_path /path_to_CSV_file/

This command executes the same import than the Warehouse stock import, but can be run with big import files without timeout errors.

Simply replace “X” and “/path_to_CSV_file/” by correct values to run the import.

Note

For example :

  • If the stock should be imported for the “Default” warehouse which ID is “1”
  • If the CSV file containing stock to import is located in the var/ folder and is named “Warehouse_1_stock.csv”

The correct command line should be :

php bin/magento bms_advancedstock:warehouse_import --warehouse_id 1 --file_path var/Warehouse_1_stock.csv

Export Warehouse Stock

php bin/magento bms_advancedstock:warehouse_export --warehouse_id X --date YYYY-MM-DD

This command executes the same export than the warehouse stock export available from the Products tab of warehouse edit screen, but can be run with big export files without timeout errors.

Simply replace “X” and “YYYY-MM-DDD” by correct values to run the export.

The “date” setting is optionnal, meaning if not setting is provided the stock will be exported as it is at the time of the export.

Note

For example :

  • If the stock that should be exported in the one from the “Default” warehouse which ID is “1”
  • If the stock should be exported how it was at June 12th, 2018

The correct command line should be :

php bin/magento bms_advancedstock:warehouse_export --warehouse_id 1 --date 2018-06-12


    • Related Articles

    • Technical Resources

      8. Technical Resources ​8.1 Command Lines
    • Technical resources

      99. Technical resources Command lines Procurement extension comes with a few command lines. They can be executed in console mode using php bin/magento CMD, where “CMD” has to be replaced with one of the available commands. Warning If you get this ...