[-] FO : BugFix : #PSCFV-2099 : Block reinsurance doesn't appear in front office (style was not loaded + install fixtures)

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@15034 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
vChabot
2012-05-03 09:37:42 +00:00
parent effe71e913
commit f9892ed7cd
2 changed files with 31 additions and 5 deletions
+26 -5
View File
@@ -47,7 +47,9 @@ class Blockreinsurance extends Module
public function install()
{
return (parent::install() && $this->installDB() && Configuration::updateValue('blockreinsurance_nbblocks', 5) && $this->registerHook('footer'));
$return = (parent::install() && $this->installDB() && Configuration::updateValue('blockreinsurance_nbblocks', 5) && $this->registerHook('footer'));
$return &= $this->installFixtures();
return $return;
}
public function installDB()
@@ -188,15 +190,34 @@ class Blockreinsurance extends Module
public function hookFooter($params)
{
global $smarty;
$infos = $this->getAllFromDB();
global $smarty;
$this->context->controller->addCSS($this->_path.'style.css', 'all');
$infos = $this->getAllFromDB();
$smarty->assign(array(
'nbblocks' => Configuration::get('blockreinsurance_nbblocks'),
'infos' => $infos
));
return $this->display(__FILE__, 'blockreinsurance.tpl');
}
public function installFixtures()
{
$nb_blocks = Configuration::get('blockreinsurance_nbblocks');
$tab_texts = array(
$this->l('Money back'),
$this->l('Exchange in-store'),
$this->l('Payment for shipping'),
$this->l('Free Shipping'),
$this->l('100% secured payment'),
);
$success = true;
for ($a = 1; $a <= $nb_blocks; $a++)
$success &= Db::getInstance()->execute('
INSERT INTO `'._DB_PREFIX_.'reinsurance` (`filename`, `text`)
VALUES ("reassurance'.$a.'", "'.$tab_texts[($a-1)].'")');
return $success;
}
}
?>