prestashop_newuser Posted August 14, 2013 Share Posted August 14, 2013 Hi, I am just newbie to prestashop. I am doing a module. In that the module install part is public function install() { if(!parent::install()) return false; if (!$this->registerHook('leftColumn')) return false; if (!$this->registerHook('header')) return false; if (!$this->registerHook('rightColumn')) return false; } In that module I have done add, edit and delete for store contact info. Now I have a function named as public function hookHome($params) where I have assigned smart file(.tpl) with the module name and I want to show that tpl file should come in home page. for that I have my function is like this public function hookHome($params) { $defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT')); global $cookie, $smarty; $sql_select="SELECT DISTINCT country_name,country_ISO from "._DB_PREFIX_."storeinfo where status='1'"; $value=Db::getInstance()->ExecuteS($sql_select); print_r($result); while($row=mysql_fetch_assoc($result)) { $value[] = $row; } $smarty->assign('array',$value); $smarty->assign('default',$defaultLanguage); return $this->display(__FILE__, 'storeinfo.tpl'); } But here I can't able to send the values to .tpl file. Can someone kindly tell me what's the issue here? Link to comment Share on other sites More sharing options...
vekia Posted August 14, 2013 Share Posted August 14, 2013 so you wanted to say that variables: {$array} {$default} don't work in your theme file? can you put there {debug} and then you will see popup with all available variables in the .tpl file your new variables appear on the list? Link to comment Share on other sites More sharing options...
prestashop_newuser Posted August 14, 2013 Author Share Posted August 14, 2013 yes..can you tell me how to debug the values in template file? so you wanted to say that variables: {$array} {$default} don't work in your theme file? can you put there {debug} and then you will see popup with all available variables in the .tpl file your new variables appear on the list? Hi, I am just newbie to prestashop. I am doing a module. In that the module install part is public function install() { if(!parent::install()) return false; if (!$this->registerHook('leftColumn')) return false; if (!$this->registerHook('header')) return false; if (!$this->registerHook('rightColumn')) return false; } In that module I have done add, edit and delete for store contact info. Now I have a function named as public function hookHome($params) where I have assigned smart file(.tpl) with the module name and I want to show that tpl file should come in home page. for that I have my function is like this public function hookHome($params) { $defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT')); global $cookie, $smarty; $sql_select="SELECT DISTINCT country_name,country_ISO from "._DB_PREFIX_."storeinfo where status='1'"; $value=Db::getInstance()->ExecuteS($sql_select); print_r($result); while($row=mysql_fetch_assoc($result)) { $value[] = $row; } $smarty->assign('array',$value); $smarty->assign('default',$defaultLanguage); return $this->display(__FILE__, 'storeinfo.tpl'); } But here I can't able to send the values to .tpl file. Can someone kindly tell me what's the issue here? Link to comment Share on other sites More sharing options...
vekia Posted August 14, 2013 Share Posted August 14, 2013 just put into your template file {debug} variable Link to comment Share on other sites More sharing options...
prestashop_newuser Posted August 14, 2013 Author Share Posted August 14, 2013 just put into your template file {debug} variable No its not showing anything.. I just did {$array|@print_r} Link to comment Share on other sites More sharing options...
vekia Posted August 14, 2013 Share Posted August 14, 2013 okay, but in this case |print_r only show the contents of the variable. If there is no contents - then it will show nothing. What i wanted is to check if this variable is defined. In this case, you need to use {debug} - you will see all smarty template variables, even if they are empty. hope that you understand my point of view Link to comment Share on other sites More sharing options...
prestashop_newuser Posted August 14, 2013 Author Share Posted August 14, 2013 okay, but in this case |print_r only show the contents of the variable. If there is no contents - then it will show nothing. What i wanted is to check if this variable is defined. In this case, you need to use {debug} - you will see all smarty template variables, even if they are empty. hope that you understand my point of view Yes I understand that and I used {debug} in my .tpl file but it did not showed anything...I think my tpl file is not properly assigned with home page? Link to comment Share on other sites More sharing options...
vekia Posted August 14, 2013 Share Posted August 14, 2013 it's because in your install function: if(!parent::install()) return false; if (!$this->registerHook('leftColumn')) return false; if (!$this->registerHook('header')) return false; if (!$this->registerHook('rightColumn')) return false; } you don't have registerhook('home') 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