Prestashop: Provide reference usecase modules always up-to-date

Created on 28 May 2019  路  4Comments  路  Source: PrestaShop/PrestaShop

We should provide some reference modules that people can use as an example/reference/skeleton to build their modules.

Usecases I can think of:

  • carrier module
  • payment module
  • module that displays a block on FO
  • module that displays a block on BO
  • module that modifies login process (SSO ? )
  • module that adds fields to a form in BO

These modules should provide:

  • best practices about codestyle
  • what a good module should do or should'nt do
  • ideal folder structure
  • security best practices
  • explanations of what's going on under the hood (ex: uninstall process unregisters hooks automatically)
  • use software quality tools such as phpstan (see https://github.com/PrestaShop/php-coding-standards)
  • have a CI setup using Travis

We should update them for every minor version releases, in order to show new useful features for modules. So for 1.7.6 we should use Twig, Doctrine, new hooks, tests.

Doc tutorials about modules should refer to them

Improvement Modules To Do

Most helpful comment

Also, there is the validator which is able to generate modules: https://validator.prestashop.com/generator, and this old repository in which we can find another skeleton (from 2014): https://github.com/PrestaShop/module-generator

It looks like everybody had the same idea, but it is now time to merge everything in a single place instead of creating something else new. :)
Let me know if I can help.

All 4 comments

Cc @Matt75 馃槈

This is something that @tomas862 had already started. https://github.com/Invertus/prestashop-module-skeleton

Great 馃コ

We will have some feedback during PSD Paris to define priority depends on top watchers.

For Payment Module, there are already https://github.com/PrestaShop/paymentexample who need some improvement to fit guideline defined here.

For Carrier Module, we have to explain how FrontController::registerJavascript() and first argument can help to not have multiple Google Maps included for example. Recurring problem since beginning of PrestaShop 馃槄
I think we should have something like PrestaShop\PrestaShop\Core\Payment\PaymentOption for Carrier, because some needs to select a pickup store etc... Currently this process is a real mess in order process due to missing guidelines...

Also, there is the validator which is able to generate modules: https://validator.prestashop.com/generator, and this old repository in which we can find another skeleton (from 2014): https://github.com/PrestaShop/module-generator

It looks like everybody had the same idea, but it is now time to merge everything in a single place instead of creating something else new. :)
Let me know if I can help.

Was this page helpful?
0 / 5 - 0 ratings