hannhimhe Posted November 27, 2011 Share Posted November 27, 2011 I read somewhere that I can override modules by putting them in /themes/<mytheme>/modules/<mymodule/. At some other place I read that I can only change layout, not the .php files as they will to override what's in /modules/<mymodule>/. Is it possible to override a modules .php-files or do I have to edit the files in /modules/<mymodule>/ and go back to apply the same "fix" every single time I upgrade PS? Link to comment Share on other sites More sharing options...
Dave L Posted November 27, 2011 Share Posted November 27, 2011 I think using overrides in this manner can only be done with .tpl files. I think to create an override with a .php file you need to do in the /overrides folder. I am only repeating what I believe to be the case from the posts I have read. I have no experience in doing so. Link to comment Share on other sites More sharing options...
hannhimhe Posted November 27, 2011 Author Share Posted November 27, 2011 I went ahead and edited the module. It would be great if I could override the modules .php-files. Link to comment Share on other sites More sharing options...
CartExpert.net Posted November 28, 2011 Share Posted November 28, 2011 Hello! Why don't you just edit the php file of the module? You should create a back up of the file before making the changes to it. Link to comment Share on other sites More sharing options...
hannhimhe Posted November 28, 2011 Author Share Posted November 28, 2011 Becuase I'm under the impression any future upgrades of PS will revert my changes and I will have to redo them. Link to comment Share on other sites More sharing options...
prestaZ Posted March 12, 2012 Share Posted March 12, 2012 I would like to do the same. For example, i want to create my own version of the horizontal menu, but i don't want to touch the original file. Logically, the modules under Themes folder should override those which are in Prestashop folder. So, I tried to copy from prestashop/modules to prestashop/themes/mytheme/modules and do the customization there, but the changes do not appear in front office (cache etc was emptied). Something is missing - what is it? Link to comment Share on other sites More sharing options...
El Patron Posted March 12, 2012 Share Posted March 12, 2012 Documentation of PS overrides http://forge.prestas...roller+Override and make sure to set smarty to forced compile if you want to see .tpl changes you are making. Link to comment Share on other sites More sharing options...
CartExpert.net Posted March 12, 2012 Share Posted March 12, 2012 I would like to do the same. For example, i want to create my own version of the horizontal menu, but i don't want to touch the original file. Logically, the modules under Themes folder should override those which are in Prestashop folder. So, I tried to copy from prestashop/modules to prestashop/themes/mytheme/modules and do the customization there, but the changes do not appear in front office (cache etc was emptied). Something is missing - what is it? You do know, that the override doesn't apply to php files? Link to comment Share on other sites More sharing options...
prestaZ Posted March 12, 2012 Share Posted March 12, 2012 Hallo, Thanks for replies. Sorry, I just started and I don't quite understand the issue with "overrides"... What I would like to do is to make my own version of a module - in my case horizontal menu. I tried to copy the module from Prestashop/modules to mytheme/modules and change there colors / backgrounds, but nothing happens. The menu only changes if I edit the files in the original folder under Prestashop/modules, which I would not like to touch. Can anybody help me? Yes, the force complie option is turned on. Link to comment Share on other sites More sharing options...
El Patron Posted March 12, 2012 Share Posted March 12, 2012 There is a decent amount of documentation to help you with module writing here. http://doc.prestashop.com/display/PS14/Developer+Guide Link to comment Share on other sites More sharing options...
prestaZ Posted March 12, 2012 Share Posted March 12, 2012 >elpatron, Thanks a lot for the links. Does this mean that you suggest to start a module from scratch? I looked at your first link, too. It says: "It couldn't be simpler, just do the following: /themes/prestashop/modules/my_module/my_module.tpl /themes/prestashop/css/modules/my_modules/my_module.css /themes/prestashop/js/modules/my_modules/my_module.js" That sounds pretty simple... So, I just copy the module and rename the files? But if I rename them, shouldn't I also change the links to the files within .php and .tpl files? Ugh, sorry, I'm really stuck here... Link to comment Share on other sites More sharing options...
El Patron Posted March 13, 2012 Share Posted March 13, 2012 >elpatron, Thanks a lot for the links. Does this mean that you suggest to start a module from scratch? I looked at your first link, too. It says: "It couldn't be simpler, just do the following: /themes/prestashop/modules/my_module/my_module.tpl /themes/prestashop/css/modules/my_modules/my_module.css /themes/prestashop/js/modules/my_modules/my_module.js" That sounds pretty simple... So, I just copy the module and rename the files? But if I rename them, shouldn't I also change the links to the files within .php and .tpl files? Ugh, sorry, I'm really stuck here... Prestashop uses relative links so if you copy the module and place the called files in the proper places you would not need to rename them. Link to comment Share on other sites More sharing options...
prestaZ Posted March 18, 2012 Share Posted March 18, 2012 Hello again, I spent another 5 days looking for a solution for how to apply styles out of the themes directory only - without any success.. It seems that it is not possible to override neither php files nor css files. How is it possible then to have a theme-specific layout?? How is everybody styling their own themes? Should I put all of my style into themes/mytheme/global.css?? Link to comment Share on other sites More sharing options...
El Patron Posted March 18, 2012 Share Posted March 18, 2012 Hello again, I spent another 5 days looking for a solution for how to apply styles out of the themes directory only - without any success.. It seems that it is not possible to override neither php files nor css files. How is it possible then to have a theme-specific layout?? How is everybody styling their own themes? Should I put all of my style into themes/mytheme/global.css?? Tools::addCSS(_THEME_CSS_DIR_.'YOURCSS.css'); change the directory of your css file and css file name and put in your module Link to comment Share on other sites More sharing options...
prestaZ Posted March 19, 2012 Share Posted March 19, 2012 elpatron, thank you very much following this topic - I am thankful for any hint I can get. As for your suggestion, could you be more specific? 1. Tools::addCSS(_THEME_CSS_DIR_.'YOURCSS.css') -> Where to put this? In blocktopmenu.php file? If so, should it be the php file under the root directory (original) or a copy of it under themes / mytheme / modules / blocktopmenu? I read somewhere that in order to override php files it is necessary to create some class overrides - ?... 2. change the directory of your css file and css file name ->So, for horizontal menu I have to rename it's CSS file from superfish-modified.css to e.g. superfish-modified1.css? I suppose it is better to make a copy? 3. and put in your module -> My module under themes / mytheme / modules / blocktopmenu? I am sorry for asking so much, but I am not familiar with PHP and Smarty. I just started with Prestashop some weeks ago and this subject is currently a real challenge. Hope you can help... Link to comment Share on other sites More sharing options...
El Patron Posted March 19, 2012 Share Posted March 19, 2012 Hi, an approach to creating new function is to change the files get it working and then build your module that will support those changes. The add Css code would need to go before actually using the css, it simply adds it to the array. For example look at frontcontroller php, that calls header.tpl which loads the css files. 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