Jump to content

How do you use overrides in Prestashop 1.4?


Recommended Posts

Hello,

I wanted to modify the content of blockuserinfo module without actually modifying the original files.
What I did was:
* create /override/modules/ directory
* copy the original /blockuserinfo/ directory to the one created
* modify /override/modules/blockuserinfo/blockuserinfo.php and .tpl files

Unfortunately those changes don't show up in Prestashop, the original files are still being read.
Is there anything I should do differently?

Prez

Link to comment
Share on other sites

If I just want to modify the tpl file I usually add a folder to my theme folder and add the module folder there and add the tpl file. So for you it would be root/themes/yourtheme/modules/blockuserinfo/. Only problem is that it will only read the tpl file and nothing else.

I have been wondering how the new overrides work myself so hopefully some will come along and shoe us.

Link to comment
Share on other sites

Thank you for the answer - that makes sense, though I would really like to see the possibility of also overriding actual .php files (for instance, I would need to move said blockuserinfo.php over to leftColumn position and that's not possible without making some modifications to the php file).

Link to comment
Share on other sites

maybe I am wrong.
My understanding is that the override folder is only used for overwriting the core classes and controller classes.
Hope someone could give some detailed information, or even just point out where to find this information, it will great help.

Link to comment
Share on other sites

  • 1 month later...

If _THEME_DIR_/modules/blockheadmodule/blockheadmodule.tpl exists, the app loads it.
When no copy of a given tpl exists in the "theme" path, the app falls back to using the module tpl pathed under modules/


Hello, i experience the same problem as jhnstcks does.

When i try to override a template in myTheme/modules/foobar/foobar.tpl then the page output is only the contents of the module override template and nothing more!! I have yet to find a proper instruction or documentation on this... so maybe i'm doing something wrong here...

Can anyone clearly state how module template overriding works in 1.4.1 ? I'd really appreciate all help i can get because i'm at a loss here :-(
Link to comment
Share on other sites

page output is only the contents of the module override template and nothing more!

what do you mean by this? do you mean your page other contents is gone?
if you there might be some errors occur. try set "display_errors" to 'on' in the file /config/config.inc.php to see if you can see any errors.

also if you could post your URL here or a screenshot, it might easy for others to understand
Link to comment
Share on other sites

Huh, found the culprit!
Turns out that smarty encountered an error 'cause it was trying to find other tpl files needed in the module.
To be more precise, i was trying to override tpl of blockcategories in prestashop 1.4.1 (silly of me while having displayerror=off).
I only wanted to change the heading of the block so i only copied blockcategories.tpl to myTheme/modules/blockcategories.
Smarty generated a (silent) error of not being able to find category-tree-branch.tpl and that caused the site to render only blockcategories.tpl html.
When i copied both files to myTheme/modules/blockcategories, the problem was solved.
Thanks shokinro for pointing out to have prestashop displaying the errors and i think that this has to be stated in future documentation (unless it's a buggy behavior)

Link to comment
Share on other sites

×
×
  • Create New...