• Join Now
  • Sign In
  • Cart
  • Instant Setup
  • Download
Logo
  • About
    • Try it Out
    • For Developers
    • For Agencies
    • For Designers
    • For Anyone
    • Testimonials
    • Showcase
    • History
    • Our Philosophy
    • Credits
    • What does free mean?
    • Blog
  • Community
    • Members
    • Forums
    • Chat
    • Karma
    • International
    • Jobs
    • eNewsletters
  • Developers
    • Download concrete5
    • Join Beta Team
    • Translate concrete5
    • Bug Tracker
    • Submit to Marketplace
    • Code Submissions
    • News
    • Community Leaders
  • Marketplace
    • Add-Ons
    • Themes
    • Add-on Installation
    • Deal Of The Day
    • Swag
    • Theme Contest 2012
  • Services
    • Hosting
    • Support Options
    • Consulting
    • Training
    • Enterprise
  • Documentation
    • Getting Started
    • Editor's Guide
    • Developers Guide
    • How-Tos
  • How-Tos

Override Site Search Block to Search Through eCommerce Product Titles Only and Return Only Products

Posted byEvanCooper in Developers on Feb 03, 2012.
3 people like this.

In some instances, it's useful to override and modify the sitewide search block to search only eCommerce product titles and return only products. Here is a good way to achieve that:

First, you need override your search block (copy the search block directory from the core and place a copy of it into your override block directory in the site root) and make some modifications to the controller.php file.

Within the:

function do_search()

find the following:

$ipl->setSimpleIndexMode(true);
      if (isset($_REQUEST['query'])) {
         $ipl->filterByKeywords($_q);
      }

and modify it like so:

$ipl->setSimpleIndexMode(true);
      if (isset($_REQUEST['query'])) {
         //$ipl->filterByKeywords($_q);
         $ipl->filterByName($_q);
      }
         $ipl->filterByCollectionTypeHandle('product_detail');

Note: You need to make sure your products are set to have their own pages in order for this to work.

There you go! Now your search only looks through product names and returns only product pages.

How-To Tags

ecommerce, search, products

Related How-Tos

None.

  • Documentation
  • How-Tos
  • Developers
  • Override Site Search Block to Search Through eCommerce Product Titles Only and Return Only Products

Do you have questions

  • What are users saying?
  • Who is using concrete5?
  • What makes concrete5 easy?
  • Why develop on concrete5?
 

We’re on “The Twitter”

管理画面のJobsはどこにいったかか分かりますか ( #concrete5 live at http://t.co/W3tCUvlA)

Follow concrete5

About

  • Try it Out
  • For Developers
  • For Agencies
  • For Designers
  • For Anyone
  • Testimonials
  • Showcase
  • History
  • Our Philosophy
  • Credits
  • What does free mean?
  • Blog

Community

  • Members
  • Forums
  • Chat
  • International
  • Jobs
  • eNewsletters

Developers

  • Download concrete5
  • Join Beta Team
  • Translate concrete5
  • Bug Tracker
  • Beta
  • Submit to Marketplace
  • Code Submissions
  • News
  • Community Leaders
  • User Doc Group

Marketplace

  • Add-Ons
  • Themes
  • Add-on Installation
  • Deal Of The Day
  • Swag

Services

  • Hosting
  • Support Options
  • Consulting
  • Training
  • Enterprise

Documentation

  • Getting Started
  • Editor's Guide
  • Developers Guide
  • How-Tos

Legal

  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Contact Us
© 2008 to 2012 Concrete CMS Inc. All Rights Reserved.

Sign In?

You must have a user account and be signed to perform this action.

  • Sign In
  • Register