I am working on a Magento 2.1.7 shop. To achieve this, I have created a child-theme of Magento Blank.

I have moved the top links at the right of the logo:

<move element="top.links" destination="header-wrapper" after="logo" />

I want to display the search bar (it does not display anywhere) above the top links (like the screenshot indicates).

enter image description here

For this purpose, I wrote the line below, in my default.xml file:

<move element="top.search" destination="header-wrapper" before="links" />

The result is that the search bar not only does not display above the top links but it does not display at all.

There is alse a app/design/frontend/Company_Name/Theme_Name/Magento_Search/layout/default.xml file with this code:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <move element="top.search" destination="navbar-collapse" after="navigation.sections" />
        <referenceBlock name="advanced-search-link" remove="true" />

As you can see, on the website's homepage, the search box does not appear anywhere.

  1. What am I doing wrong?
  2. Could the search feature be disabled from admin?
  3. Can I display the search bar inside the top links <ul> element?
  • if it is not displaying , first check in the code if it is removed – Piyush Dec 19 '17 at 12:59

If your parent theme is a Blank theme. Use this code

<move element="top.search" destination="header-wrapper" before="top.links"/>

If Your parent theme is a Luma theme, then use this

<move element="top.search" destination="header-wrapper" before="header.links"/>
| improve this answer | |
  • I tried it. It does not work. – Razvan Zamfir Dec 19 '17 at 13:19
  • clear your cache and check again. It's working on my side. – Dinesh Yadav Dec 19 '17 at 13:24
  • Check this screenshot i.stack.imgur.com/FQltk.png – Dinesh Yadav Dec 19 '17 at 13:24
  • Could it be disabled from admin? How do I enable it? – Razvan Zamfir Dec 19 '17 at 13:27
  • If you cache is disabled, then you don't need to refresh the cache. The result should be rendered. Check if your layout is overwritten somewhere. – Dinesh Yadav Dec 19 '17 at 13:33

Change This :

<move element="top.search" destination="header-wrapper" before="links" />


<move element="top.search" destination="header-wrapper" before="header.links"/>


<move element="top.search" destination="header-wrapper" before="top.links"/>
| improve this answer | |
  • I tried it. It does not work. – Razvan Zamfir Dec 19 '17 at 12:55
  • Please check if it is adding in html code or not in view source? Please Check Updates. – Sujeet Pandit Dec 19 '17 at 13:00
  • It is not in the page source either. – Razvan Zamfir Dec 19 '17 at 13:05
  • <move element="top.search" destination="header-wrapper" before="top.links"/> Try this !! – Sujeet Pandit Dec 19 '17 at 13:07
<?xml version="1.0" encoding="UTF-8"?>
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<!-- ... other block of code -->
<filterSearch name="fulltext">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="provider" xsi:type="string">mageplaza_helloworld_post_listing.mageplaza_helloworld_post_listing_data_source</item>
<item name="chipsProvider" xsi:type="string">mageplaza_helloworld_post_listing.mageplaza_helloworld_post_listing.listing_top.listing_filters_chips</item>
<item name="storageConfig" xsi:type="array">
<item name="provider" xsi:type="string">mageplaza_helloworld_post_listing.mageplaza_helloworld_post_listing.listing_top.bookmarks</item>
<item name="namespace" xsi:type="string">current.search</item>
<!-- ... other block of code -->
| improve this answer | |
  • In what file shall I put the code above? And where in that respective file? – Razvan Zamfir Dec 21 '17 at 13:50
  • you can find all sample grid examples from this location : C:\xampp\htdocs\magento\vendor\magento\module-ui\view\base\ui_component\etc\definition.xml: – Hamza Mustafa Dec 21 '17 at 13:54
  • there i use this code : C:\xampp\htdocs\magento\app\code\Mastering\SampleModule\view\adminhtml\ui_component\mastering_items_grid.xml – Hamza Mustafa Dec 21 '17 at 13:56
  • That is your local server. – Razvan Zamfir Dec 21 '17 at 14:04
  • yes ofcourse it is – Hamza Mustafa Dec 22 '17 at 12:34

I added the following code sequence in my custom theme's default.xml file:

<container name="header.main.search" htmlTag="div" htmlClass="header-search" after="-">
<block class="Magento\Framework\View\Element\Template" template="Magento_Search::form.mini.phtml" />
<move element="header.main.search" destination="header-wrapper" after="logo" />
<move element="top.links" destination="header-wrapper" after="header.main.search" />

The code above renders the following HTML in the page source:

<div class="header content">
  <strong class="logo">
   <img src="https://dev3.pro-detailing.ro/pub/static/version1516374892/frontend/ProDetailing/v1/en_US/images/logo.png" alt="Magento Commerce" width="263" height="85">
  <div class="header-search">
    <form class="navbar-form navbar-right" role="search" id="search_mini_form" action="https://dev3.pro-detailing.ro/catalogsearch/result/" method="get">
      <div class="form-group">
        <input type="text" name="q" value="" placeholder="Search entire store here..." class="form-control" maxlength="128" role="combobox" aria-haspopup="false" aria-autocomplete="both" autocomplete="off">
      <button type="submit" class="btn btn-default" disabled="">Search</button>
      <div id="search_autocomplete" class="search-autocomplete" style="display: none;"></div>
  <ul class="list-inline clearfix header links">
    <li><a href="https://dev3.pro-detailing.ro/customer/account/">My Account</a></li>
    <li class="authorization-link" data-label="or">
      <a href="https://dev3.pro-detailing.ro/customer/account/login/">
      Sign In</a>

This is what I was looking for.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.