After Login i want to replace the "My Account"(Dropdown with links) With "Hi,FirstName" post login ?
How do i do that , I am not talking about welcome message ,
3 Answers
In File app/design/frontend/rwd/default/template/page/html/header.phtml
Replace
<span class=<div class="account-cart-wrapper">
<a href="<?php echo $this->helper('customer')->getAccountUrl(); ?>" data-target-element="#header-account" class="skip-account">
<span class="icon"></span>"label"><?php echo $this->__('Account'); ?></span>
With
<div class="account-cart-wrapper">
<a href="<?php echo $this->helper('customer')->getAccountUrl(); ?>" data-target-element="#header-account" class="skip-account">
<span class="icon"></span>
<?php
if(!Mage::getSingleton('customer/session')->isLoggedIn()){
?>
<span class="label"><?php echo $this->__('Account'); ?></span>
<?php
}else{
?>
<span class="label"><?php echo 'Hi, '.Mage::getSingleton('customer/session')->getCustomer()->getFirstname(); ?></span>
<?php
}
?>
same page of welcome message
app/design/frontend/rwd/default/template/page/html/header.phtml
line 67
<a href="#header-account" class="skip-link skip-account">
<span class="icon"></span>
<span class="label"><?php
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
echo Mage::getSingleton('customer/session')->getCustomer()->getName();
}else {echo $this->__('Account'); } ?></span>
</a>
This is my code:
<div class="switcher top-links" id="top-links">
<span class="name" data-mage-init='{"dropdown":{}}' data-toggle="dropdown">
<span><span class="hidden-sm hidden-xs"><?php echo __('My Account ')?></span><i class="fa fa-user hidden-lg hidden-md"></i><i class="fa fa-angle-down"></i></span>
</span>
<ul class="menu dropdown switcher-dropdown ui-dialog-content ui-widget-content" style="display:none;" data-target="dropdown" data-mage-init='{"dropdownDialog":{
"appendTo":"#top-links",
"triggerTarget":"#top-links > .name",
"closeOnMouseLeave": false,
"triggerClass":"active",
"parentClass":"active",
"defaultDialogClass":"dropdown-menu",
"buttons":null}}'>
<?php echo $block->getChildHtml('top.links') ?>
</ul>
<?php echo $block->getChildHtml('top.links') ?>
</div>
This is my code what should do? I want also same functionality