Skip to content

Commit

Permalink
Update links and content for ModuleFrontControllers
Browse files Browse the repository at this point in the history
  • Loading branch information
Quetzacoalt91 committed Jul 13, 2020
1 parent e3ebca2 commit 8c12e54
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Expand Up @@ -250,7 +250,9 @@ class ExampleModuleCronModuleFrontController extends ModuleFrontController
}
```

This controller can now be triggered by creating a PHP file that initiates the route to the controller, then includes the index.php at the root of PrestaShop in order to init the dispatcher and your controller:
This controller can now be triggered by creating a PHP file that initiates the route to the controller, then includes the index.php at the root of PrestaShop in order to init the dispatcher and your controller.

This kind of script is also useful if a standalone PHP script interacting with PrestaShop has been migrated to a ModuleFrontController. The URLs to call would change by moving into a Controller, but the old one would be still accessible with this workaround.

**modules/examplemodule/cron.php**

Expand Down
6 changes: 5 additions & 1 deletion src/content/1.7/modules/sell/techvalidation-checklist.md
Expand Up @@ -136,7 +136,11 @@ Having the module name as a prefix will reduce the risk of colision between clas
All the AJAX and CRON files must be protected with a unique and secured token to avoid any security issues (outside attacks,...).
Even the front controllers must be secured with a secured token when you use AJAX in it.

AJAX and CRON scripts must be placed in a controller ([More details]({{< ref "1.7/modules/concepts/controllers#php-scripts-not-going-through-the-prestashop-or-symfony-dispatcher" >}})).
AJAX and CRON scripts must be placed in a controller and not in a separate script to call on its own.
For more details:

* [Documentation]({{< ref "1.7/modules/concepts/controllers/front-controllers" >}}#using-a-front-controller-as-a-cron-task)
* [Original issue leading to the use of ModuleFrontControllers](https://github.com/PrestaShop/PrestaShop/issues/14648)

#### Code in hook is run only when needed

Expand Down

0 comments on commit 8c12e54

Please sign in to comment.