How to embed Google Custom Search in Magento

Featured Image

For those of you who love Google Custom Search and would like to use it with the Magento, here is a little how to. Entire embed process is really easy. It all comes down to copy paste-ing few lines of code from Google to Magento. My idea is to create the static block in Magento CMS section and then use the custom CMS page from which I will call this statick block among other HTML content I might wish to throw into the CMS page.

For starters, we need to create Google Custom Search engine. Attached are few screenshots to see how it looks.

Once we have created the necesery search engine, we will copy-paste the embed code into the static block of Magento, lets say we login to Magento, and create static block with identifier “custom-google-search-engine”.

For our last step, we will create a CMS page, giving it SEF URL Identifier “custom-search”, and placing the following {{block type=”cms/block” block_id=”custom-google-search-engine”}} block call into the content area.

That’s it. Now when you visit the url like http://myshop.domain/custom-search you will see the result like shown on photo below.

CC Image credits.

10
Top

Enjoyed this post?

Subscribe to our RSS Feed, Follow us on Twitter and spread it to your friends!

Author

Branko is Inchoo's CTO with over 3 years of active / everyday full time Magento development.

Other posts from this author

Discussion 10 Comments

Add Comment
  1. sky

    thanks for the post, now I know how easy it is to integrate google custom search into magento.

  2. mark

    this looks great, but do the results come from only the pages google has in its index? for example, my site has over 2000 pages but google only has about 1800 of them in its index due to low link juice, etc on some pages. so now those pages will not be part of the search results. correct me if im wrong? (i hope)

  3. Dan

    @Mark: Google will use the existing pages it has indexed for your website. They offer an “On-Demand” indexing service which provides you with 50 additional urls which will be indexed solely for your search engine. If you want more urls indexed then you need to pay for them. Pricing is available here: http://www.google.com/support/customsearch/bin/answer.py?hl=en&answer=115958

  4. mark

    ok, thats what I thought, pretty disappointing. I think you are much better off using the Magento search. At least with that you know all products will show up, you can taylor the results and you see images of all the items.

  5. This is dissapointing as Google commerce search starets at £19k. I guess you get what you pay for. I would much rather see an SOLR search extension for the community edition. If anybody could point me in the right direction I would be very apreciative.

  6. Thanks branko, it is great tutorial to embed google custom search with magento

  7. Solr for CE maybe would be too heavy solution, but there is Blast Search Lucene extension which does the job properly

  8. Can you place the search box & button in the standard area in the header? Thanks.

  9. Joshua

    I followed all the steps but how do you actually get it to work to place search box & button in the standard area in the header. Do you edit the form.mini.phtml?

  10. I preffer SOLR to Google Site search, but this is only for Enterprise. This is a great solution for Community sites.

Add Your Comment

Please wrap all source codes with [code][/code] tags.
Top