Magento Questions Answered By Magento Experts

 

Welcome Guest. Sign in or Signup

4 Answers

change login content from header to footer

Asked by: 2003 views , , , , ,
Questions

Hi all,

 

I want to change login content from header to the footer.

My idea was to get the code out of header.phtml

<div class=”quick-access”>
        <?php echo $this->getChildHtml(‘store_language’) ?>
        <p class=”welcome-msg”><?php echo $this->getWelcome()?></p>
        <?php echo $this->getChildHtml(‘topLinks’) ?>
          <?php if ($this->helper(‘customer’)->isLoggedIn()): ?>
                    <?php else: ?>
                    <?php echo $this->getLayout()->getBlock(‘mini_login’)->toHtml()?>
          <?php endif?>

paste this in the footer.phtml

then open page.xml

got to <header>, cut the code:

<block type=”page/template_links” name=”top.links” as=”topLinks”/>
                     <block type=”customer/form_login” name=”mini_login” template=”customer/form/mini.login.phtml”/>

 

and paste this in the <footer> code!

But the links disapear…?
Can anyone help me out what i’m doing wrong!
Thanks in advance help would be very appreciated! =)

4 Answers



  1. Tweets that mention change login content from header to footer -- Topsy.com on Jan 10, 2011 Reply

    [...] This post was mentioned on Twitter by Darren Nicholls. Darren Nicholls said: “@magexpert: Magento: change login content from header to footer http://t.co/TKA8E6Y” < thanks for that. Alway7s useful. [...]

    0 Votes Thumb up 0 Votes Thumb down 0 Votes



    • coentrast on Jan 10, 2011 Reply

      Hi @Darren,

      Your link ain’t working, can you try that again please!
      thanks for the reply
      Coen

      0 Votes Thumb up 0 Votes Thumb down 0 Votes



  2. Magentist on Jan 10, 2011 Reply

    Hi coentrast,

    The problem is that these reference paths use “getChildHtml” and Magento’s core files place these elements as a child of the header. But don’t worry; you won’t need to edit any core files. You should be able to use this edited code below in the footer.phtml

    <div class="quick-access">
    	<?php echo $this->getLayout()->getBlock('store_language')->toHtml()?>
    	<p class="welcome-msg">
    		<?php if (Mage::getSingleton('customer/session')->isLoggedIn()==0): ?>
    		  <?php echo $this->__(Mage::getStoreConfig('design/header/welcome')) ?>
    		  <?php else: ?>
    					  Hi <?php echo $this->__(Mage::getSingleton('customer/session')->getCustomer()->getFirstname ()); ?>
    		 <?php endif ?>
    	</p>
    	<?php echo $this->getLayout()->getBlock('top.links')->toHtml()?>
    	<?php if ($this->helper('customer')->isLoggedIn()): ?>
    			<?php else: ?>
    			<?php echo $this->getLayout()->getBlock('mini_login')->toHtml()?>
    	<?php endif?>
    </div>

    I’ll give you one warning though: The contents of the header is not cached, which allows it to change dynamically. For instance, when a user is logged in, the Log In link changes to Log Out; when an item is added to the cart, the cart quantity is displayed beside the cart link; etc. The footer, however, is cached, so these features may not work.

    Magento Themes by Magentist

    0 Votes Thumb up 0 Votes Thumb down 0 Votes



    • coentrast on Jan 12, 2011 Reply

      Hi Magentist,

      Thanx for your answer. It only didn’t worked out, and like you say the
      content is not changing when log in, and changes in the nav-list.
      It ain’t that easy to just move around parts of a block.
      cheers anyway!

      0 Votes Thumb up 0 Votes Thumb down 0 Votes


Answer Question