Smile-SA / elasticsuite

Smile ElasticSuite - Magento 2 merchandising and search engine built on ElasticSearch
https://elasticsuite.io
Open Software License 3.0
763 stars 341 forks source link

Magneto 2.3+ Ultimo2.8 Search Bar Solution #1316

Closed pasujemito closed 5 years ago

pasujemito commented 5 years ago

Preconditions

I've noticed a lot of users have got issues with the ultimo theme and the missing search bar and featured product so, here is a solution that fixes that issue.

Magento Version : 2.3

ElasticSuite Version : 2.7.1

Steps to fix missing search bar

  1. Create a new file app/design/frontend/Infortis/base/Smile_ElasticsuiteCore/templates/search/form.mini.phtml or under your own custom theme app/design/frontend/Infortis/custom_theme/Smile_ElasticsuiteCore/templates/search/form.mini.phtml
  2. Paste the following code:
<?php
/**
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Smile Elastic Suite to newer
 * versions in the future.
 *
 *
 * @category  Smile
 * @package   Smile\ElasticsuiteCore
 * @author    Romain Ruaud <romain.ruaud@smile.fr>
 * @copyright 2016 Smile
 * @license   Open Software License ("OSL") v. 3.0
 */

/**
 * Template for quick search mini form.
 * Overriden to manage template injection for the rendering of autocomplete results.
 *
 * @var $block \Smile\ElasticsuiteCore\Block\Search\Form\Autocomplete
 */
?>

<?php
/** @var $helper \Magento\Search\Helper\Data */
$helper = $this->helper('Magento\Search\Helper\Data');
?>
<div id="header-search" class="skip-content skip-content--style">
    <div class="block block-search">
        <div class="block block-title"><strong><?php /* @escapeNotVerified */
                echo __('Search'); ?></strong></div>
        <div class="block block-content">
            <form class="form minisearch" id="search_mini_form" action="<?php /* @escapeNotVerified */
            echo $helper->getResultUrl() ?>" method="get">
                <div class="field search">
                    <label class="label" for="search" data-role="minisearch-label">
                        <span><?php /* @escapeNotVerified */
                            echo __('Search'); ?></span>
                    </label>
                    <div class="control">
                        <input id="search"
                               data-mage-init='{"quickSearch":{
                                "formSelector":"#search_mini_form",
                                "url":"<?php /* @escapeNotVerified */
                               echo $block->getUrl('search/ajax/suggest'); ?>",
                                "destinationSelector":"#search_autocomplete",
                                "templates": <?php /* @noEscape */
                               echo $block->getJsonSuggestRenderers(); ?>,
                                "priceFormat" : <?php /* @noEscape */
                               echo $block->getJsonPriceFormat(); ?>}
                            }'
                               type="text"
                               name="<?php /* @escapeNotVerified */
                               echo $helper->getQueryParamName() ?>"
                               value="<?php /* @escapeNotVerified */
                               echo $helper->getEscapedQueryText() ?>"
                               placeholder="<?php /* @escapeNotVerified */
                               echo __('Search entire store here...'); ?>"
                               class="input-text"
                               maxlength="<?php /* @escapeNotVerified */
                               echo $helper->getMaxQueryLength(); ?>"
                               role="combobox"
                               aria-haspopup="false"
                               aria-autocomplete="both"
                               autocomplete="off"
                               data-block="autocomplete-form"/>
                        <div id="search_autocomplete" class="search-autocomplete"></div>
                        <?php echo $block->getChildHtml() ?>
                    </div>
                </div>
                <div class="actions">
                    <button type="submit"
                            title="<?php echo $block->escapeHtml(__('Search')) ?>"
                            class="action search">
                        <span><?php /* @escapeNotVerified */
                            echo __('Search'); ?></span>
                    </button>
                </div>
            </form>
        </div>
    </div>
</div>
  1. Run from magento root: bin/magento cache:clean && bin/magento setup:static-content:deploy -f
SerBab commented 4 years ago

Hi! I've changed the code as is written by @romainruaud in #330. It solved "Error on Interceptor::addSortFilterParameters()" Than I've addead the above code to app/design/frontend/Infortis/base/Smile_ElasticsuiteCore/templates/search/form.mini.phtml and app/design/frontend/Infortis/Ultimo/Smile_ElasticsuiteCore/templates/search/form.mini.phtml but haven't search bar yet. Magento Version : 2.4.0 ElasticSuite Version : 2.10.1

What's wrong?