Friends of Presta Console
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.
Install from release (recommended)
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_console
Install from sources
If 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
Current commands
- <code>fop:about:version</code> Display the Fop Console version (on disk, on database, latest available release)
- <code>fop:cache:clear</code> Replace the cache directory with an empty one.
- <code>fop:category:clean</code> Manage empty categories
- <code>fop:category:products-count</code> Get the number of products for category and its children
- <code>fop:configuration:export</code> Export configuration values (from ps_configuration table)
- <code>fop:configuration:import</code> Import configuration values
- <code>fop:container:check</code> Health check of the Service Container
- <code>fop:customer-groups</code> Customer groups
- <code>fop:employee:list</code> List registered employees
- <code>fop:employee:change-password</code> Change employee password
- <code>fop:environment:debug-mode</code> Enable or Disable debug mode.
- <code>fop:environment:get-parameters</code> Display information about the installation (db name, etc)
- <code>fop:environment:setup-dev</code> Install your project for local developement
- <code>fop:export:data</code> Allows to export data in XML
- <code>fop:generate:htaccess</code> Generate the .htaccess file
- <code>fop:generate:robots</code> Generate the robots.txt file
- <code>fop:group:transfer-customers</code> Transfers or add customers from a group to an other
- <code>fop:hook:add</code> Create hook in database
- <code>fop:image:generate:categories</code> Regenerate categories thumbnails
- <code>fop:image:generate:manufacturers</code> Regenerate manufacturers thumbnails
- <code>fop:image:generate:products</code> Regenerate products thumbnails
- <code>fop:image:generate:stores</code> Regenerate stores thumbnails
- <code>fop:image:generate:suppliers</code> Regenerate suppliers thumbnails
- <code>fop:module:generate</code> Scaffold new PrestaShop module
- <code>fop:module:hook</code> Attach one module on specific hook ex: <code>php bin/console fop:module:hook --module=mymodule --hook=displayHeader</code>
- <code>fop:module:hooks</code> Get modules list
- <code>fop:module:non-essential</code> Manage non essential modules
- <code>fop:module:rename</code> Rename a module
- <code>fop:module:unhook</code> Detach module from hook
- <code>fop:override:make</code> Generate a file to make an override
- <code>fop:product:latest</code> Displays the latest products
- <code>fop:shop:maintenance</code> Configure maintenance mode
- <code>fop:shop:status</code> Display shops statuses
- <code>fop:theme:reset-layout</code> Reset current (or selected) theme
Create your owns Commands
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. } }
Getting started
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 list
To list only fop commands :
./bin/console list fop
To toggle the debug-mode (_PS_DEV_MODE_) run :
./bin/console fop:environment:debug toggle
To get help about a command :
./bin/console help fop:environment:debug
You are ready to go !
Contribute
Any contributions are very welcome :) First install from sources and see Contributing for details.
Current contributors or contributors.
Compatibility
| Prestashop Version | Compatible | | ------------------ | -----------| | 1.7.4.x and below | :x: | | 1.7.5.x | :heavy_check_mark: | | 1.7.6.x | :heavy_check_mark: | | 1.7.7.x | :heavy_check_mark: | | 1.7.8.x | :heavy_check_mark: |
| Php Version | Compatible | | ------ | -----------| | 7.1 and below | :x: | | 7.2 | :heavy_check_mark: | | 7.3| :heavy_check_mark: | | 7.4 | :heavy_check_mark: | | 8.0 | :interrobang: Not yet tested |
License
This module is released under AFL license. See License for details.
Commenti (0)
Non è stato possibile inviare il tuo giudizio sulla recensione
Segnala commento
Segnalazione inviata
Non è stato possibile inviare la tua segnalazione