How do I add the exit URL for the section in the My Account section?

I have a requirement that the exit URL is visible only at the bottom of my account for each section, for example, “Account Information”, “Address Book”, “My Orders”, which are similar for everyone.

Please See the sample Image How to do it?

Where do 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 the My customer.xml file.

+6
source share
2 answers

You can remove the customer_logged_in block in the customer.xml file, and then add / make a block in the customer.xml file as follows.

 <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 contents of logout_link.phtml will 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>"; }?> 

....

+17
source

Better use these urls:

 Mage::helper('customer')->getLogoutUrl() Mage::helper('customer')->getLoginUrl() 

It uses a client helper instead of a hard-coded URL.

+6
source

Source: https://habr.com/ru/post/947711/


All Articles