enter image description here

How to remove the categories drop down with title "All categories" attached with the search bar seen in the image attached herewith in Magento 2 ?

We just need to show the search bar only and no category list along with.

                  <?php if($catalogsearch) : ?>
                  <div class="catalogsearch-box">
                    <span id="select-box-category"><?php echo __('All Categories') ?></span>
                    <div id="categories-box" style="display:none;">
                      <input style="display:none;" type="text" value="" id="qsearch">
                      <ul class="cat-list dd-container" id="cat">
                        if($depth) $depth ++;
                          $categoryFactory = $objectManager->create('Magiccart\Alothemes\Model\System\Config\CatalogSearch');
                            $categories = $categoryFactory->toOptionArray($depth);
                            echo '<li data-q="0">' . __('All Categories') . '</li>';
                            foreach ($categories as $category){
                              echo '<li data-q="'.$category['value'].'" class="' . $category['class'] . '">' . $category['label'] . '</li>';

From this code, where can I set the catelogsearch as false ?

  • I think you are using theme. So you need to find the search section. – Sukumar Gorai Aug 23 '18 at 9:42
  • 2
    Your top search is modified by theme. you can find in default_head_block.xml. you will found the top search file. – Kevinzie Aug 23 '18 at 9:51
  • I have searched for this option in the admin panel everywhere. But could not find this. Let me check the default_head_block.xml file – Jithin U. Ahmed Aug 23 '18 at 9:52
  • is there any code before $catalogsearch? – kunj Aug 23 '18 at 10:37
  • $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); – Jithin U. Ahmed Aug 23 '18 at 11:02

Your Answer

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

Browse other questions tagged or ask your own question.