cancel
Showing results for 
Search instead for 
Did you mean: 

Search Terms question

SOLVED

Search Terms question

Morning all,

 

I understand that in order to remove the default footer links you need to make some adjustments to the xml file for the corresponding layout as described   HERE (I understand that the process described is a little dated as of Version 2.1.2 but It gave me a reference point).

 

The problem I have is that removing the "Search Terms" link in the footer also removes the search bar at the top of the page as well.

 

So my question is either how do I add the search bar manually or how do I stop it from being removed when I make changes to the default.xml located in /vendor/magento/module-search/view/frontend/layout.

 

For your reference the change that needs to be made in the default.xml is adding !- to the line <referenceBlock name="footer_links">

 I am running 2.1.2

 

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Search Terms question

I found a solution to the problem at hand and thought I would share it with you all as this may apply to other default footer links you may want to make changes to.

 

Any of the footer links will be found in "/vendor/magento/", you just need to find the correct subfolder.

 

In this case as mentioned in the OP you will find the settings for the search terms link found in the footer under " /vendor/magento/module-search/view/frontend/layout/default.xml.

 

This is what it normally looks like: 

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="header-wrapper">
            <block class="Magento\Framework\View\Element\Template" name="top.search" as="topSearch" template="Magento_Search::form.mini.phtml" />
        </referenceContainer>
        <referenceBlock name="footer_links">
            <block class="Magento\Framework\View\Element\Html\Link\Current" ifconfig="catalog/seo/search_terms" name="search-term-popular-link">
                <arguments>
                    <argument name="label" xsi:type="string" translate="true">Search Terms</argument>
                    <argument name="path" xsi:type="string">search/term/popular</argument>
                </arguments>
            </block>
        </referenceBlock>
    </body>
</page>

 Now normally if you want to remove the link all together you would simply add !- to the line "

 <!-referenceBlock name="footer_links">"

 This will remove the "Search Terms" link from the bottom but will also remove the search box at the top found next to the cart link.

 

To remove the link only or for that fact change what it says completely simply look for the code :

argument name="label" xsi:type="string" translate="true">Search Terms</argument>

Remove the text "Search Term" or replace it with whatever you may want to and save the file.

 

Flush Storage cache and Magento cache and your all done.

 

 

View solution in original post

1 REPLY 1

Re: Search Terms question

I found a solution to the problem at hand and thought I would share it with you all as this may apply to other default footer links you may want to make changes to.

 

Any of the footer links will be found in "/vendor/magento/", you just need to find the correct subfolder.

 

In this case as mentioned in the OP you will find the settings for the search terms link found in the footer under " /vendor/magento/module-search/view/frontend/layout/default.xml.

 

This is what it normally looks like: 

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="header-wrapper">
            <block class="Magento\Framework\View\Element\Template" name="top.search" as="topSearch" template="Magento_Search::form.mini.phtml" />
        </referenceContainer>
        <referenceBlock name="footer_links">
            <block class="Magento\Framework\View\Element\Html\Link\Current" ifconfig="catalog/seo/search_terms" name="search-term-popular-link">
                <arguments>
                    <argument name="label" xsi:type="string" translate="true">Search Terms</argument>
                    <argument name="path" xsi:type="string">search/term/popular</argument>
                </arguments>
            </block>
        </referenceBlock>
    </body>
</page>

 Now normally if you want to remove the link all together you would simply add !- to the line "

 <!-referenceBlock name="footer_links">"

 This will remove the "Search Terms" link from the bottom but will also remove the search box at the top found next to the cart link.

 

To remove the link only or for that fact change what it says completely simply look for the code :

argument name="label" xsi:type="string" translate="true">Search Terms</argument>

Remove the text "Search Term" or replace it with whatever you may want to and save the file.

 

Flush Storage cache and Magento cache and your all done.