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 do i add the search box within the front page html? 
 
rwone
Sr. Member
 
Total Posts:  174
Joined:  2009-02-12
 

Hello,

Is it possible to add the search box within the html on the front page?

So for example i’d like to have on the front page:

‘Welcome to this site, use the search box below to find products’. 

[Search Box Here]

So ideally i would go to CMS>Manage Pages>Home

And then add the code for the search box in there?

Any tips or advice much appreciated!

Thanks Heaps!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Adam Moss
Sr. Member
 
Avatar
Total Posts:  248
Joined:  2009-02-11
Birmingham, UK
 

Rather than copying the code straight you need to copy the block. Try using this code:

{{block type="core/template" name="top.search" as="topSearch" template="catalogsearch/form.mini.phtml"}}
 
Magento Community Magento Community
Magento Community
Magento Community
 
rwone
Sr. Member
 
Total Posts:  174
Joined:  2009-02-12
 

ah just did fast reply and clicked submit post and lost it all, ai yai yai!

so again, thanks very much for your reply.

i tried your suggestion and added:

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

to the front page html.

it produced a search box in the top right hand area, which i gather must be its default location, but it was behind a div i had placed in header.phtml.

so i thought, rather than have the search box in the front page html, lets just have it in the header.phtml area, the way nature intended smile

buuut, when i put the search box code in the header.phtml file, it just outputted the text and not the search box.

can u please tell me how i can get the search box appearing in the header.phtml area?

thank you very much!

*control a, control c, submit post! smile *

 
Magento Community Magento Community
Magento Community
Magento Community
 
rwone
Sr. Member
 
Total Posts:  174
Joined:  2009-02-12
 

ah just found post that showed me this code was required in header.phtml:

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

now, i am just working on trying to get it to display properly in a div i created!

 
Magento Community Magento Community
Magento Community
Magento Community
 
brianb421
Sr. Member
 
Total Posts:  196
Joined:  2009-04-23
 
Magento Fox - 02 February 2010 07:56 AM

Rather than copying the code straight you need to copy the block. Try using this code:

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

Thank you! This worked great on CMS Pages and Static Blocks on Magento 1.4 and 1.5.

Note: the double {{ and }} enclosing the code are important. I missed the double {{ when copying it over and found it won’t work without {{ .

Thanks for the help!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Technoduce
Jr. Member
 
Total Posts:  19
Joined:  2012-10-15
 
Magento Fox - 02 February 2010 07:56 AM

Rather than copying the code straight you need to copy the block. Try using this code:

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

Thanks for this useful info.

 
Magento Community Magento Community
Magento Community
Magento Community
 
chuckles3
Jr. Member
 
Total Posts:  2
Joined:  2012-11-27
 
Technoduce - 21 November 2012 08:08 PM

Magento Fox - 02 February 2010 07:56 AM
Rather than copying the code straight you need to copy the block. Try using this code:

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

Thanks for this useful info.

yes thank you very much

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top