evolution.x Posted September 5, 2013 Share Posted September 5, 2013 Hi, Is it possible to add a new custom hook to an existing TPL file in a theme? I am trying to add a newly created hook call to category.tpl without actually editing the TPL. I have created a module which creates the new hook and now need the module to put the hook in to category.tpl ?? Is there any override i can do to the TPL or a dynamic load? Any help on this would be great. Link to comment Share on other sites More sharing options...
vekia Posted September 5, 2013 Share Posted September 5, 2013 it is necessary to modify the .tpl file to run hook there. there is no other way to achieve what you want. especially because merchants can use different themes, so what then? if the code is totally different than default one? it's necessary to edit it menually. Link to comment Share on other sites More sharing options...
evolution.x Posted September 5, 2013 Author Share Posted September 5, 2013 Thanks for your input vekia, I am trying to create a breadcrumb module with BO configuration, this would need to add it's own hook in to all the relevant TPL files which currently display the breadcrumb by an include. {include file="$tpl_dir./breadcrumb.tpl"} As far as i know every prestashop theme calls the breadcrumb by the include above, is there any way i could use jquery or similar to swap / replace this breadcrumb include to my hook? Replace: {include file="$tpl_dir./breadcrumb.tpl"} With: {$MY_CUSTOM_HOOK} Link to comment Share on other sites More sharing options...
vekia Posted September 5, 2013 Share Posted September 5, 2013 well, you can do it with php, but it will be a bit risky with php - you can load contents of theme category.tpl file and change {include file="$tpl_dir./breadcrumb.tpl"} to {$MY_CUSTOM_HOOK} Link to comment Share on other sites More sharing options...
evolution.x Posted September 5, 2013 Author Share Posted September 5, 2013 That make sense but i have no clue how to do that? Could you be so kind to point me in the right direction so i can at least try it Link to comment Share on other sites More sharing options...
vekia Posted September 5, 2013 Share Posted September 5, 2013 you know basics in php? (open file contents, change it with str_replace and overwrite file) ? 1 Link to comment Share on other sites More sharing options...
evolution.x Posted September 5, 2013 Author Share Posted September 5, 2013 Thank you for your help vekia i will try it Why do you say "Risky" ? Regards Link to comment Share on other sites More sharing options...
vekia Posted September 5, 2013 Share Posted September 5, 2013 i said about little risk, because it will not work when someone will use non-default theme with different way to display breadcrumb. 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