1

I need to add the search param in the title of the block. Currently i have on catalogsearch_result_index.xml

<referenceBlock name="page.main.title">
            <action method="setPageTitle">
                <argument translate="true" name="title" xsi:type="string">Searched For: </argument>
            </action>
</referenceBlock>

The above displays

Searched For:

However, I need to display

Searched For: test

as the title of the catalog search

8
  • Are you want to change Search Result for : test to Searched For:test? Commented Dec 7, 2016 at 10:10
  • No, I am able to display "Searched For: ", but i need to display "Search For: {searchWord}" Commented Dec 7, 2016 at 10:11
  • You dont need to do using xml you have to just create en_US.csv file in your theme and replace "Search results for: '%1'","Searched for: '%1'" Commented Dec 7, 2016 at 10:15
  • can you please be a bit more elaborate! Commented Dec 7, 2016 at 10:17
  • Have you create custom theme? Commented Dec 7, 2016 at 10:18

1 Answer 1

0

You dont need to do using xml file.

You can simply do it using csv file. You have to just create en_US.csv file in your theme.

app/design/frontend/{Vendorname}/{themename}/i18n/en_US.csv file.

Add below line in your csv,

"Search results for: '%1'","Searched For: '%1'"

After changes above,

Run deploy command,

php bin/magento setup:static-content:deploy

Clear cache.

5
  • I tried this, but did not work.. Instead i removed page title xml and called in a custom block Commented Dec 9, 2016 at 10:28
  • Its working fine may be you have placed this csv file at wrong place. Commented Dec 9, 2016 at 10:54
  • Could be. i placed it in Magento_CatalogSearch/il8n/en_US.csv also at {Vendorname}/{themename}/i18n/en_US.csv then refreshed cache etc, it just showed %1 , Commented Dec 9, 2016 at 11:04
  • You have to remove from Magento_CatalogSearch/il8n you have to keep inside only {Vendorname}/{themename}/i18n and run deploy command. Commented Dec 9, 2016 at 11:08
  • Have you solved your issue? Commented Dec 9, 2016 at 12:09

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.