We have two product types in our Magento catalog/store, "default" and "Machine." Wondering if there's a way to set up a search page for each to only perform search in a specific attribute set. Default search code below. Can I modify this? If so, how? If not, any recommendations to best achieve?

<form id="search_mini_form" action="<?php echo $catalogSearchHelper->getResultUrl() ?>" method="get">
    <div class="form-search">
        <input id="search" type="text" name="<?php echo $catalogSearchHelper->getQueryParamName() ?>" placeholder="Search" class="input-text" maxlength="<?php echo $catalogSearchHelper->getMaxQueryLength();?>"/>
        <button type="submit" title="<?php echo $this->__('Search') ?>" class="button"><span><span><?php echo $this->__('Search') ?></span></span></button>
        <div id="search_autocomplete" class="search-autocomplete"></div>
        <script type="text/javascript">
            var searchForm = new Varien.searchForm('search_mini_form', 'search', '<?php echo $this->__('Search') ?>');
            searchForm.initAutocomplete('<?php echo $catalogSearchHelper->getSuggestUrl() ?>', 'search_autocomplete');

1 Answer 1


You need add filter to catalogsearch results template magento_dir/app/design/frontend/../.../catalogsearch/result.phtml


Mage::getSingleton('catalogsearch/layer')->getProductCollection()->addFieldToFilter('addAttributeToFilter', <ATTRIBUTE_SET_ID>);
  • Where do I place that code in result.phtml? Also, how do I make two separate search templates?
    – frshjb373
    Jul 18, 2014 at 16:16
  • Can you please elaborate?
    – frshjb373
    Jul 20, 2014 at 21:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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