Nishith Nesdiya Posted September 8, 2013 Share Posted September 8, 2013 hi friends i am creating the custom modules. i need override the product.tpl file in my custom modules and a add new data via mycustom query how to override the product.tpl fil in mycustom modules... any one help me .........thanks Link to comment Share on other sites More sharing options...
vekia Posted September 8, 2013 Share Posted September 8, 2013 unfortunately you can't override theme template file by module Link to comment Share on other sites More sharing options...
Nishith Nesdiya Posted September 9, 2013 Author Share Posted September 9, 2013 thanks..your answer any alternate solution of this problems Link to comment Share on other sites More sharing options...
vekia Posted September 9, 2013 Share Posted September 9, 2013 can you say something more what you want to achievie? it will be much easier to suggest what you have to do btw. It isn't possible because someone can use different theme (non-default) so when you will override this file you will crash the theme Link to comment Share on other sites More sharing options...
Nishith Nesdiya Posted September 9, 2013 Author Share Posted September 9, 2013 (edited) yes vekia i need to add the product video and its set the cover image of product Edited September 9, 2013 by Nishith Nesdiya (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted September 9, 2013 Share Posted September 9, 2013 so you want to remove default "cover" (image) ? i think that you can do a little trick with jquery in productFooter create div with your video for example: <div id="myproductvideo">VIDEO HERE</div> add there also script with jquery function to move myproductvideo div to the image cover DOM element. you can do it easily with jquery with script like $('DOM_ELEMENT').html($('#myproductvideo').html()); where DOM_ELEMENT is a place where you want to display video no overrides - no worries 3 Link to comment Share on other sites More sharing options...
Nishith Nesdiya Posted September 9, 2013 Author Share Posted September 9, 2013 thanks vekia... Link to comment Share on other sites More sharing options...
thefyrehead Posted June 4, 2014 Share Posted June 4, 2014 Hi, I just wanted to expand a little on customizing a theme without changing TPL ? What is the best practice when upgrading a theme yet wanting to retain existing changed when it comes to the TPL files ? Link to comment Share on other sites More sharing options...
vekia Posted June 4, 2014 Share Posted June 4, 2014 it's not possible to change theme without chaning .tpl files template = .tpl files 1 Link to comment Share on other sites More sharing options...
thefyrehead Posted June 4, 2014 Share Posted June 4, 2014 First of all thank you. OK that's what I thought. The real question is : When I download a theme and it gets updated, how can I benefit from new features without comparing each line of code ? For CSS it's easy I import my file last. But for the rest... Link to comment Share on other sites More sharing options...
helloworlder Posted October 26, 2015 Share Posted October 26, 2015 (edited) Old thread but someone might find this useful while Googling. Actually, it is possible to "override" the theme product.tpl file from your module. Your module needs to override the ProductController.php file. You need to look for the setTemplate() call in the init() function, and you can change the path of the template, which would reside somewhere in your module. If you upgrade Prestashop core, you have another overriden function you need to check and possibly revise, and you also need to make sure no other module is overriding the same function. Another method is to write some code that physically copies and pastes the .tpl file to the template when the module is installed, and then reverse what you did when the module is uninstalled (which means your code would need to have taken a backup of the original file). Either method is very simple and will work. Of course, I have made no assumptions of the big picture you are trying to achieve. These methods are fine for privately used modules. As long as you can keep track of your changes, you should be fine. However, if you are distributing these modules to the public, overriding the tpl file would likely break the theme as has been pointed out, because you do not know what theme they are using. Perhaps an advantage of not editing the theme directly means you can encapsulate your edits neatly inside modules only so you can turn the edits on and off via the control panel, or perhaps you have conditional code that will load a different template. A more philosophical argument is that by keeping all edits in modules only, it is always clear where your changes are so easier to manage, but I'm not convinced by that argument because VCS can easily tell you what files have been changed. If the choice was mine, I would edit the theme directly. Edited October 26, 2015 by helloworlder (see edit history) 2 Link to comment Share on other sites More sharing options...
kirubanidhi Posted December 23, 2016 Share Posted December 23, 2016 How to override template file from this path /var/html/prestashop/themes/default/addresses.tpl. I create a new module named as demo. I want to override base template file. Any one can help me. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now