Jump to content

Surcharger un controller dans un module

Recommended Posts



Je suis en train d'apprendre à créer des modules prestashop afin d'y apporter ma contribution à la communauté.


Mon problème est que je n'arrive pas à surcharger le classe CmsControllerCore.

Si j'ai bien lu la documentation, je dois créer un fichier : 




Le problème est que j'ai l'impression que ce fichier n'est pas appelé (j'ai fais un simple "Hello World" dedans)


Pouvez vous me dire où est mon erreur ?

Voici le lien : http://wordpress-job.com/ps/jojo.zip



Edited by mr bob (see edit history)

Share this post

Link to post
Share on other sites

if you can you should avoid overrides and try other ways to do things, anyway an override should alway have a class, for example to override the front cms controller you need to do something like this:

class CmsController extends CmsControllerCore {
   //your overridden functions here

you should open the base CmsControllerCore to see what function you can override.

remember that only 1 override can exist in prestashop for the same function so if another module is overriding it your module will not install.

If you can, avoid overrides!


another thing is that the module override is installed when you install the module, so if you added the override after installing I don't think it will work..


ps: this is the english section of the forums :)

Share this post

Link to post
Share on other sites

Read the doc:

Q: I added an override file but it seems to be ignored by PrestaShop
A: You need to trigger the regeneration of the /cache/class_index.php file. This is done simply by deleting the file. It is the same when manually removing an override: in order to reinstate the default behavior, you must delete the /cache/class_index.php file.

Share this post

Link to post
Share on other sites

This topic is now closed to further replies.

  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More