Top header phone number Disable or Change to Email
Posted: Tue Jun 28, 2016 5:45 am
I wish to disable the phone number or change that to email. Any idea where to?
OpenCart Community Forum - Discuss shopping cart and e-commerce solutions.
https://forum.opencart.com/
Code: Select all
<li><a href="<?php echo $contact; ?>"><i class="fa fa-phone"></i></a> <span class="hidden-xs hidden-sm hidden-md"><?php echo $telephone; ?></span></li>
Code: Select all
$data['telephone'] = $this->config->get('config_telephone');
Code: Select all
$data['email'] = $this->config->get('config_email');
straightlight wrote:The following example will be used for the default template.
In your catalog/view/theme/<your_theme>/template/common/header.tpl file,
find:
The $telephone is the variable that defines the contact number.Code: Select all
<li><a href="<?php echo $contact; ?>"><i class="fa fa-phone"></i></a> <span class="hidden-xs hidden-sm hidden-md"><?php echo $telephone; ?></span></li>
In your catalog/controller/common/header.php file,
find:
add below:Code: Select all
$data['telephone'] = $this->config->get('config_telephone');
You can now use: $email into your header template file.Code: Select all
$data['email'] = $this->config->get('config_email');
Code: Select all
$data['email'] = $this->config->get('config_email');
can i please get some helpNotice: Undefined variable: email in /catalog/view/theme/zerone/template/common/header.tpl on line 51
No instructions above on my behalf indicates to replace the $email with $telephone. It rather indicates to add the $email variable below the $telephone field.tallica22 wrote:Hello, I have been trying to do exactly this.
I addedto catalog/controller/common/header.phpCode: Select all
$data['email'] = $this->config->get('config_email');
and changed $telephone to $email in
catalog/view/theme/zerone/template/common/header.tpl
But i getcan i please get some helpNotice: Undefined variable: email in /catalog/view/theme/zerone/template/common/header.tpl on line 51
Code: Select all
$data['telephone'] = $this->config->get('config_telephone');
Code: Select all
$data['email'] = $this->config->get('config_email');
Code: Select all
<li><a href="<?php echo $contact; ?>"><i class="fa fa-phone"></i></a> <span class="hidden-xs hidden-sm hidden-md"><?php echo $telephone; ?></span></li>
Code: Select all
<li><a href="mailto:YOUR_EMAIL_ADDRESS?"><i class="fa fa-envelope"></i> <span class="hidden-xs hidden-sm hidden-md"><?php echo $email; ?></span></a></li>
Code: Select all
<!--<li><a href="<?php echo $contact; ?>"><i class="fa fa-phone"></i></a> <span class="hidden-xs hidden-sm hidden-md"><?php echo $telephone; ?></span></li>-->
Hey thanks for the help. i done exactly this and still getcyclops12 wrote:In your catalog/controller/common/header.php file,
find:
add below:Code: Select all
$data['telephone'] = $this->config->get('config_telephone');
In catalog/view/theme/YOUR_THEME/template/common/header.tpl findCode: Select all
$data['email'] = $this->config->get('config_email');
Add afterCode: Select all
<li><a href="<?php echo $contact; ?>"><i class="fa fa-phone"></i></a> <span class="hidden-xs hidden-sm hidden-md"><?php echo $telephone; ?></span></li>
Change YOUR_EMAIL_ADDRESS to the email address you wish to useCode: Select all
<li><a href="mailto:YOUR_EMAIL_ADDRESS?"><i class="fa fa-envelope"></i> <span class="hidden-xs hidden-sm hidden-md"><?php echo $email; ?></span></a></li>
If you want to remove the telephone number then just comment it out in header.tpl like thisHope this helpsCode: Select all
<!--<li><a href="<?php echo $contact; ?>"><i class="fa fa-phone"></i></a> <span class="hidden-xs hidden-sm hidden-md"><?php echo $telephone; ?></span></li>-->
Code: Select all
<li><a href="<?php echo $contact; ?>"><i class="fa fa-phone"></i></a> <span class="hidden-xs hidden-sm hidden-md"><?php echo $telephone; ?></span></li>
Code: Select all
<li><?php global $config; ?><a href="<?php echo $config->get('config_telephone'); ?>"><i class="fa fa-envelope"></i></a> <span class="hidden-xs hidden-sm hidden-md"><?php echo $config->get('config_telephone'); ?></span></li>
Code: Select all
<li><a href="mailto:YOUR_EMAIL_ADDRESS?"><i class="fa fa-envelope"></i> <span class="hidden-xs hidden-sm hidden-md"><?php echo $email; ?></span></a></li>
Code: Select all
$email = str_replace('@', ' at ', $this->config->get('config_email'));
$email = str_replace('.', ' dot ', $email);
$data['email'] = html_entity_decode($email, ENT_QUOTES, 'UTF-8');
Good point straightlight, i hadnt thought of that.... my bad!!straightlight wrote:I would not suggest to use the mailto: method on a website to be contacted but rather a web form with enforced captcha to be filled in order to avoid massive SPAM on your server.
Code: Select all
<?php global $config; if($config->get('my_style')== 1) { ?>
....html code....
<?php } ?>
Fortunately, it doesn't. Globalization is not a recommended method as it used to surpass the Object Registry of Opencart and I hope this protection on not using globalization further will remain intact.keyuri33 wrote:I have use in template (.tpl files). I use global in opencart 2.2 or older version.
For Example:but, it does not work in Latest OpenCart 2.3.0.2Code: Select all
<?php global $config; if($config->get('my_style')== 1) { ?> ....html code.... <?php } ?>
Please help me for this issue. this is correct way, please let me know proper way step.
So, Can you please explain how to it get proper way? with any example code. because, I have not more experienced. I have basic php knowledge. Help would be appreciated. Thank you!straightlight wrote:Fortunately, it doesn't. Globalization is not a recommended method as it used to surpass the Object Registry of Opencart and I hope this protection on not using globalization further will remain intact.