Fatal error: Uncaught Error: Call to a member function isSuggestionsAllowed() on null in /opt/lampp/htdocs/magx/var/view_preprocessed/pub/static/vendor/magento/module-search/view/frontend/templates/form.mini.phtml:27 on line 27

I have installed a new theme in Magento 2.3.6 which is https://www.hiddentechies.com/etrend-lite-free-magento-2-theme.html

But when i install this theme and applying on frontend i am getting this error. Here is my form.mini.phtml.

    <?php $helper = $this->helper(\Magento\Search\Helper\Data::class);
$configProvider = $block->getData('configProvider');

div class="block block-search">
    <div class="block block-title"><strong><?= $block->escapeHtml(__('Search')) ?></strong></div>
    <div class="block block-content">
        <form class="form minisearch" id="search_mini_form"
              action="<?= $block->escapeUrl($helper->getResultUrl()) ?>" method="get">
            <div class="field search">
                <label class="label" for="search" data-role="minisearch-label">
                    <span><?= $block->escapeHtml(__('Search')) ?></span>
                <div class="control">
                    <input id="search"
                            <?php if ($configProvider->isSuggestionsAllowed()):?>
                                    "url":"<?= $block->escapeUrl($helper->getSuggestUrl())?>",
                                    "minSearchLength":"<?= $block->escapeHtml($helper->getMinQueryLength()) ?>"}
                            <?php endif;?>
                           name="<?= $block->escapeHtmlAttr($helper->getQueryParamName()) ?>"
                           value="<?= /* @noEscape */ $helper->getEscapedQueryText() ?>"
                           placeholder="<?= $block->escapeHtmlAttr(__('Search entire store here...')) ?>"
                           maxlength="<?= $block->escapeHtmlAttr($helper->getMaxQueryLength()) ?>"
                    <div id="search_autocomplete" class="search-autocomplete"></div>
                    <?= $block->getChildHtml() ?>
            <div class="actions">
                <button type="submit"
                    title="<?= $block->escapeHtmlAttr(__('Search')) ?>"
                    class="action search"
                    <span><?= $block->escapeHtml(__('Search')) ?></span>
  • Do you want to get $configProvider value from helper class? Dec 29 '20 at 9:26
  • here is my config provider function public function isSuggestionsAllowed(): bool { return $this->scopeConfig->isSetFlag( self::SEARCH_SUGGESTION_ENABLED, ScopeInterface::SCOPE_STORE ); } Dec 29 '20 at 9:31
  • are you sure you're calling the right helper at <?php $helper = $this->helper(\Magento\Search\Helper\Data::class);? Dec 29 '20 at 9:49

what php version you that used ?
You should run setup:upgrade and di compilation first, after that run static deploy. If that way not work try switch back your enviroment to default magento 2 theme for check problem. If problem not happen this maybe root cause issue come from custom theme

Another possible is block name top.search was removed somewhere in theme or custom modules

  • 2.3.6 is my magento version Dec 31 '20 at 9:11
  • i already know that in your description but you don't mention php version! maybe wrong php version could cause issue
    – mrtuvn
    Dec 31 '20 at 9:13
  • My php version is 7.3 Dec 31 '20 at 10:56
  • Have you check updated note above in my answer
    – mrtuvn
    Dec 31 '20 at 17:40

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.