Jump to content

Module Block Contact Infos On One Line


Recommended Posts

Hi all,

 

When I try to edit the block contact infos (the one in the footer) it puts all the info on one line in the footer.

 

So instead of:

 

Company name

[email protected]

phone

 

It shows as:

 

Company [email protected]

 

Can somebody tell me what to do?

 

I already deleted the module and installed it again but that doesn't work.

 

I'm using blockcontactinfos version 1.0, can't find a newer version.

 

Thanks in advance :)!

 

Block contact infos

 

Company name :

Address :

Phone number :

Email :

Link to comment
Share on other sites

Found the solution :D!

 

Replace whole blockcontactinfos.tpl in /modules or themes/#current theme#/modules with:

 

 

<!-- MODULE Block contact infos -->
<section id="block_contact_infos" class="block ">
<button id="contactNavButton" class="hidden nav-button">{l s='Contact us' mod='blockcontactinfos'}</button>
<h4 class="hideMobile">{l s='Contact us' mod='blockcontactinfos'}</h4>
<div id="contactNav" class="mobiFooterNav">{if $blockcontactinfos_company != ''}<strong>{$blockcontactinfos_company|escape:'htmlall':'UTF-8'}</strong>{/if}
{if $blockcontactinfos_address != ''}<div class="moreAddress">{$blockcontactinfos_address|regex_replace:"/[\n]/" : "<br />"}</div>{/if}
{if $blockcontactinfos_phone != ''}{l s='Tel:' mod='blockcontactinfos'} {$blockcontactinfos_phone|escape:'htmlall':'UTF-8'}<br />{/if}
{if $blockcontactinfos_email != ''}{mailto address=$blockcontactinfos_email|escape:'htmlall':'UTF-8' encode="hex"}{/if}
       </div>
</section>
<!-- /MODULE Block contact infos -->

  • Like 1
Link to comment
Share on other sites

  • 3 months later...

Google sent me here looking for a better blockcontactinfos module, so i just modified the module to improve it a bit, maybe is usefull for someone.

Added 2 extra fields for address, a field for fax number, and properly format the output in rows.

Just replace whole content of listed files:

 

blockcontactinfos.php

<?php
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <[email protected]>
*  @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_address_2', '')
&& Configuration::updateValue('blockcontactinfos_address_3', '')
&& Configuration::updateValue('blockcontactinfos_phone', '')
&& Configuration::updateValue('blockcontactinfos_fax', '')
&& 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_address_2')
&& Configuration::deleteByName('blockcontactinfos_address_3')
&& Configuration::deleteByName('blockcontactinfos_phone')
&& Configuration::deleteByName('blockcontactinfos_fax')
&& 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_address_2', ((isset($_POST['address_2']) && $_POST['address_2'] != '') ? $_POST['address_2'] : ''));
  Configuration::updateValue('blockcontactinfos_address_3', ((isset($_POST['address_3']) && $_POST['address_3'] != '') ? $_POST['address_3'] : ''));
  Configuration::updateValue('blockcontactinfos_phone', ((isset($_POST['phone']) && $_POST['phone'] != '') ? $_POST['phone'] : ''));
  Configuration::updateValue('blockcontactinfos_fax', ((isset($_POST['fax']) && $_POST['fax'] != '') ? $_POST['fax'] : ''));
  Configuration::updateValue('blockcontactinfos_email', ((isset($_POST['email']) && $_POST['email'] != '') ? $_POST['email'] : Configuration::get('PS_SHOP_EMAIL')));
  $this->_clearCache('blockcontactinfos.tpl');
  $html .= '<div class="conf confirm">'.$this->l('Configuration updated').'</div>';
 }
 $html .= '
 <h2>'.$this->displayName.'</h2>
 <form action="'.Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']).'" method="post">
  <fieldset>
<p><label for="company">'.$this->l('Company name').' :</label>
<input type="text" id="company" name="company" value="'.Tools::safeOutput(Configuration::get('blockcontactinfos_company')).'" /></p>
<p><label for="address">'.$this->l('Address').' :</label>
<textarea id="address" name="address" cols="60" rows="4">'.Tools::safeOutput(Configuration::get('blockcontactinfos_address')).'</textarea></p>
<p><label for="address">'.$this->l('Address (Row 2)').' :</label>
<textarea id="address" name="address_2" cols="60" rows="4">'.Tools::safeOutput(Configuration::get('blockcontactinfos_address_2')).'</textarea></p>
<p><label for="address">'.$this->l('Address (Row 3)').' :</label>
<textarea id="address" name="address_3" cols="60" rows="4">'.Tools::safeOutput(Configuration::get('blockcontactinfos_address_3')).'</textarea></p>
<p><label for="phone">'.$this->l('Phone number').' :</label>
<input type="text" id="phone" name="phone" value="'.Tools::safeOutput(Configuration::get('blockcontactinfos_phone')).'" /></p>
<p><label for="phone">'.$this->l('Fax number').' :</label>
<input type="text" id="phone" name="fax" value="'.Tools::safeOutput(Configuration::get('blockcontactinfos_fax')).'" /></p>
<p><label for="email">'.$this->l('Email').' :</label>
<input type="text" id="email" name="email" value="'.Tools::safeOutput(Configuration::get('blockcontactinfos_email')).'" /> </p>
<div class="margin-form">
 <input type="submit" name="submitModule" value="'.$this->l('Update settings').'" class="button" /></center>
</div>
  </fieldset>
 </form>
 ';

 return $html;
}

public function hookHeader()
{
 $this->context->controller->addCSS(($this->_path).'blockcontactinfos.css', 'all');
}

public function hookFooter($params)
{
 if (!$this->isCached('blockcontactinfos.tpl', $this->getCacheId()))
  $this->smarty->assign(array(
'blockcontactinfos_company' => Configuration::get('blockcontactinfos_company'),
'blockcontactinfos_address' => Configuration::get('blockcontactinfos_address'),
'blockcontactinfos_address_2' => Configuration::get('blockcontactinfos_address_2'),
'blockcontactinfos_address_3' => Configuration::get('blockcontactinfos_address_3'),
'blockcontactinfos_phone' => Configuration::get('blockcontactinfos_phone'),
'blockcontactinfos_fax' => Configuration::get('blockcontactinfos_fax'),
'blockcontactinfos_email' => Configuration::get('blockcontactinfos_email')
  ));
 return $this->display(__FILE__, 'blockcontactinfos.tpl', $this->getCacheId());
}
}
?>

 

blockcontactinfos.tpl

{*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <[email protected]>
*  @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
*}
<!-- MODULE Block contact infos -->
<div id="block_contact_infos">
<h4 class="title_block">{l s='Contact us' mod='blockcontactinfos'}</h4>
<ul>
 {if $blockcontactinfos_company != ''}<li><strong>{$blockcontactinfos_company|escape:'htmlall':'UTF-8'}</strong></li>{/if}
 {if $blockcontactinfos_address != ''}<li>{$blockcontactinfos_address|escape:'htmlall':'UTF-8'}</li>{/if}
 {if $blockcontactinfos_address_2 != ''}<li>{$blockcontactinfos_address_2|escape:'htmlall':'UTF-8'}</li>{/if}
 {if $blockcontactinfos_address_3 != ''}<li>{$blockcontactinfos_address_3|escape:'htmlall':'UTF-8'}</li>{/if}
 {if $blockcontactinfos_phone != ''}<li>{l s='Tel' mod='blockcontactinfos'} {$blockcontactinfos_phone|escape:'htmlall':'UTF-8'}</li>{/if}
 {if $blockcontactinfos_fax != ''}<li>{l s='Fax' mod='blockcontactinfos'} {$blockcontactinfos_fax|escape:'htmlall':'UTF-8'}</li>{/if}
 {if $blockcontactinfos_email != ''}<li>{l s='Email' mod='blockcontactinfos'} {mailto address=$blockcontactinfos_email|escape:'htmlall':'UTF-8' encode="hex"}</li>{/if}
</ul>
</div>
<!-- /MODULE Block contact infos -->

Edited by Sclerato (see edit history)
Link to comment
Share on other sites

  • 3 months later...

Just faced the same problem as all you guys and I found all these solution a bit hacky so I made my own:

Just add |nl2br to the address line. Then you will have a nice <br> added.

<!-- MODULE Block contact infos -->
<section id="block_contact_infos" class="block ">
<button id="contactNavButton" class="hidden nav-button">{l s='Contact us' mod='blockcontactinfos'}</button>
<h4 class="hideMobile">{l s='Contact us' mod='blockcontactinfos'}</h4>
<div id="contactNav" class="mobiFooterNav">{if $blockcontactinfos_company != ''}<strong>{$blockcontactinfos_company|escape:'htmlall':'UTF-8'}</strong>{/if}
{if $blockcontactinfos_address != ''}<div class="moreAddress">{$blockcontactinfos_address|escape:'htmlall'|nl2br:'UTF-8'}{/if}
{if $blockcontactinfos_phone != ''}{l s='Tel:' mod='blockcontactinfos'} {$blockcontactinfos_phone|escape:'htmlall':'UTF-8'}<br />{/if}
{if $blockcontactinfos_email != ''}{mailto address=$blockcontactinfos_email|escape:'htmlall':'UTF-8' encode="hex"}{/if}
        </div>
</section>
<!-- /MODULE Block contact infos -->
  • Like 3
Link to comment
Share on other sites

  • 2 weeks later...

Best solution I found so far. Easy, simple, quick!

 

Just faced the same problem as all you guys and I found all these solution a bit hacky so I made my own:

Just add |nl2br to the address line. Then you will have a nice <br> added.

<!-- MODULE Block contact infos -->
<section id="block_contact_infos" class="block ">
<button id="contactNavButton" class="hidden nav-button">{l s='Contact us' mod='blockcontactinfos'}</button>
<h4 class="hideMobile">{l s='Contact us' mod='blockcontactinfos'}</h4>
<div id="contactNav" class="mobiFooterNav">{if $blockcontactinfos_company != ''}<strong>{$blockcontactinfos_company|escape:'htmlall':'UTF-8'}</strong>{/if}
{if $blockcontactinfos_address != ''}<div class="moreAddress">{$blockcontactinfos_address|escape:'htmlall'|nl2br:'UTF-8'}{/if}
{if $blockcontactinfos_phone != ''}{l s='Tel:' mod='blockcontactinfos'} {$blockcontactinfos_phone|escape:'htmlall':'UTF-8'}<br />{/if}
{if $blockcontactinfos_email != ''}{mailto address=$blockcontactinfos_email|escape:'htmlall':'UTF-8' encode="hex"}{/if}
        </div>
</section>
<!-- /MODULE Block contact infos -->
  • Like 1
Link to comment
Share on other sites

  • 4 months later...

 

Just faced the same problem as all you guys and I found all these solution a bit hacky so I made my own:

Just add |nl2br to the address line. Then you will have a nice <br> added.

<!-- MODULE Block contact infos -->
<section id="block_contact_infos" class="block ">
<button id="contactNavButton" class="hidden nav-button">{l s='Contact us' mod='blockcontactinfos'}</button>
<h4 class="hideMobile">{l s='Contact us' mod='blockcontactinfos'}</h4>
<div id="contactNav" class="mobiFooterNav">{if $blockcontactinfos_company != ''}<strong>{$blockcontactinfos_company|escape:'htmlall':'UTF-8'}</strong>{/if}
{if $blockcontactinfos_address != ''}<div class="moreAddress">{$blockcontactinfos_address|escape:'htmlall'|nl2br:'UTF-8'}{/if}
{if $blockcontactinfos_phone != ''}{l s='Tel:' mod='blockcontactinfos'} {$blockcontactinfos_phone|escape:'htmlall':'UTF-8'}<br />{/if}
{if $blockcontactinfos_email != ''}{mailto address=$blockcontactinfos_email|escape:'htmlall':'UTF-8' encode="hex"}{/if}
        </div>
</section>
<!-- /MODULE Block contact infos -->

Thanks for the trick :)

Works as expected!

Link to comment
Share on other sites

  • 1 month later...
  • 4 months later...

thank you for the info it's great

 

Joël

 

Question to Vekia, I think ( thx Dude for great advise on breaking line in blockcontactinfos.tpl on Your mypresta.eu).

 

[Presta 1.6.0.9/ PHP 5.3.3 with ionCube/ default template]

 

I'm trying modify blockcontactinfos.tpl by adding next line in my contact info - www.alestyle.pl - with Skype nickhandle. As far as I'm happy I've added only icon and text adding string:

 

<li><i class="icon-skype"></i>{l s='Skype [chat]:' mod='blockcontactinfos'} <span></span></li>

 

I can not add highlighted link with Skype link to activate chat - in orygin formula skype:your_skype_nick?chat. As I've read I need insert display variables similar to:

 

$blockcontactinfos_company

 

$blockcontactinfos_address

 

$blockcontactinfos_phone

 

$blockcontactinfos_email

 

but where? How and which one file I have to modyfy by adding next "skype variable"? What I've inject? Full of happyness will  be so kind injection will automaticly wake up Skype to chat finally as mialto in email string.

 

Link to comment
Share on other sites

  • 1 year later...
Hi,
I do not know how it happened as there were yesterday and not today but disappeared these icons in the footer:
post-1119372-0-41580500-1450946441_thumb.png

 

 
can someone help me?
Thanks :)
Link to comment
Share on other sites

×
×
  • Create New...