I want to show mini search form when i hover on one of the main category (Men Women ... ) at red area, as marked in below image.

This menu is shown using a custom extension. Is there any way in which i can call default search form in that custom module.


 <?xml version="1.0"?>
    <layout version="0.1.0">

            <block type="custommenu/toggle"></block>
           <block type="core/template" name="top.search" as="topSearch" template="catalogsearch/form.mini.phtml"/>


To temporarily solve my issues I did something like below in one of the blocks files app/code/community/WP/CustomMenu/Block

    public function getSearchBlock(  ) {
      $html ='<form id="search_mini_form" class="search-form" action="http://websitename.com/catalogsearch/result/" method="get">
 <input style="padding: 2px 4px 2px 5px;" id="search" type="search" name="q" value="" class="input-text required-entry" maxlength="128" placeholder="Search" autocomplete="off">
    <button type="submit" class="button-search-submit"></button>
       return $html;

and then call above function at an appropriate position. I know above method is not suggested. minisearch


In your module's local.xml add these lines of codes inside your module layout: the path is app\design\frontend\default\default\layout\webandpeople\custommenu.xml

<block type="core/template" name="top.search" as="topSearch" template="catalogsearch/form.mini.phtml"/>

enter image description here

Then call it in your modules's .phtml file, path of your phtml file is app\design\frontend\default\default\template\webandpeople\custommenu\top.phtml around line no 49 add this code wrapped within a parent div as like

enter image description here

<?php echo $this->getChildHtml('topSearch') ?>

You can change 'name' and 'as' of your block as you want, just call it with the 'as' you named.

This is not tested as third party extension does not draw much attention on stack, that's all I can try.

| improve this answer | |
  • in app/etc/modules/ ? – inrsaurabh Oct 10 '17 at 9:24
  • In your local.xml layout file, under your layout handle.. – Lalit838 Oct 10 '17 at 9:31
  • Path should be app/design/frontend/your_package/your_theme/layout/your_xml_file.xml – Lalit838 Oct 10 '17 at 9:33
  • I think my question is not clear . – inrsaurabh Oct 10 '17 at 9:35
  • Menu is coming through a custom module which replaced the default menu . In their phtml file if i write gethcildHtml('topsearch') nothing is shown – inrsaurabh Oct 10 '17 at 9:36

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.