3

I want to do two different search types in two different search forms.

I got the head search in fulltext and i created a quicksearch.phtml to edit this as a title only search.

Is there a way to set the "title only search" settings in my quicksearch.phtml or the form.mini.phtml?

Code of quicksearch.phtml:

<?php
/* @var $this Mage_Core_Block_Template */
/* @var $catalogSearchHelper Mage_Catalogsearch_Helper_Data */
$catalogSearchHelper =  $this->helper('catalogsearch');
?>
<form id="search_mini_form" action="<?php echo $catalogSearchHelper->getResultUrl() ?>" method="get">
    <div class="form-search">
        <div class="input-group">
            <input id="search" type="text" name="<?php echo $catalogSearchHelper->getQueryParamName() ?>" value="<?php echo $catalogSearchHelper->getEscapedQueryText() ?>" class="input-text form-control" maxlength="<?php echo $catalogSearchHelper->getMaxQueryLength();?>">
            <span class="input-group-btn">
                <button type="submit" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Search')) ?>" class="btn btn-default"></button>
            </span>
        </div>

        <div id="search_autocomplete" class="search-autocomplete"></div>
        <script type="text/javascript">
        //<![CDATA[
            var searchForm = new Varien.searchForm('search_mini_form', 'search', '<?php echo Mage::helper('core')->jsQuoteEscape($this->__('Suchbegriff eingeben...')) ?>');
            searchForm.initAutocomplete('<?php echo $catalogSearchHelper->getSuggestUrl() ?>', 'search_autocomplete');
        //]]>
        </script>
    </div>
</form>

by the way i got Magento 1.9.2.4

  • i know, that the settings are normaly made in the backend/admin panel but this have to be a different search on the same site. – MCSell Jun 6 '16 at 6:53
2

Simple solution: Point your "title only" search form to Mage::getUrl('catalogsearch/advanced/result') and change the name of the search input field to name="name" (or name="meta_title or whatever you use as "title" attribute).

Drawback: You will lose the autocomplete feature. To not see errors or wrong results, remove the "search_autocomplete" div and the following script.

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.