* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ if (!defined('_CAN_LOAD_FILES_')) exit; class Blockcontactinfos extends Module { public function __construct() { $this->name = 'blockcontactinfos'; if (version_compare(_PS_VERSION_, '1.4.0.0') >= 0) $this->tab = 'front_office_features'; else $this->tab = 'Blocks'; $this->version = '1.0'; parent::__construct(); $this->displayName = $this->l('Block contact info'); $this->description = $this->l('This module will allow you to display your e-store\'s contact information in a customizable block.'); } public function install() { return (parent::install() && Configuration::updateValue('blockcontactinfos_company', Configuration::get('PS_SHOP_NAME')) && Configuration::updateValue('blockcontactinfos_address', '') && Configuration::updateValue('blockcontactinfos_phone', '') && Configuration::updateValue('blockcontactinfos_email', Configuration::get('PS_SHOP_EMAIL')) && $this->registerHook('header') && $this->registerHook('footer')); } public function uninstall() { //Delete configuration return (Configuration::deleteByName('blockcontactinfos_company') && Configuration::deleteByName('blockcontactinfos_address') && Configuration::deleteByName('blockcontactinfos_phone') && Configuration::deleteByName('blockcontactinfos_email') && parent::uninstall()); } public function getContent() { $html = ''; // If we try to update the settings if (isset($_POST['submitModule'])) { Configuration::updateValue('blockcontactinfos_company', ((isset($_POST['company']) && $_POST['company'] != '') ? $_POST['company'] : Configuration::get('PS_SHOP_NAME'))); Configuration::updateValue('blockcontactinfos_address', ((isset($_POST['address']) && $_POST['address'] != '') ? $_POST['address'] : '')); Configuration::updateValue('blockcontactinfos_phone', ((isset($_POST['phone']) && $_POST['phone'] != '') ? $_POST['phone'] : '')); Configuration::updateValue('blockcontactinfos_email', ((isset($_POST['email']) && $_POST['email'] != '') ? $_POST['email'] : Configuration::get('PS_SHOP_EMAIL'))); $this->_clearCache('blockcontactinfos.tpl'); $html .= '