Customising Prestashop Module Templates

Creative Commons Licence

Please don’t edit those originals!

I came across this little gem a while ago on the Prestashop forum, and thought I would draw attention to it in the hopes that it will help someone, somewhere.

I’m not one to complain, but my pet hate is folks who edit the original source files on their stores, when there’s no need to. It bugged me in Zen Cart when people happily modified the “classic” and “default” template files, then wondered why it was difficult to upgrade… and lo and behold folks started doing the same thing to the Prestashop default theme too. Aaaargh!! How hard is it to make a copy, rename it and edit that version instead?

Where my purist instincts failed however, way back in the bad old days, was when it came to the .tpl files that were stored in the module directories themselves — there seems like there’s no choice but to edit them if you want to customise the output for your store — or is there!

The answer is surprisingly simple, and will make you nod your head in grateful appreciation… all you need to do is create a modules/ directory in your custom theme directory (well you aren’t going to be working in the default theme directory now are you), copy the original .tpl from the module directory into it and edit away to your heart’s content.

As an example, you can take the template file from the blockadvertising module (blockadvertising.tpl) and make a copy under /themes/mycooltheme/modules/blockadvertising. Now modify the copy of the original that looked like:

<!-- MODULE Block advertising -->
<div class="advertising_block">
	<a href="" title="{l s='Advertising' mod='blockadvertising'}"><img src="{$image}" alt="{l s='Advertising' mod='blockadvertising'}" /></a>
<!-- /MODULE Block advertising -->


<!-- My MODULE Block advertising -->
<div class="advertising_block">
	<a href="" title="{l s='Advertising' mod='blockadvertising'}"><img src="{$image}" alt="{l s='A fantastic site for Prestashop goodies' mod='blockadvertising'}" /></a>
<!-- /My MODULE Block advertising -->

Pure joy! Although the observant will notice that unless you edit the {$image} variable and place a static path to your graphic in its place, then you’ll have to change the picture in the module directory…. well you can’t have it all I guess.

Sharing is caring!

Posted on August 6, 2009 | Related Categories: Tips and Tricks | 12 comments

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

12 Responses to Customising Prestashop Module Templates

  1. Paul says:

    This is a useful, confirming article, so thank you, but why the aggressive style? It would have been so much better received with an opener such as “.. I’d like to share..” (i.e. since I am fortunate enough to understand) rather than “My pet hate..” and “Aaaargh!! How hard is it to..”.

    We are all experts in some areas and naive in others.

  2. Stefek says:


    thank you for this valueable Information.
    Took me a while to find the right keywords on google…

    After reading this I am just supprised by the sophisticated concept of templating in PS.

    Thanks a lot for your explanations.

  3. Just started using prestashop today and wanted to say thank you for this post. I was searching everywhere to find a way to mod these files without touching the core.

  4. Dino says:

    Thanks a lot, YES, your blog DID help someone somewhere =D MOST APPRECIATED and I totally understand your frustration of idiots who change original files lol ^.^

  5. David says:

    I get it ! as I said, while you duplicate module tpl’s, just copy the lang files you need as the same way, then we don’t care about the tokens (just an id of the default english string), here is one line of translation :
    $_MODULE['blocknewproducts_f7c34fc4a48bc683445c1e7bbc245508'] = ‘Bloc nouveaux produits’;

    in fact, for this translation works in your theme dir, just find/replace all ‘}prestashop>’ by ‘}my_theme_dir>’
    that’s all folks…you can done it for all files of your theme dir, so now it’s easy to customize modules AND keep all translation done already…

  6. David says:

    Many thanks for the great tip, I dream it I get it !
    But like Jens, now I am looking for a way to prevent empty translations files beeing created each time translations are updated, for each template module customized in my theme, …any idea ?
    Should be only be a trick in core detecting if theme path tpl : no file creation even if no file exist.
    While I am writing, I was thinking an easy way should be : when we dupplicate and customize a module tpl, we should copy the [lang].php file also…but there is a md5 token written by prestashop admin…so much work as to re-translate all :(
    It’s quite heavy, this way of modularity is definively a great way of dev but this translation problem just abort it…

  7. Jens says:

    Hi, and thanks for a great prestashop resource!
    I’m building a prestashop site with a lot of modules customized exactly like this. It works, at least for most modules. One thing that does NOT work though is the translation of the modules. When the modules resides in the /themes/mytheme/modules directory, each time I update a translation in the backend a new, empty languagefile is written to the customized folder. For example, in my copy of blockcart an empty se.php (for swedish) is created, overriding the correct (and updated!) one in the original modules/blockcart folder. The only way to solve this is by manually deleting all the empty languagefiles created in the custom module directories every time a translation is updated.
    Any ideas on how to solve this (really annoying) problem?

  8. Octavia says:

    I love your modules! Right now I’m Looking for someone to format the date in ALL areas of my prestashop. I believe it’s hard coded somewhere and I can’t find it. The date format is currently backwards in order history, emails and everywhere! The other problem I’m having is with selling downloads. I upload the file but when I do a test purchase.. it says the file is not found and gives me a looooong file name kosjd0uefpjef0934joasjdda or something similar to that. My site is and I just installed it on my server a few days ago. I’ve searched their forums, google and everywhere but nothing :( Who can tackle this beast? I know its something simple.. i’m just learning code etc.. Willing to pay a small fee.

  9. Bibi40k says:

    Hi, i created in my theme “/modules/blockcart” and copied the original files into there. i have modified “blockcart.php” and seems PS does not read it.
    What i did wrong, please help ?

  10. Pingback: Ultimate PrestaShop Toolkit – 50+ Resources | Es Developed - Fresh Website and Graphic Design

  11. Ken says:

    Thank you Paul. That inspired me a lot.

  12. David Niry says:

    Excellent ! I can’t believe I didn’t think of trying this myself earlier.

    I had settled on backing up the module templates with a .bak extension so I would know where I had made template changes when I went into a module directory, but this is a much nicer and cleaner solution. Thanks for the tip !