Page 2 of 3

Re: [HOW TO] - Welcome Message / Customer Name in Header

Posted: Thu Dec 24, 2009 8:13 am
by jmrchaves
Hey great add-on Fido-x

Let me ask you is it possible to add to this a not you? button?

Example

Welcome, customer Not you?(->this would go to login page)

Thanks, great contrib

Re: [HOW TO] - Welcome Message / Customer Name in Header

Posted: Thu Dec 24, 2009 8:01 pm
by Yakiv
jmrchaves wrote:Hey great add-on Fido-x

Let me ask you is it possible to add to this a not you? button?

Example

Welcome, customer Not you?(->this would go to login page)

Thanks, great contrib
This is a good suggestion, but shouldn't it log them out, if they click on "Not you?"?

Re: [HOW TO] - Welcome Message / Customer Name in Header

Posted: Wed Dec 30, 2009 10:20 am
by viniciusdepaula
Great job!!!

Tks ;D

Re: [HOW TO] - Welcome Message / Customer Name in Header

Posted: Mon Feb 08, 2010 5:00 am
by nocko
Beautiful! Thanks!

Re: [HOW TO] - Welcome Message / Customer Name in Header

Posted: Fri Feb 12, 2010 4:28 am
by Cristina
GREAT JOB!! THANK YOU SO MUCH!! ;)

Re: [HOW TO] - Welcome Message / Customer Name in Header

Posted: Fri Feb 12, 2010 11:11 am
by The Alchemist
nice mod

Re: [HOW TO] - Welcome Message / Customer Name in Header

Posted: Sun Feb 14, 2010 9:33 pm
by melbagnato
In my real-world job, I do a lot of consulting to large companies, and their marketing principles seem to revolve around the following concepts:
(1) gather as much useful information about the customer as possible
(2) have logical use for that information in your product selection & promotions

Whilst having the ability to greet someone correctly is great (infact in Germany it can be insulting not to use someone's title as it's a a sign of respect for their qualifications etc.), I feel that having the ability to know that a product is better suited to a woman rather than a man is great for promotional purposes.

That said, it means that you need to extend your product metadata to include these new fields too (in order to make use of this new real-time sales smarts), and possibly change way too many php files to be able to upgrade or take advantage of other people's mods.

IMHO, if you just want salutation, then I agree the effort isn't worth the risk of a mistake happening (even if it's caused by the customer), plus not everyone wants to divulge their sex as part of registration.

But, if you're thinking of collecting it as part of additional marketing fields to be used for analytics and sales promotions, then you've got a pretty difficult journey of mods ahead of you. My thoughts are with you.

- [MB]

Re: [HOW TO] - Welcome Message / Customer Name in Header

Posted: Mon Mar 15, 2010 12:51 pm
by The Alchemist
Will this work in 1.4.0?

Re: [HOW TO] - Welcome Message / Customer Name in Header

Posted: Sat Mar 27, 2010 6:15 am
by luiseduardo
The Alchemist wrote:Will this work in 1.4.0?
Good question... this is full of useless contributions since version is getting changed every week.

Re: [HOW TO] - Welcome Message / Customer Name in Header

Posted: Tue Mar 30, 2010 12:31 pm
by The Alchemist
Plus 1 they should have a contribs section with sub sections for versions.

Re: [HOW TO] - Welcome Message / Customer Name in Header

Posted: Fri Jun 04, 2010 11:38 pm
by Vivian
Hi fido-x,

Can it be used on 1.4.7?

Vivian

Re: [HOW TO] - Welcome Message / Customer Name in Header

Posted: Sat Jun 05, 2010 12:28 am
by Vivian
Hi,

I am running 1.4.7 and it gives me the following error when I try to run.

Fatal error: Call to a member function https() on a non-object in /content/HostingPlus/v/m/vmaxx.ie/web/catalog/controller/common/header.php on line 60

Can anyone explain what's wrong?

Vivian

Re: [HOW TO] - Welcome Message / Customer Name in Header

Posted: Sat Jun 05, 2010 9:32 am
by fido-x
Vivian wrote:Hi,

I am running 1.4.7 and it gives me the following error when I try to run.

Fatal error: Call to a member function https() on a non-object in /content/HostingPlus/v/m/vmaxx.ie/web/catalog/controller/common/header.php on line 60

Can anyone explain what's wrong?

Vivian
To make this compatible with 1.4.7, in "catalog/controller/common/header.php" change the following 2 lines:-

Code: Select all

$this->data['create'] = $this->url->https('account/create');
$this->data['account'] = $this->url->https('account/account'); 
To:

Code: Select all

$this->data['create'] = HTTPS_SERVER . 'index.php?route=account/create';
$this->data['account'] = HTTPS_SERVER . 'index.php?route=account/account';  
In your case, this will be lines 60 and 61.

Re: [HOW TO] - Welcome Message / Customer Name in Header

Posted: Sat Jun 05, 2010 5:26 pm
by Vivian
Hi fido-x,

I have made the changes as you said but it is displaying - text_greeting [lig in] [account]

No name appearing only string name even after I log in.

After log in it displays the string name - text_logged

Vivian

Re: [HOW TO] - Welcome Message / Customer Name in Header

Posted: Sun Jun 06, 2010 11:55 am
by fido-x
Looks like you missed a step with the language file. Put the following in "catalog/language/english/common/header.php":-

Code: Select all

$_['text_greeting'] = 'Welcome, <strong>Guest</strong>';
$_['text_logged']   = 'Welcome back, <strong>%s</strong>';
$_['text_create']   = 'Register';
$_['text_account']  = 'Account'; 

Re: [HOW TO] - Welcome Message / Customer Name in Header

Posted: Sun Jun 06, 2010 6:10 pm
by Vivian
Hi fido-x,

Did that but this is all that appears when page is loaded - text_greeting [ Log In ] [ text_create ]

Thanks

Vivian

Re: [HOW TO] - Welcome Message / Customer Name in Header

Posted: Sun Jun 06, 2010 9:05 pm
by fido-x
OK. Here's some updated instructions for OpenCart 1.4.7.

catalog/controller/common/header.php
Insert the following (around line 104):

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     
catalog/language/english/common/header.php
Insert the following:

Code: Select all

// Greeting Text
$_['text_greeting'] = 'Welcome, <strong>Guest</strong>';
$_['text_logged']   = 'Welcome back, <strong>%s</strong>';
$_['text_create']   = 'Register';
// End Greeting Text    
catalog/view/theme/default/template/common/header.tpl
Insert the following where you want the welcome message to appear:

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>
catalog/view/theme/default/stylesheet/stylesheet.css
Give it some style (eg. margins, padding, etc.):

Code: Select all

#header .welcome {
    float: left;
    display: block;
    margin-top: 20px;
    margin-bottom: 10px;
    padding-left: 0px;
}
#header .welcome a {
    margin: 0px;
    padding: 0px;
    background: none;
}
 

Re: [HOW TO] - Welcome Message / Customer Name in Header

Posted: Thu Jul 01, 2010 8:59 am
by silanli_53
How can we show the surname.?

welcome; name lastname



Thanks

Re: [HOW TO] - Welcome Message / Customer Name in Header

Posted: Thu Jul 08, 2010 5:18 pm
by fido-x
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   

Re: [HOW TO] - Welcome Message / Customer Name in Header

Posted: Tue Jul 13, 2010 10:47 am
by Maansy
thank you :)
but why there is big space?
Welcome, Guest [........ Log In ] [........Register ]
see it live

also can you provide how to add total cart items and total cart amount? plz answer here. i dont want to H/J this post
thanks