Attachments
phone number.png (277.6 KiB) Viewed 4815 times
Your Local Store.
http://www.frishops.ca
http://www.frishops.cn
In your catalog/view/theme/<your_theme>/template/common/header.tpl file,
find:
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:
Code: Select all
$data['telephone'] = $this->config->get('config_telephone');
Code: Select all
$data['email'] = $this->config->get('config_email');
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
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');
Your Local Store.
http://www.frishops.ca
http://www.frishops.cn
I added
Code: 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 get
can i please get some helpNotice: Undefined variable: email in /catalog/view/theme/zerone/template/common/header.tpl on line 51
Reason: Added code and quote tags.
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
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
find:
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>
If you want to remove the telephone number then just comment it out in header.tpl like this
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>-->
"Notice: Undefined variable: email in /public_html/catalog/view/theme/zerone/template/common/header.tpl on line 52"
Im running version 2.2 if that helps?
straightlight is giving you right way to do this, but if it;s still not working then you can use direct method which used by many front-end developers
in Your header.tpl file ( catalog/view/theme/<Your Theme>/template/common/header.tpl )
Search below code
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>
Thank You
Reason: Added code tags.
Webx IT Solutions
Tel: +91 99154 09292, Skype: webmedialdh, Email: support@webxitsolutions.com
If there's an email error variable message on your previous post, there is a specific reason for this which is certainly caused by a global function. However, more information would be needed based on the way you did added these codes in order to provide an accurate solution.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
In catalog/view/MY_THEME/template/common/header.tpl
It cut off the image but the line is
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>
Thanks
Or, I would simply rename the previous header.php file's instruction line with this:
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');
As for the $email variable error message, switch back to the default theme from your admin - > extensions - > themes - > Select Default and see if the issue persists.
Note: If your site is already live, set your site under temporary maintenance from your admin - > systems - > settings - > edit store - > server tab - > Maintenance Mode: On before testing the above.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
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.
For Example:
Code: 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.
Thanks
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.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
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.
Thanks
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Users browsing this forum: No registered users and 140 guests