Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add Logout URL under every section of My Account Page?

Tags:

magento

I have a requirement that the logout url must be visible only in My Account bottom for every section of it like on "Account Information","Address Book", "My Orders" similar for all.

Please See the sample Image How to do this?

Where should I write

action method="addLink" translate="label title" module="customer"><label>Log Out</label><url helper="customer/getLogoutUrl"/><title>Log Out</title><prepare/><urlParams/><position>100</position></action>

in My customer.xml file.

like image 426
Mukesh Avatar asked Jun 20 '13 07:06

Mukesh


1 Answers

You can remove the block 'customer_logged_in' in customer.xml and then you can add/make a block in customer.xml like this.

<reference name="content">
            <block type="page/html_wrapper" name="my.account.wrapper" translate="label">
                <label>My Account Wrapper</label>
                <action method="setElementClass"><value>my-account</value></action>
                <block type="core/template" name="logout_link" template="customer/logout_link.phtml"/>
            </block>
 </reference>

And the content of the logout_link.phtml would be something like,

<?php
$loggedIn = $this->helper("customer")->isLoggedIn();
if($loggedIn == 1){
    echo "<a href=\"".Mage::getBaseUrl()."customer/account/logout/\" >LOGOUT</a>";
}else{
    echo "<a href=\"".Mage::getBaseUrl()."customer/account/\" >LOGIN</a>";
}?>

....

like image 78
Dushyant Joshi Avatar answered Oct 08 '22 19:10

Dushyant Joshi