Jump to content

Add fields in BlockContact


Recommended Posts

Hi

I added a new field in blockcontact and I have a problem with the image block arrangement

How can I add this picture without damaging the rest of the block's

I edited:

blockcontact.php

if (!defined('_CAN_LOAD_FILES_'))
exit;

class Blockcontact extends Module
{
public function __construct()
{
 $this->name = 'blockcontact';
 $this->tab = 'front_office_features';
 $this->version = '1.0';
 parent::__construct();
 $this->displayName = $this->l('Contact Block');
 $this->description = $this->l('Allows you to add additional information about your store\'s customer service.');
}

public function install()
{
 return parent::install()
  && Configuration::updateValue('blockcontact_telnumber', '')
  && Configuration::updateValue('blockcontact_yahoo', '')
  && Configuration::updateValue('blockcontact_email', '')
  && $this->registerHook('displayRightColumn')
  && $this->registerHook('displayHeader');
}

public function uninstall()
{
 // Delete configuration
 return Configuration::deleteByName('blockcontact_telnumber') && Configuration::deleteByName('blockcontact_email') && Configuration::deleteByName('blockcontact_yahoo') && parent::uninstall();
}

public function getContent()
{
 $html = '';
 // If we try to update the settings
 if (Tools::isSubmit('submitModule'))
 {  
  Configuration::updateValue('blockcontact_telnumber', Tools::getValue('telnumber'));
  Configuration::updateValue('blockcontact_yahoo', Tools::getValue('yahoo'));
  Configuration::updateValue('blockcontact_email', Tools::getValue('email'));
  $this->_clearCache('blockcontact.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>  
<label for="telnumber">'.$this->l('Telephone number:').'</label>
<input type="text" id="telnumber" name="telnumber" value="'.((Configuration::get('blockcontact_telnumber') != '') ? Tools::safeOutput(Configuration::get('blockcontact_telnumber')) : '').'" />
<div class="clear"> </div>
  <label for="yahoo">'.$this->l('Yahoo ID:').'</label>
<input type="text" id="yahoo" name="yahoo" value="'.((Configuration::get('blockcontact_yahoo') != '') ? Tools::safeOutput(Configuration::get('blockcontact_yahoo')) : '').'" />
<div class="clear"> </div>
<label for="email">'.$this->l('Email').'</label>
<input type="text" id="email" name="email" value="'.((Configuration::get('blockcontact_email') != '') ? Tools::safeOutput(Configuration::get('blockcontact_email')) : '').'" />
<div class="clear"> </div>
<div class="margin-form">
 <input type="submit" name="submitModule" value="'.$this->l('Update settings').'" class="button" /></center>
</div>
  </fieldset>
 </form>';
 return $html;
}
public function hookDisplayHeader()
{
 $this->context->controller->addCSS(($this->_path).'blockcontact.css', 'all');
}

public function hookDisplayRightColumn()
{
 global $smarty;
 if (!$this->isCached('blockcontact.tpl', $this->getCacheId()))
  $smarty->assign(array(
'telnumber' => Configuration::get('blockcontact_telnumber'),
'yahoo' => Configuration::get('blockcontact_yahoo'),
'email' => Configuration::get('blockcontact_email')
  ));
 return $this->display(__FILE__, 'blockcontact.tpl', $this->getCacheId());
}

public function hookDisplayLeftColumn()
{
 return $this->hookDisplayRightColumn();
}
}
?>

 

blockcontact.tpl

<div id="contact_block" class="block">
<p class="title_block">{l s='Contact us' mod='blockcontact'}</p>
<div class="block_content clearfix">
  <p>{l s='Our hotline is available 24/7' mod='blockcontact'}</p>
  {if $telnumber != ''}<p class="tel"><span class="label">{l s='Phone:' mod='blockcontact'}</span>{$telnumber|escape:'htmlall':'UTF-8'}</p>{/if}
  {if $email != ''}<a href="mailto:{$email|escape:'htmlall':'UTF-8'}">{l s='Contact our hotline' mod='blockcontact'}</a>{/if}
		{if $yahoo != ''}<p class="yahoo"><a href="ymsgr:sendim?{$yahoo}"><img src="http://opi.yahoo.com/online?u={$yahoo}&m=g&t=14">{l s='' mod='blockcontact'}</p>{/if}
</div>
</div>

 

adding at the end blockcontact.css

#contact_block p.yahoo {
margin:0 0 0 60px;
padding-left: 26px;
}

adding at the end blockcontact.css

but something is not right (see picture 2)

 

I'd like the block look like the picture 3 (without border)

Picture 12ikf1u.jpg

Picture 2 2rz4e89.jpg

Picture 3 2rge2yc.jpg

 

tks

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

nop

site is localhost

but we solved something in css file

now look like this:

5kioa0.jpg

and the tpl file:

<div id="contact_block" class="block">
<p class="title_block">{l s='Contact us' mod='blockcontact'}</p>
<div class="block_content clearfix">
  <p>{l s='Our hotline is available 24/7' mod='blockcontact'}</p>
  {if $telnumber != ''}<p class="tel"><span class="label">{l s='Phone:' mod='blockcontact'}</span>{$telnumber|escape:'htmlall':'UTF-8'}</p>{/if}
  {if $email != ''}<p class="email"><a href="mailto:{$email|escape:'htmlall':'UTF-8'}">{l s='Contact our hotline' mod='blockcontact'}<p></a>{/if}
		{if $yahoo != ''}<p class="yahoo"><a href="ymsgr:sendim?{$yahoo}"><img src="http://opi.yahoo.com/online?u={$yahoo}&m=g&t=14">{l s='yahoo' mod='blockcontact'}</p></a>{/if}
</div>
</div>

blockcontact.css

blockcontact.php

Link to comment
Share on other sites

×
×
  • Create New...