Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

How to Add Search in a custom CMS Home page
 
xYcLoNe
Member
 
Avatar
Total Posts:  31
Joined:  2008-06-05
 

how can i add a search box in the CMS custom page?. ive created a Custom Home page but im not successful in adding a search box. thanks in advance…

 
Magento Community Magento Community
Magento Community
Magento Community
 
termid0g
Jr. Member
 
Total Posts:  8
Joined:  2008-12-04
 

Any ideas? anything????

 
Magento Community Magento Community
Magento Community
Magento Community
 
Reino
Sr. Member
 
Avatar
Total Posts:  78
Joined:  2008-06-22
Utrecht, The Netherlands
 

I have exactly the same.

in Admin, i have a custom homepage, i call a template there with the following code:

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

The form.mini.phtml looks like this:

<form id="search_mini_form" action="<?php echo $this->helper('catalogSearch')->getResultUrl() ?>" method="get">
        <
input id="search" type="text" name="<?php echo $this->helper('catalogSearch')->getQueryParamName() ?>" value="<?php echo $this->helper('catalogSearch')->getEscapedQueryText() ?>"/>
        <
input name="Submit" type="submit" />
        <
div id="search_autocomplete" class="search-autocomplete"></div>
        <
script type="text/javascript">
            var 
searchForm = new Varien.searchForm('search_mini_form''search''<?php echo $this->helper('catalogSearch')->__('Search entire store here...') ?>');
            
searchForm.initAutocomplete('<?php echo $this->helper('catalogSearch')->getSuggestUrl() ?>''search_autocomplete');
        
</script>
</form>

This will work, good luck.

 
Magento Community Magento Community
Magento Community
Magento Community
 
jean jack
Jr. Member
 
Avatar
Total Posts:  11
Joined:  2008-07-21
Russia
 

Reino, thanks. It works for me too.

 
Magento Community Magento Community
Magento Community
Magento Community
 
jamesrowe
Jr. Member
 
Total Posts:  10
Joined:  2009-04-21
 

Hi, that works really well but I just don’t understand how to learn from that and stop having to ask for how to inlcude things.

I can see where this example gets the template from - no problem.

I see the code that sets things up I think it gets from the app/code/core/Mage/Core/Block/Template.php file - is that correct?

Also, I don’t understand how the layout files fit into this?  Can you explain this?

Many thanks in advance

James

Reino - 02 March 2009 11:54 PM

I have exactly the same.

in Admin, i have a custom homepage, i call a template there with the following code:

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

The form.mini.phtml looks like this:
<form id="search_mini_form" action="<?php echo $this->helper('catalogSearch')->getResultUrl() ?>" method="get">
        <
input id="search" type="text" name="<?php echo $this->helper('catalogSearch')->getQueryParamName() ?>" value="<?php echo $this->helper('catalogSearch')->getEscapedQueryText() ?>"/>
        <
input name="Submit" type="submit" />
        <
div id="search_autocomplete" class="search-autocomplete"></div>
        <
script type="text/javascript">
            var 
searchForm = new Varien.searchForm('search_mini_form''search''<?php echo $this->helper('catalogSearch')->__('Search entire store here...') ?>');
            
searchForm.initAutocomplete('<?php echo $this->helper('catalogSearch')->getSuggestUrl() ?>''search_autocomplete');
        
</script>
</form>

This will work, good luck.
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top