Skip to content
This repository was archived by the owner on Feb 3, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
2016-08-12 14:55:00 +0200 // Add website field
2014-04-22 18:57:06 +0200 // Changelog updated
2014-03-24 11:43:28 +0100 / MO blockcontactinfos : ps_versions_compliancy modified (1.5.6.1 => 1.6)
2014-03-24 11:01:54 +0100 // MO blockcontactinfos/ : ps_versions_compliancy added
Expand Down
22 changes: 15 additions & 7 deletions blockcontactinfos.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,20 @@

* @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
{
protected static $contact_fields = array(
'BLOCKCONTACTINFOS_COMPANY',
'BLOCKCONTACTINFOS_ADDRESS',
'BLOCKCONTACTINFOS_PHONE',
'BLOCKCONTACTINFOS_EMAIL',
'BLOCKCONTACTINFOS_WEBSITE',
);

public function __construct()
Expand All @@ -45,7 +47,7 @@ public function __construct()
$this->version = '1.2.1';

$this->bootstrap = true;
parent::__construct();
parent::__construct();

$this->displayName = $this->l('Contact information block');
$this->description = $this->l('This module will allow you to display your e-store\'s contact information in a customizable block.');
Expand All @@ -58,6 +60,7 @@ public function install()
Configuration::updateValue('BLOCKCONTACTINFOS_ADDRESS', trim(preg_replace('/ +/', ' ', Configuration::get('PS_SHOP_ADDR1').' '.Configuration::get('PS_SHOP_ADDR2')."\n".Configuration::get('PS_SHOP_CODE').' '.Configuration::get('PS_SHOP_CITY')."\n".Country::getNameById(Configuration::get('PS_LANG_DEFAULT'), Configuration::get('PS_SHOP_COUNTRY_ID')))));
Configuration::updateValue('BLOCKCONTACTINFOS_PHONE', Configuration::get('PS_SHOP_PHONE'));
Configuration::updateValue('BLOCKCONTACTINFOS_EMAIL', Configuration::get('PS_SHOP_EMAIL'));
Configuration::updateValue('BLOCKCONTACTINFOS_WEBSITE', Configuration::get('PS_SHOP_WEBSITE'));
$this->_clearCache('blockcontactinfos.tpl');
return (parent::install() && $this->registerHook('header') && $this->registerHook('footer'));
}
Expand All @@ -73,7 +76,7 @@ public function getContent()
{
$html = '';
if (Tools::isSubmit('submitModule'))
{
{
foreach (Blockcontactinfos::$contact_fields as $field)
Configuration::updateValue($field, Tools::getValue($field));
$this->_clearCache('blockcontactinfos.tpl');
Expand All @@ -87,15 +90,15 @@ public function hookHeader()
{
$this->context->controller->addCSS(($this->_path).'blockcontactinfos.css', 'all');
}

public function hookFooter($params)
{
{
if (!$this->isCached('blockcontactinfos.tpl', $this->getCacheId()))
foreach (Blockcontactinfos::$contact_fields as $field)
$this->smarty->assign(strtolower($field), Configuration::get($field));
return $this->display(__FILE__, 'blockcontactinfos.tpl', $this->getCacheId());
}

public function renderForm()
{
$fields_form = array(
Expand Down Expand Up @@ -125,13 +128,18 @@ public function renderForm()
'label' => $this->l('Email'),
'name' => 'BLOCKCONTACTINFOS_EMAIL',
),
array(
'type' => 'text',
'label' => $this->l('Website'),
'name' => 'BLOCKCONTACTINFOS_WEBSITE',
),
),
'submit' => array(
'title' => $this->l('Save')
)
),
);

$helper = new HelperForm();
$helper->show_toolbar = false;
$helper->table = $this->table;
Expand Down
7 changes: 7 additions & 0 deletions blockcontactinfos.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@
{if $blockcontactinfos_address != ''}<li>{$blockcontactinfos_address|escape:'html':'UTF-8'|nl2br}</li>{/if}
{if $blockcontactinfos_phone != ''}<li>{l s='Tel' mod='blockcontactinfos'} {$blockcontactinfos_phone|escape:'html':'UTF-8'}</li>{/if}
{if $blockcontactinfos_email != ''}<li>{l s='Email:' mod='blockcontactinfos'} {mailto address=$blockcontactinfos_email|escape:'html':'UTF-8' encode="hex"}</li>{/if}
{if $blockcontactinfos_website != ''}
<li>{l s='Contact:' mod='blockcontactinfos'}
<a href="{$blockcontactinfos_website|escape:'html':'UTF-8'}" title="{l s='Contact' mod='blockcontactinfos'}">
{$blockcontactinfos_website|escape:'html':'UTF-8'}
</a>
</li>
{/if}
</ul>
</div>
<!-- /MODULE Block contact infos -->