Jump to content

Surcharger un controller dans un module


Recommended Posts

Bonjour,

 

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 : 

 

/modules/mon_module/override/controllers/front/CmsController.php

 

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

 

Merci

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

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...

Important Information

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