Fop console is a module which provides a set a commands to extend PrestaShop 1.7 commands.
Since version 1.7.5.0 Prestashop provides some terminal commands using the Symfony console tool.
This repository provides a base Command with better support for PrestaShop legacy classes and useful commands to easy the development on Prestashop or manage a shop. These commands are mainly for developers, just some basic knowledge of command line processing is needed.
Donwload a zip release and install it like any other module.
Alternatively, run this in a shell :
#!/bin/bash
wget https://git.io/JMF3q --output-document /tmp/fop_console.zip && unzip /tmp/fop_console.zip -d modules && ./bin/console pr:mo install fop_consoleIf you want use the dev branch, you can install from github. If you want to contribute, first create a fork and follow the same steps using your forked repository url instead of the original one.
cd modules
git clone https://github.com/friends-of-presta/fop_console.git
cd fop_console
composer install
Install the module in the backoffice or in command line like this :
cd ../../
php bin/console pr:mo install fop_console
fop:about:versionDisplay the Fop Console version (on disk, on database, latest available release)fop:cache:clearReplace the cache directory with an empty one.fop:category:cleanManage empty categoriesfop:category:products-countGet the number of products for category and its childrenfop:configuration:exportExport configuration values (from ps_configuration table)fop:configuration:importImport configuration valuesfop:container:checkHealth check of the Service Containerfop:customer-groupsCustomer groupsfop:employee:listList registered employeesfop:employee:change-passwordChange employee passwordfop:environment:debug-modeEnable or Disable debug mode.fop:environment:get-parametersDisplay information about the installation (db name, etc)fop:environment:setup-devInstall your project for local developementfop:export:dataAllows to export data in XMLfop:generate:htaccessGenerate the .htaccess filefop:generate:robotsGenerate the robots.txt filefop:group:transfer-customersTransfers or add customers from a group to an otherfop:hook:addCreate hook in databasefop:image:generate:categoriesRegenerate categories thumbnailsfop:image:generate:manufacturersRegenerate manufacturers thumbnailsfop:image:generate:productsRegenerate products thumbnailsfop:image:generate:storesRegenerate stores thumbnailsfop:image:generate:suppliersRegenerate suppliers thumbnailsfop:module:generateScaffold new PrestaShop modulefop:module:hookAttach one module on specific hookfop:module:hooksGet modules listfop:module:non-essentialManage non essential modulesfop:module:renameRename a modulefop:module:unhookDetach module from hookfop:override:makeGenerate a file to make an overridefop:product:latestDisplays the latest productsfop:shop:maintenanceConfigure maintenance modefop:shop:statusDisplay shops statusesfop:theme:reset-layoutReset current (or selected) theme
The official documentation from PrestaShop and Symfony Core teams are still right, but you needs to extends our class.
<?php
// psr-4 autoloader
namespace FOP\Console\Commands\Domain; // e.g. namespace FOP\Console\Commands\Configuration
use FOP\Console\Command;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
final class DomainAction extends Command
{
/**
* {@inheritdoc}
*/
protected function configure()
{
$this
->setName('fop:domain') // e.g 'fop:export'
// or
->setName('fop:domain:action') // e.g 'fop:configuration:export'
->setDescription('Describe the command on a user perspective.');
}
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->io->text('Hello friends of PrestaShop!');
return 0; // return 0 on success or 1 on failure.
}
}In a shell (call it shell, console or terminal), at the root of a Prestashop installation, type this command to list all available commands. You'll see commands provided by Symfony, Prestashop and installed modules.
./bin/console listTo list only fop commands :
./bin/console list fopTo toggle the debug-mode (PS_DEV_MODE) run :
./bin/console fop:environment:debug toggleTo get help about a command :
./bin/console help fop:environment:debugYou are ready to go !
Any contributions are very welcome :) First install from sources and see Contributing for details.
Current contributors or contributors.
| Prestashop Version | Compatible |
|---|---|
| 1.7.4.x and below | ❌ |
| 1.7.5.x | ✔️ |
| 1.7.6.x | ✔️ |
| 1.7.7.x | ✔️ |
| 1.7.8.x | ✔️ |
| Php Version | Compatible |
|---|---|
| 7.1 and below | ❌ |
| 7.2 | ✔️ |
| 7.3 | ✔️ |
| 7.4 | ✔️ |
| 8.0 |
This module is released under AFL license. See License for details.