Post by Maansy » Wed Jul 14, 2010 8:48 am

Fixed, had to do the CSS for that :)

ALL Templates :: 1.5.1+ Templates :: 50%-75% PRICE DROP ONLY at OpencartStuff.com


User avatar
Active Member

Posts

Joined
Thu Jun 24, 2010 6:04 am


Post by silanli_53 » Sun Sep 05, 2010 2:46 pm

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

Cafe Koltuk Çeşitleri

Laptop Sırt Çantası


User avatar
New member

Posts

Joined
Fri Feb 19, 2010 8:54 am


Post by DannyMacD » Wed Sep 08, 2010 7:02 am

Hi Fido and all.

is this 1.4.9 compatible?

many thanks

Active Member

Posts

Joined
Fri Jun 26, 2009 6:39 am

Post by fido-x » Thu Sep 09, 2010 8:44 pm

DannyMacD wrote:Hi Fido and all.

is this 1.4.9 compatible?

many thanks
Yes.

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by Tom52 » Mon Oct 18, 2010 10:57 pm

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


New member

Posts

Joined
Thu Oct 07, 2010 7:41 am

Post by DannyMacD » Sat Oct 23, 2010 5:53 am

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 :laugh:

Active Member

Posts

Joined
Fri Jun 26, 2009 6:39 am

Post by manson » Fri Dec 10, 2010 12:37 am

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:–

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


User avatar
New member

Posts

Joined
Mon Dec 06, 2010 6:58 pm

Post by elaineben » Sun May 29, 2011 4:32 am

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?

Newbie

Posts

Joined
Wed May 11, 2011 8:02 pm

Post by spitos » Wed Aug 17, 2011 1:51 am

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 ... on_id=3946
Last edited by spitos on Wed Nov 16, 2011 11:01 pm, edited 1 time in total.

Image
Google Analytics Expert - Advanced e-commerce tracking, Product & options reporting, transaction/conversion reporting, Google Adwords conversion & profit reporting, goal & funnel reporting, event tracking, site search tracking, multi-store compatibility, EU Cookie Law compliance and works with any theme or checkout! Easy vqmod install. Get it here


User avatar
Active Member

Posts

Joined
Mon May 23, 2011 6:19 pm
Location - UK

Post by asphole » Fri Aug 26, 2011 7:46 am

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.

Active Member

Posts

Joined
Mon Mar 14, 2011 9:33 am

Post by pooks » Thu Oct 18, 2012 11:29 pm

How can I get this to frontpage body? I tried to duplicate this to home files but didnt work out...

New member

Posts

Joined
Tue Mar 27, 2012 1:42 am

Post by cronolead » Tue Dec 23, 2014 9:51 pm

Please update the code for 2.x.x version

Newbie

Posts

Joined
Sun Apr 17, 2011 10:29 pm

Post by lacostechiu » Sat May 23, 2015 2:17 pm

I want to know how to show the customer name and welcom message in header, after logged.

I find the solution in stackoverflow, not worked, but I think it's almost.

anyone help ?

Newbie

Posts

Joined
Wed Feb 04, 2015 8:29 am

Post by embuh » Mon Sep 21, 2015 2:36 pm

Thank problem solve
Toko Mainan Surabaya

Newbie

Posts

Joined
Thu Dec 12, 2013 10:26 am

Post by salwa123 » Fri Dec 23, 2016 3:33 pm

is this oc 2.3.0.2 compatible?

Active Member

Posts

Joined
Fri Mar 04, 2016 6:01 pm
Who is online

Users browsing this forum: No registered users and 19 guests