Magento 2.1 – How to Display Blank Page on Search Terms Page

magento-2.1search-terms

I can see some search queries on MARKETING, SEO & SEARCH, Search Terms of the admin page. However, the SEARCH TERMS page of frontend displays the blank.

Some people mentioned hat this error happens in version 2.1 even though it works in version 2.0.7.

I appreciate if you give advice or solutions.

Thank you.

Best Answer

Appears to be a bug in 2.1. The code is trying to get the "name" of the search term when it should be asking for the "query_text."

You can get it to work by updating the following two files:


File Magento/Search/Block/Term.php.

94. $temp[$term->getName()] = $term;
94. $temp[$term->getData('query_text')] = $term;

95. $termKeys[] = $term->getName();
95. $termKeys[] = $term->getData('query_text');

127. $url->setQueryParam('q', $obj->getName());
127. $url->setQueryParam('q', $obj->getData('query_text'));

File Magento/Search/view/frontend/templates/term.phtml.

16. escapeHtml($_term->getName()) ?>
16. escapeHtml($_term->getData('query_text')) ?>
Related Topic