Skip to content

Search result page override #1880

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ankursachdeva11 opened this issue Sep 15, 2015 · 2 comments
Closed

Search result page override #1880

ankursachdeva11 opened this issue Sep 15, 2015 · 2 comments
Assignees

Comments

@ankursachdeva11
Copy link

I am trying to override Search result page to show my own template.

I have did --

  1. created di.xml and overrides the controller like this -

< preference for="Magento\CatalogSearch\Controller\Result\Index" type="CompanyName\Search\Controller\Search\Result" / >

  1. In CompanyName/Search/Controller/Search/Result.php, i have used this code -

namespace CompanyName\Search\Controller\Search;
class Result extends \Magento\CatalogSearch\Controller\Result\Index
{
public function execute($coreRoute = null)
{
return parent::execute($coreRoute);
}
}

  1. in view/frontend/layout/, i have created catalogsearch_result_index.xml and used

< referenceContainer name="content" >
< block class="CompanyName\Search\Block\Search" template="CompanyName_Search::search/result.phtml" / >
< /referenceContainer >
4. created template file and put my code there.

After doing all this, it is appending my content to magento default search result.
screen

but i want to override this. Please help me to do this is in appropriate way.

@ankursachdeva11
Copy link
Author

Override done.
I forgot to use name attribute into the block tag.

but i need to stop override on the basis of system configuration option.

When 'Yes', then it will override the controller.
When 'No' then it will show default controller.

Is there any way to do this?

@maksek
Copy link
Contributor

maksek commented May 9, 2016

GitHub issue must contain bug description with steps to reproduce, all HowTo questions please post in forum or other sources.

@maksek maksek closed this as completed May 9, 2016
magento-team pushed a commit that referenced this issue Dec 27, 2017
Fixed issue:
  - MAGETWO-82888: [Performance] Product Price indexer stuck during reindexing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants