i am try to call advanced search in custom.phtml

<?php echo $this->getLayout()->createBlock('catalogsearch/advanced_form')->setTemplate('catalogsearch/advanced/form.phtml')->toHtml() ?>

like this when i try to search it goes to

if i mannually add catalogsearch/advanced instead cms/index it shows me fine.

Pst: custom.phtml directly shows through cms/page

<p>{{block type="categorydrop/navigation" template="categorydrop/custom.phtml"}}</p>

so, how can i use advanced search in custom.phtml ?

also my default search is not working? i want to work as autosearch but its not show me result?

i use <?php echo $this->getChildHtml(‘topSearch’) ?> this in custom.phtml for use default search its not show me.

Thanks in advanced...

1 Answer 1


You get that strange url because of the method getSearchPostUrl in the advanced search form class. It looks like this:

public function getSearchPostUrl()
    return $this->getUrl('*/*/result');

This means that the url where the search form will be sent is {current_module}/{current_controller}/result.
You have to options here.

  1. Clone catalogsearch/advanced/form.phtml into an other template file, use that for rendering the block and change inside it:

    <form action="<?php echo $this->getSearchPostUrl() ?>" method="get" id="form-validate"> to <form action="<?php echo $this->getUrl('catalogsearch/advanced/result') ?>" method="get" id="form-validate">

  2. Create a new block class that extends Mage_CatalogSearch_Block_Advanced_Form, use that for your homepage, and change the getSearchPostUrl to return $this->getUrl('catalogsearch/advanced/result').

I would go with option 1. Less work.

  • yeah it works. thanks bro... but i just try little different way i mean i create one textbox and button and on click of button ajax call and pass that parameter to that url. plz see is it correct ? its in below comment
    – MageDev
    Jul 17, 2014 at 6:52
  • <button type="button" class="button btn-cart" onclick="searchProduct();"><span><span><?php echo $this->__('Search') ?></span></span></button> function searchProduct(){ //alert("ad"); new Ajax.Request('<?php echo $this->getUrl("catalogsearch/advanced/result/?name=") ?>', { method: 'get', //parameters: Form.serialize("form-validate"), onComplete: function(transport) { } }); }
    – MageDev
    Jul 17, 2014 at 6:53
  • How to pass value from textbox?
    – MageDev
    Jul 17, 2014 at 6:54
  • I think this is a totally different question. Don't mix them.
    – Marius
    Jul 17, 2014 at 6:55
  • it's done. Thank you!!! i use var nam = document.getElementById("search_cartridge").value; window.location="<?php echo $this->getUrl('catalogsearch/advanced/result/') ?>"+"?name="+nam; it also redirect to that page
    – MageDev
    Jul 17, 2014 at 8:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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