Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

How to put an image as topLink via addLink action? 
 
haltabush
Jr. Member
 
Total Posts:  13
Joined:  2009-09-14
 

Almost all is in the title smile
I want to add a button form login/logout instead of the usual text.
I’ve tried a few things mixing customer.xml and CSS, without success.
Here is my “layout/customer.xml” file :

<!--
Load this update on every page when customer is logged in
-->

    <
customer_logged_in>
        <
reference name="top.links">
            <
action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getDashboardUrl"/><title>My Account</title><prepare/><urlParams/><position>2</position></action>
            <
action method="addLink" translate="title" module="customer"><label>logut</label><url helper="customer/getLogoutUrl"/><title>Log Out</title><prepare/><urlParams/><position>1</position><liParams>id="liLogout"</liParams></action>
        </
reference>
    </
customer_logged_in>

<!--
Load this update on every page when customer is logged out
-->

    <
customer_logged_out>
        <
reference name="top.links">
            <
action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getLoginUrl"/><title>My Account</title><prepare/><urlParams/><position>2</position></action>
            <
action method="addLink" translate="title" module="customer"><label>login</label><url helper="customer/getLoginUrl"/><title>Log In</title><prepare/><urlParams/><position>1</position><liParams>id="liLogin"</liParams></action>
        </
reference>
        <
remove name="wishlist_sidebar"></remove>
        <
remove name="reorder"></remove>
    </
customer_logged_out>

I’ve tried to do something like <aParams><img src="..."/></aParams>, but it doesn’t work (not surprisingly)

 
Magento Community Magento Community
Magento Community
Magento Community
 
f8bar
Jr. Member
 
Total Posts:  19
Joined:  2009-08-10
 

wanna know that too!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
haltabush
Jr. Member
 
Total Posts:  13
Joined:  2009-09-14
 

Hi,
Here is what I’ve done. There is probably a better way, but…

In my customer.xml:

<customer_logged_in>
        <
reference name="top.links">
            <
action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getDashboardUrl"/><title>My Account</title><prepare/><urlParams/><position>2</position></action>
            <
action method="addLink" translate="title" module="customer"><label>/skin/frontend/default/Template/images/cadenas_ouvert.gif</label><url helper="customer/getLogoutUrl"/><title>Log Out</title><prepare/><urlParams/><position>1</position><liParams>id="liLogout"</liParams></action>
        </
reference>
    </
customer_logged_in>

    <
customer_logged_out>
        <
reference name="top.links">
            <
action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getLoginUrl"/><title>My Account</title><prepare/><urlParams/><position>2</position></action>
            <
action method="addLink" translate="title" module="customer"><label>/skin/frontend/default/Template/images/cadenas_ferme.gif</label><url helper="customer/getLoginUrl"/><title>Log In</title><prepare/><urlParams/><position>1</position><liParams>id="liLogin"</liParams></action>
        </
reference>
        <
remove name="wishlist_sidebar"></remove>
        <
remove name="reorder"></remove>
    </
customer_logged_out>

And, in the page/template/links.php,

<div id="moncompte">
        
<?php foreach($_links as $_link): ?>
                <?php 
if ($_link->getLiParams()=='id="liLogin"' || $_link->getLiParams()=='id="liLogout"'):?>
                                <?php 
echo $_link->getBeforeText() ?><a href="<?php echo $_link->getUrl() ?>" <?php if($_link->getIsFirst()): ?> class="first"<?php elseif($_link->getIsLast()): ?> class="last"<?php endif; ?> title="<?php echo $_link->getTitle() ?>" <?php echo $_link->getAParams() ?>><img src="<?php echo $_link->getLabel() ?>" alt="login/logout" /></a><?php echo $_link->getAfterText() ?>
                        <?php 
else:?>
                     <?php 
echo $_link->getBeforeText() ?><a href="<?php echo $_link->getUrl() ?>"<?php if($_link->getIsFirst()): ?> class="first"<?php elseif($_link->getIsLast()): ?> class="last"<?php endif; ?> title="<?php echo $_link->getTitle() ?>" <?php echo $_link->getAParams() ?>><?php echo $_link->getLabel() ?></a><?php echo $_link->getAfterText() ?>
                        <?php 
endif;?>
        <?php 
endforeach; ?>
</div>
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top