Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento - Remove "Contact Us" footer link, the clean way

First of all the context : I want to remove the "Contact Us" link from the footer. But I do not have any contacts.xml where I can comment it out as I'm building my own theme based on the blank one. So the prerequisite is to remove it with my local.xml with layout remove methods.

This is working for the advanced search :

<default>
    <reference name="footer_links">
        <action method="removeLinkByUrl"><url helper="catalogsearch/getAdvancedSearchUrl"/></action>
    </reference>
</default>

But this isn't working for "Contact Us" :

<default>
    <reference name="footer_links">
        <action method="removeLinkByUrl"><url>contacts</url></action>
    </reference>
</default>

(Also tried with adding module="contacts" in action's attributes)

What I'm doing wrong?

like image 554
Erdal G. Avatar asked Oct 11 '13 10:10

Erdal G.


2 Answers

Well, easiest method i found is:

Create a basic custom module, with a helper class. In that helper class create a public function that returns: Mage::getBaseUrl() . 'contacts/' - which is the url to the contacts page. After that you can use that function in the layout action like so:

<reference name="footer_links">
    <action method="removeLinkByUrl">
        <url helper="module/getContactsUrl" />
    </action>
</reference>

Where: module - your custom module's name getContactsUrl - name of the function that returns the contacts url

You can name these as you like.

like image 139
Paul Corda Avatar answered Sep 20 '22 05:09

Paul Corda


If you want to, you can disable the Contact Us function. You can do this from the admin panel of your Magento. After you log in go to System menu>Configuration>Contacts button in the General section on the left>Contact Us panel on the right. In the Contact Us panel there's a drop-down menu Enable Contact Us. Set it to No and click on the Save Config button in top right corner. This will remove the Contact Us page and link from the frontend. If you want to enable the function again, just set the Enable Contact Us drop-down menu to Yes.

If you only need to remove only link from all the website, update it in template phtml ...app/design/frontend/yourteplatepath/page/html/footer.phtml

Not needed to configure layout, beacuse, you will load and uload link and function in vain.

like image 31
Martin Avatar answered Sep 20 '22 05:09

Martin