Magento customize catalogsearch result html

こ雲淡風輕ζ 提交于 2019-12-23 02:36:44

问题


I'd like to customize the layout for the result page of CatalogSearch.

I'd like to remove the pagination and all other tools on the page and show a much simpler page since we only have few products. Then I need to change how results are displayed to customize the size of images and add a rollover on images.

How can I do that? By looking at the source code it calls $this->getProductListHtml().


回答1:


The easiest way to determine which template files to edit, is to enable the "Template Path Hints" in your Magento Configuration.

To do this, do the following:

  1. In your Magento Admin, go to System > Configuration > Developer

  2. On the top left under Current Configuration Scope, select Main Website (or the name of the site you are trying to modify.)

  3. Now on the right, set Template Path Hints to Yes and click Save Config

  4. Go back to your frontend. Each section will now display the exact template you need to modify. NOTE: You should always copy the default template files to your own template directory, instead of modifying Magento's core theme.


Alternately, you can target each page in Magento using CSS. Magento assigns a unique class to each page's <body> tag

In your case, the Catalog Search Results page has a body class of catalogsearch-result-index. If you want to hide the toolbar on that page, you can add the following to your template's style.css file:

.catalogsearch-result-index .toolbar {
   display: none;
}


来源:https://stackoverflow.com/questions/12431767/magento-customize-catalogsearch-result-html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!