Console for PrestaShop 1.7
This repository provides a Command that better supports PrestaShop legacy classes using the current PrestaShop Console and a list of useful commands that you can use and reuse for learning purposes.
This module is released under MIT license.
Install
cd modules
git clone https://github.com/friends-of-presta/fop_console.git
cd fop_console
composer install
cd ../../
php bin/console pr:mo install fop_console
Current commands
fop:clear-cache
Clear the cache folder super fastfop:debug-mode
Enable or Disable debug modefop:shop-status
Display shop(s) status(es)fop:maintenance
get status or change maintenance mode, list or add maintenance ip addressfop:images:generate:categories
Regenerate categories thumbnailsfop:images:generate:manufacturers
Regenerate manufacturers thumbnailsfop:images:generate:products
Regenerate products thumbnailsfop:images:generate:stores
Regenerate stores thumbnailsfop:images:generate:suppliers
Regenerate suppliers thumbnailsfop:generate:htaccess
Generate the .htaccess filefop:generate:robots
Generate the robots.txt filefop:theme-reset
Reset current (or selected) themefop:add-hook
: Create a new hook in databasefop:unhook-module
: Ungraft module on specific hookfop:hook-module
: Graft module on specific hookfop:latest-products
: Displays the latest productsfop:export
: Exports object models in XMLfop:check-container
Health check of the Service Container, for now list the services we can't use in Symfony commands
Create your owns Commands
The official documentation from PrestaShop and Symfony Core teams are still right, but you needs to extends our class.
<?php
namespace Your\Own\Namespace;
use FOP\Console\Command;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
/**
* This command is a working exemple.
*/
final class Export extends Command
{
/**
* {@inheritdoc}
*/
protected function configure()
{
$this->setName('hello:world');
}
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$io->text('Hello friends of PrestaShop!');
}
}
What's next?
The current strategy is to configure a Context before the execution of the Command. This works well but we like to make it more configurable from the Console arguments.
Contribute
Feel free to add more commands, post some issues or new PR : contributions are very welcome.