Blog navigation keyboard_arrow_down

Blog Rss rss_feed

PrestaShop Console Commands: Description, Examples, and Purpose

PrestaShop Console Commands: Description, Examples, and Purpose

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):

bin/console prestashop:config set PS_SHOP_ENABLE 0

To get the current value of a parameter:

bin/console prestashop:config get PS_SHOP_ENABLE

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:
    bin/console prestashop:debug on
  • Turn debug mode off:
    bin/console prestashop:debug off
  • Check current debug mode status:
    bin/console prestashop:debug

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:

bin/console prestashop:licenses:update

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:

bin/console prestashop:linter:legacy-link

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:

bin/console prestashop:linter:naming-convention

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:

bin/console prestashop:linter:security-annotation

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:

bin/console prestashop:list:commands-and-queries

When to Use:
Quickly access a complete toolset for managing your store.


8. prestashop:mail:generate

Purpose: Generate email templates.

Example Usage:

bin/console prestashop:mail:generate

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:
    bin/console prestashop:module install <module_name>
  • Uninstall a module:
    bin/console prestashop:module uninstall <module_name>

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:

bin/console prestashop:schema:update-without-foreign

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:

bin/console prestashop:taxes:update-eu-tax-rule-groups

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:

bin/console prestashop:theme:enable <theme_name>

When to Use:
Apply a new theme after installation.


13. prestashop:theme:export

Purpose: Export a theme to an archive file.

Example Usage:

bin/console prestashop:theme:export <theme_name>

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:

bin/console prestashop:translation:find-duplicates

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:

bin/console prestashop:update:configuration-file-hooks-listing

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:

bin/console prestashop:update:sql-upgrade-file-hooks-listing

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?

Was this blog post helpful to you?

    
No comments at this moment
close

Checkout

close

Favourites