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

  • Are you want to change Search Result for : test to Searched For:test? – Rakesh Jesadiya Dec 7 '16 at 10:10
  • No, I am able to display "Searched For: ", but i need to display "Search For: {searchWord}" – Hammad Khalid Dec 7 '16 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'" – Rakesh Jesadiya Dec 7 '16 at 10:15
  • can you please be a bit more elaborate! – Hammad Khalid Dec 7 '16 at 10:17
  • Have you create custom theme? – Rakesh Jesadiya Dec 7 '16 at 10:18
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.

  • I tried this, but did not work.. Instead i removed page title xml and called in a custom block – Hammad Khalid Dec 9 '16 at 10:28
  • Its working fine may be you have placed this csv file at wrong place. – Rakesh Jesadiya Dec 9 '16 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 , – Hammad Khalid Dec 9 '16 at 11:04
  • You have to remove from Magento_CatalogSearch/il8n you have to keep inside only {Vendorname}/{themename}/i18n and run deploy command. – Rakesh Jesadiya Dec 9 '16 at 11:08
  • Have you solved your issue? – Rakesh Jesadiya Dec 9 '16 at 12:09

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.