Magento Forum

add css class to Wishlist Link (Top)
 
MagePsycho
Mentor
 
Avatar
Total Posts:  1702
Joined:  2009-06-23
 

Hi Mage Lovers

I have one query regarding adding custom css class in wishlist link:

<reference name="top.links">
            <
block type="wishlist/links" name="wishlist_link"/>
            <
action method="addLinkBlock"><blockName>wishlist_link</blockName></action>
        </
reference>

Note: I tried the following code but didn’t work:

<reference name="top.links">
            <
block type="wishlist/links" name="wishlist_link"/>
            <
action method="addLinkBlock"><blockName>wishlist_link</blockName><aParams>class="my-wishlist"</aParams></action>
        </
reference>
&
<reference name="top.links">
            <
block type="wishlist/links" name="wishlist_link"/>
            <
action method="addLinkBlock"><blockName>wishlist_link</blockName><aParams>id="my-wishlist"</aParams></action>
        </
reference>

Thanks in advance.

 
Magento Community Magento Community
Magento Community
Magento Community
 
clorne
Sr. Member
 
Total Posts:  236
Joined:  2008-01-10
London
 

For “wishlist” top link I believe you would have to add css to links.phtml .

Similar to

http://www.magentocommerce.com/boards/viewthread/229259/

 
Magento Community Magento Community
Magento Community
Magento Community
 
magedziner
Sr. Member
 
Avatar
Total Posts:  246
Joined:  2009-09-02
 

To add custom css class in top Wishlist Link,
We need to add this :

<reference name="top.links">
              <
action method="addLink" translate="label title" module="wishlist"><label>My Wishlist</label><path>wishlist</path><title>My Wishlist</title><prepare/><urlParams/><position>2</position><li/><a>class="your-classname"</a></action>
        </
reference>

Hope this helps!

 
Magento Community Magento Community
Magento Community
Magento Community
 
magedziner
Sr. Member
 
Avatar
Total Posts:  246
Joined:  2009-09-02
 

To add custom css class in top Wishlist Link,
We need to add this :

<reference name="top.links">
              <
action method="addLink" translate="label title" module="wishlist"><label>My Wishlist</label><path>wishlist</path><title>My Wishlist</title><prepare/><urlParams/><position>2</position><li/><a>class="your-classname"</a></action>
        </
reference>

Hope this helps!

 
Magento Community Magento Community
Magento Community
Magento Community
 
flayeros
Jr. Member
 
Total Posts:  1
Joined:  2012-03-25
 

Here you go, two simple hacks to choose from.

1st: Just add in local.xml

<reference name="top.links">
     <
reference name="wishlist_link">                 
          <
action method="__set">
                 <
name>a_params</name><value>class="top-link-wishlist"</value>
          </
action>             
     </
reference>
</
reference>

2nd option would be:
go to app\code\core\Mage\Wishlist\Block\Links.php
and inside

public function initLinkProperties()

just after
$this->_title $text;

insert this line
$this->a_params 'class="top-link-wishlist"';

If you want to leave the core file intact, you can first copy it to app\code\local\Mage\Wishlist\Block\Links.php
Hope that helps! cool smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
SteveBerrill
Member
 
Avatar
Total Posts:  36
Joined:  2010-09-21
Preston
 

heres my way of doing it

I would add this to my local.xml in my theme folder.

<reference name="wishlist_link">
    <
action method="setAParams"><params>class="my-wishlist" rel="nofollow"</params></action>
</
reference>

if you notice, I have also added another parameter rel="nofollow” so I can add as many attributes to this a link as i want.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top