stratboy Posted August 14, 2013 Share Posted August 14, 2013 (edited) Hi. I'd like to find a way to let all the Modules know PS_SHOP_DOMAIN. In other words, a way to make a smarty variable with PS_SHOP_DOMAIN value be available for all modules. I thought I could extend the ModuleCore class, but being it an abstract class I'm not really sure, and also I don't know in what method I should assign the smarty var. Any suggestion? Edited August 14, 2013 by stratboy (see edit history) Link to comment Share on other sites More sharing options...
stratboy Posted August 14, 2013 Author Share Posted August 14, 2013 (edited) Done by overriding FrontController::init(). Here's the code: Class FrontController extends FrontControllerCore{ public function init(){ parent::init(); $this->context->smarty->assign('shop_domain', Configuration::get('PS_SHOP_DOMAIN')); } public function initContent(){ //here you can eventually assign other things like custom hooks (I often do it). But init() is the right place to add 'global' smarty variables. parent::initContent(); } } This way $shop_domain will be available not only for every module in every hook, but more generally to all front-end .tpl files. Hope it helps Edited August 14, 2013 by stratboy (see edit history) 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