PrestaShop is a powerful e-commerce platform built on Symfony. As a result, PrestaShop integrates the Symfony Console component, providing a set of convenient console commands. These commands help developers and administrators automate tasks, check the store's status, update configurations, and perform other essential operations.
In this article, we will take an in-depth look at the key console commands in PrestaShop, explain their purposes, and provide usage examples.
What Are Console Commands?
Console commands are text-based instructions executed through a terminal or command line interface. In PrestaShop, they allow you to:
- Manage the store's settings and status.
- Check configurations and identify errors.
- Automate routine operations such as updates or file generation.
To execute these commands, use the bin/console
binary file. Before running it, ensure that you are in the root directory of your PrestaShop installation.
1. prestashop:config
Purpose: Manage store configuration.
This command allows you to modify store configuration parameters, such as URL settings, display options, or other features.
Example Usage:
To disable the store (PS_SHOP_ENABLE
):
To get the current value of a parameter:
When to Use:
Ideal for mass configuration management or restoring store functionality after errors.
2. prestashop:debug
Purpose: Manage debug mode.
Example Usage:
- Turn debug mode on:
- Turn debug mode off:
- Check current debug mode status:
When to Use:
Essential for developers when troubleshooting issues or diagnosing problems.
3. prestashop:licenses:update
Purpose: Update license information for your store.
Example Usage:
When to Use:
Run after updating PrestaShop or its modules to sync license data.
4. prestashop:linter:legacy-link
Purpose: Analyze the codebase for outdated links to old pages.
Example Usage:
When to Use:
Run this after making code changes to ensure no obsolete links affect functionality.
5. prestashop:linter:naming-convention
Purpose: Check whether object and method names in the code follow established naming conventions.
Example Usage:
When to Use:
Helpful for maintaining code quality and readability.
6. prestashop:linter:security-annotation
Purpose: Verify the presence and correctness of security annotations in the code.
Example Usage:
When to Use:
Ensures the code meets security standards, especially in controllers.
7. prestashop:list:commands-and-queries
Purpose: Display a list of all available commands and queries.
Example Usage:
When to Use:
Quickly access a complete toolset for managing your store.
8. prestashop:mail:generate
Purpose: Generate email templates.
Example Usage:
When to Use:
Useful when creating or updating custom email templates for store notifications.
9. prestashop:module
Purpose: Manage modules.
Example Usage:
- Install a module:
- Uninstall a module:
When to Use:
Facilitates installing, removing, and managing modules directly from the console, saving time.
10. prestashop:schema:update-without-foreign
Purpose: Update the database schema without adding foreign keys.
Example Usage:
When to Use:
Useful when the database structure has been manually altered, and foreign keys might cause errors.
11. prestashop:taxes:update-eu-tax-rule-groups
Purpose: Update tax rule groups for EU countries.
Example Usage:
When to Use:
Required to keep your store compliant with current EU tax regulations.
12. prestashop:theme:enable
Purpose: Activate a selected theme.
Example Usage:
When to Use:
Apply a new theme after installation.
13. prestashop:theme:export
Purpose: Export a theme to an archive file.
Example Usage:
When to Use:
Handy for transferring themes to other projects or creating backups.
14. prestashop:translation:find-duplicates
Purpose: Identify duplicate translations in the system.
Example Usage:
When to Use:
Optimizes the translation system by removing duplicates.
15. prestashop:update:configuration-file-hooks-listing
Purpose: Update the hook list in configuration files.
Example Usage:
When to Use:
Essential for module development to register new hooks.
16. prestashop:update:sql-upgrade-file-hooks-listing
Purpose: Update the hook list in SQL upgrade files.
Example Usage:
When to Use:
Used during store updates involving database changes.
PrestaShop console commands are a powerful tool for developers and administrators. They simplify store management, automate tasks, and ensure the store runs smoothly.
Share Your Thoughts:
- Which command do you find the most useful?
- Would you like more examples for specific tasks?