[HOW TO] - Welcome Message / Customer Name in Header
51 posts
• Page 3 of 3 • 1, 2, 3
Re: [HOW TO] - Welcome Message / Customer Name in Header
Fixed, had to do the CSS for that 

-

Maansy - Posts: 930
- Joined: Wed Jun 23, 2010 10:04 pm
Re: [HOW TO] - Welcome Message / Customer Name in Header
fido-x wrote:silanli_53 wrote:How can we show the surname.?
welcome; name lastname
Use this in the header controller (catalog/controller/common/header.php):
- Code: Select all
// Greeting in header
if (!$this->customer->isLogged()) {
$this->data['text_greeting'] = $this->language->get('text_greeting');
} else {
$this->data['text_greeting'] = sprintf($this->language->get('text_logged'), $this->customer->getFirstName() . ' ' . $this->customer->getLastName());
}
$this->data['text_create'] = $this->language->get('text_create');
$this->data['create'] = HTTPS_SERVER . 'index.php?route=account/create';
// End Greeting in header
Thanks fido-x
How do I add is in which group.?
Thanks
best regarts
-

silanli_53 - Posts: 48
- Joined: Fri Feb 19, 2010 12:54 am
Re: [HOW TO] - Welcome Message / Customer Name in Header
Hi Fido and all.
is this 1.4.9 compatible?
many thanks
is this 1.4.9 compatible?
many thanks
- DannyMacD
- Posts: 471
- Joined: Thu Jun 25, 2009 10:39 pm
Re: [HOW TO] - Welcome Message / Customer Name in Header
DannyMacD wrote:Hi Fido and all.
is this 1.4.9 compatible?
many thanks
Yes.

If you're not living on the edge ... you're taking up too much space!
Multi-Vendor Plugin for OpenCart 1.5.1.x
Have I helped you?
-

fido-x - Posts: 1960
- Joined: Fri Jun 27, 2008 5:09 pm
- Location: Tasmania, Australia
Re: [HOW TO] - Welcome Message / Customer Name in Header
fido-x wrote:I've had a few requests for this from people who have visited my dev site. Since this is not mine (it's something that was in version 0.7.7), I'm quite happy to post the necessary information to get it working.
You will need to edit the following files:–
* catalog/controller/common/header.php
* catalog/language/english/common/header.php
* catalog/view/theme/default/template/common/header.tpl
* catalog/view/theme/default/stylesheet/stylesheet.css
catalog/controller/common/header.php
Insert the following:–
- Code: Select all
if (!$this->customer->isLogged()) {
$this->data['text_greeting'] = $this->language->get('text_greeting');
} else {
$this->load->model('account/customer');
$customer_info = $this->model_account_customer->getCustomer($this->customer->getId());
$this->data['text_greeting'] = sprintf($this->language->get('text_logged'), $customer_info['firstname']);
}
$this->data['text_create'] = $this->language->get('text_create');
$this->data['text_account'] = $this->language->get('text_account');
$this->data['create'] = $this->url->https('account/create');
$this->data['account'] = $this->url->https('account/account');
before:
- Code: Select all
$this->id = 'header';
(around line 31 in an unmodified setup)
catalog/language/english/common/header.php
Insert the following:–
- Code: Select all
$_['text_greeting'] = 'Welcome, <strong>Guest</strong>';
$_['text_logged'] = 'Welcome back, <strong>%s</strong>';
$_['text_create'] = 'Register';
$_['text_account'] = 'Account';
before the end of the file.
catalog/view/theme/default/template/common/header.tpl
Insert the following:–
- Code: Select all
<div class="welcome">
<?php echo $text_greeting; ?>
<?php if (!$logged) { ?>
[ <a href="<?php echo $login; ?>"><?php echo $text_login; ?></a> ] [ <a href="<?php echo $create; ?>"><?php echo $text_create; ?></a> ]
<?php } else { ?>
[ <a href="<?php echo $logout; ?>"><?php echo $text_logout; ?></a> ] [ <a href="<?php echo $account; ?>"><?php echo $text_account; ?></a> ]
<?php } ?>
</div>
before
- Code: Select all
<div class="div4">
catalog/view/theme/default/stylesheet/stylesheet.css
Add the following:–
- Code: Select all
#header .welcome {
clear: both;
margin: 10px 0px 10px 0px;
text-align: right;
}
At the end of the file.
Enjoy!
Hello,
The Header.php code, do I add it before or after $this->id = 'header"? because I tried, but its not working.
any help please

v1.5.0.5
- Tom52
- Posts: 35
- Joined: Wed Oct 06, 2010 11:41 pm
Re: [HOW TO] - Welcome Message / Customer Name in Header
fido-x wrote:DannyMacD wrote:Hi Fido and all.
is this 1.4.9 compatible?
many thanks
Yes.
im now confused at what code to use for 1.4.9.1 lol anyone throw me a bone please
thanks 
- DannyMacD
- Posts: 471
- Joined: Thu Jun 25, 2009 10:39 pm
Re: [HOW TO] - Welcome Message / Customer Name in Header
For OC 1.4.9.2
With so many codes flying around I think many of us was confused. Here's just a compilation of what Fido coded for 1.4.9.2 users:
catalog/controller/common/header.php
Insert the following:–
before:
catalog/language/english/common/header.php
Insert the following:–
before the end of the file.
catalog/view/theme/default/template/common/header.tpl
Insert the following:–
before
catalog/view/theme/default/stylesheet/stylesheet.css
Add the following:–
At the end of the file.
And that's it, hope I didn't screw the code with the cut and paste. I put the Greeting messages on the right side along the lines of [Specials] [Bookmark] [Contact] and align the top to 7px, as the rest of the wordings.
Thanks Fido for the codes!
With so many codes flying around I think many of us was confused. Here's just a compilation of what Fido coded for 1.4.9.2 users:
catalog/controller/common/header.php
Insert the following:–
- Code: Select all
// Greeting in header
if (!$this->customer->isLogged()) {
$this->data['text_greeting'] = $this->language->get('text_greeting');
} else {
$this->data['text_greeting'] = sprintf($this->language->get('text_logged'), $this->customer->getFirstName());
}
$this->data['text_create'] = $this->language->get('text_create');
$this->data['create'] = HTTPS_SERVER . 'index.php?route=account/create';
// End Greeting in header
before:
- Code: Select all
$this->id = 'header';
catalog/language/english/common/header.php
Insert the following:–
- Code: Select all
$_['text_greeting'] = 'Welcome, <strong>Guest</strong>';
$_['text_logged'] = 'Welcome back, <strong>%s</strong>';
$_['text_create'] = 'Register';
$_['text_account'] = 'Account';
before the end of the file.
catalog/view/theme/default/template/common/header.tpl
Insert the following:–
- Code: Select all
<div class="welcome">
<?php echo $text_greeting; ?>
<?php if (!$logged) { ?>
[ <a href="<?php echo $login; ?>"><?php echo $text_login; ?></a> ] [ <a href="<?php echo $create; ?>"><?php echo $text_create; ?></a> ]
<?php } else { ?>
[ <a href="<?php echo $logout; ?>"><?php echo $text_logout; ?></a> ] [ <a href="<?php echo $account; ?>"><?php echo $text_account; ?></a> ]
<?php } ?>
</div>
before
- Code: Select all
<div class="div4">
catalog/view/theme/default/stylesheet/stylesheet.css
Add the following:–
- Code: Select all
#header .welcome {
float: right;
display: block;
margin-top: 7px;
margin-bottom: 10px;
padding-left: 0px;
}
#header .welcome a {
margin: 0px;
padding: 0px;
background: none;
}
At the end of the file.
And that's it, hope I didn't screw the code with the cut and paste. I put the Greeting messages on the right side along the lines of [Specials] [Bookmark] [Contact] and align the top to 7px, as the rest of the wordings.
Thanks Fido for the codes!
I don't know much about PHP...~~
Don't know much about JQuery...~~
But I do know that I love OC!~~
and I know that if you'd guide me, what a wonderful world this would be...!~~
_________________________________________________________________
Using OC 1.4.9.2
http://www.ten2hundred.com
Don't know much about JQuery...~~
But I do know that I love OC!~~
and I know that if you'd guide me, what a wonderful world this would be...!~~
_________________________________________________________________
Using OC 1.4.9.2
http://www.ten2hundred.com
-

manson - Posts: 73
- Joined: Mon Dec 06, 2010 10:58 am
Re: [HOW TO] - Welcome Message / Customer Name in Header
after pasting all the siles to their respective places...i got this error upon opening my site:
Fatal error: Call to a member function https() on a non-object in /home/abcd12/public_html/ocart/catalog/controller/common/header.php on line 182
what does it mean?
Fatal error: Call to a member function https() on a non-object in /home/abcd12/public_html/ocart/catalog/controller/common/header.php on line 182
what does it mean?
- elaineben
- Posts: 8
- Joined: Wed May 11, 2011 12:02 pm
Re: [HOW TO] - Welcome Message / Customer Name in Header
I've got something similar to this working for v1.5.x
It adds a personalised welcome message after login to both the account and affiliate account pages.
You can download it (commercial) here:
http://www.opencart.com/index.php?route=extension/extension/info&extension_id=3946
It adds a personalised welcome message after login to both the account and affiliate account pages.
You can download it (commercial) here:
http://www.opencart.com/index.php?route=extension/extension/info&extension_id=3946
Last edited by spitos on Wed Nov 16, 2011 3:01 pm, edited 1 time in total.
Get it here Google Analytics Expert - E-Commerce Tracking including Product Options, Goal & Funnel Reporting, Event Tracking, Search Tracking, Multi-Store compatibility & EU Cookie Law compliance. Works with Shoppica too!
Free Mods:
Remove Wishlist | Remember text in search box
Other Extensions:
Remove product counts, Opencart speedup & Improve page load time | All Extensions
-

spitos - Posts: 258
- Joined: Mon May 23, 2011 10:19 am
- Location: UK
Re: [HOW TO] - Welcome Message / Customer Name in Header
Hi spitos,
I just checked your vqmod and it works well for 1.5.1. A nice little addition i'm sure others will use.
I just checked your vqmod and it works well for 1.5.1. A nice little addition i'm sure others will use.
- asphole
- Posts: 176
- Joined: Mon Mar 14, 2011 1:33 am
Re: [HOW TO] - Welcome Message / Customer Name in Header
How can I get this to frontpage body? I tried to duplicate this to home files but didnt work out...
- pooks
- Posts: 39
- Joined: Mon Mar 26, 2012 5:42 pm
51 posts
• Page 3 of 3 • 1, 2, 3
Who is online
Users browsing this forum: No registered users and 5 guests













