0

Is there a way to edit serach term format in search landing page title.

For example, how to change from: SEARCH RESULTS FOR TEST to: SEARCH RESULTS FOR "TEST"

1 Answer 1

0

By default, Magento already has a single quote appended to the search term. Like:

enter image description here

However, if you wish to change it, you can add a translation string to the en_US.csv file and add the below strings

Search results for: '%1'

Translate to

Search results for "%1"

Or If the above doesn't work, you can also create a preference or plugin of the class, \Magento\CatalogSearch\Block\Result and modify the method getSearchQueryText

From:

/**
     * Get search query text
     *
     * @return \Magento\Framework\Phrase
     */
    public function getSearchQueryText()
    {
        return __("Search results for: '%1'", $this->catalogSearchData->getEscapedQueryText());
    }

To

/**
     * Get search query text
     *
     * @return \Magento\Framework\Phrase
     */
    public function getSearchQueryText()
    {
        return __('Search results for: "%1"', $this->catalogSearchData->getEscapedQueryText());
    }

Result:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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