Child pages
  • Creating a PrestaShop module

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • "Bootstrap" file: name_of_the_module.php
  • Cache configuration file: config.xml
  • Module-specific controllers, all in the /controllers sub-folder
  • Class-overriding code, all in the /override sub-folder (automatic install/uninstall using copy or merge)
  • View files: JavaScript, Models, CSS files, etc. From v1.5 onward, these files can be placed in sub-folders:
    • /views/css sub-folder for CSS files
    • /views/js sub-folder for JavaScript files
    • /views/templates/front sub-folder for files used by the module controller
    • /views/templates/hooks sub-folder for files used by the module's hooks
  • 16x16 module logo: name_of_the_module.jpg (JPG format)
  • 32x32 module logo: name_of_the_module.png (PNG format)
  • Translation files: fr.php, en.php, es.php, etc. From v1.5 onward, all these files can be placed in the /translations sub-folder.

Creating a first module

Let's create a simple first module; this will enable us to better describe its structure. We will call it "My module".

...

  • 'name' attribute. This attributes serves as an internal identifier, so try your best to make it unique, without special characters or spaces, and keep it lower-case. In effect, the value MUST be the name of the module's folder.
  • 'tab' attribute. The title for the section that shall contain this module in PrestaShop's back-office modules list. You may use an existing name, such as seo, front_office_features or analytics_stats, or a custom one. In this last case, a new section will be created with your identifier. We chose "front_office_features" because this first module will mostly have an impact on the front-end.

    Here is the list of available "Tab" attributes, and their corresponding section in the "Modules" page:

    "Tab" attributeModule section
    administrationAdministration
    advertising_marketingAdvertising & Marketing
    analytics_statsAnalytics & Stats
    billing_invoicingBilling & Invoices
    checkoutCheckout
    content_managementContent Management
    emailingE-mailing
    exportExport
    front_office_featuresFront Office Features
    i18n_localizationI18n & Localization
    market_placeMarket Place
    merchandizingMerchandizing
    migration_toolsMigration Tools
    mobileMobile
    othersOther Modules
    payments_gatewaysPayments & Gateways
    payment_securityPayment Security
    pricing_promotionPricing & Promotion
    quick_bulk_updateQuick / Bulk update
    search_filterSearch & Filter
    seoSEO
    shipping_logisticsShipping & Logistics
    slideshowsSlideshows
    smart_shoppingSmart Shopping
    social_networksSocial Networks
  • 'version' attribute. The version number for the module, displayed in the modules list. It is a string, so that you may use such variation as "1.0b", "3.07 beta 3" or "0.94 (not for production use)".
  • 'author' attribute. This is displayed as is in the PrestaShop modules list.

...