* @copyright 2007-2010 Prestashop SA * @version Release: $Revision: 1.4 $ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 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 infos'); $this->description = $this->l('Add a block to add some informations about contacting the shop'); } public function install() { return (parent::install() AND Configuration::updateValue('blockcontactinfos_company', Configuration::get('PS_SHOP_NAME')) AND Configuration::updateValue('blockcontactinfos_address', '') AND Configuration::updateValue('blockcontactinfos_phone', '') AND Configuration::updateValue('blockcontactinfos_email', Configuration::get('PS_SHOP_EMAIL')) AND $this->registerHook('footer')); } public function uninstall() { //Delete configuration return (Configuration::deleteByName('blockcontactinfos_company') AND Configuration::deleteByName('blockcontactinfos_address') AND Configuration::deleteByName('blockcontactinfos_phone') AND Configuration::deleteByName('blockcontactinfos_email') AND parent::uninstall()); } public function getContent() { // If we try to update the settings if (isset($_POST['submitModule'])) { Configuration::updateValue('blockcontactinfos_company', ((isset($_POST['company']) AND $_POST['company'] != '') ? $_POST['company'] : Configuration::get('PS_SHOP_NAME'))); Configuration::updateValue('blockcontactinfos_address', ((isset($_POST['address']) AND $_POST['address'] != '') ? $_POST['address'] : '')); Configuration::updateValue('blockcontactinfos_phone', ((isset($_POST['phone']) AND $_POST['phone'] != '') ? $_POST['phone'] : '')); Configuration::updateValue('blockcontactinfos_email', ((isset($_POST['email']) AND $_POST['email'] != '') ? $_POST['email'] : Configuration::get('PS_SHOP_EMAIL'))); echo '
'.$this->l('Configuration updated').'