Categories

Featured templates

Magento. How to change number of columns on search results page

Martin Clarke March 7, 2016
Rating: 5.0/5. From 3 votes.
Please wait...

This tutorial will show you how to change number of columns on search results page in Magento.

Magento. How to change number of columns on search results page
  1. Connect to your FTP or access your site files via Cpanel and navigate to app/design/frontend/tm_themes/themexxx/template/tm/productlistgallery, where themexxxx is your theme. In this directory locate list.phtml file. You can edit it in cpanel or download it and edit using any text editor, such as Sublime or Notepad++:

    Magento. How to change number of columns for search results page-1
  2. In list.phtml file locate the following code (around line 155):

    getColumnCount(); ?>
    

    Now replace it with:

    getColumnCount(); ?>
    

    It will comment out the default 3 columns layout and enable custom option.

  3. Add the following code below the code you just replaced in list.phtml, the code will set 3 column layout for all pages, which are not search results pages, and 4 columns for search results page:

    getRequest()->getControllerName()=='result' || $this->getRequest()->getControllerName()=='advanced') {
    	$col_class='col-sm-3';
    	} else {
    	$col_class='col-sm-4';
    }
    ?>

    Now locate in list.phtml (approximately line 163):

  4. And replace col-sm-4 with:

    It will load a dynamic class you specified in the “if” statement earlier on this step.

  5. After the changes save the file and update it on your server. Now navigate to app/design/frontend/tm_themes/themexxxx/layout/, where themexxxx is your theme. In this directory locate tm_productlistgallery.xml file and start editing it in the same way as the previous file:

    Magento. How to change number of columns for search results page-2

    On lines 37-57 find the following code:

    
    	
    		
    			
    			
    			
    		
    	
    
    
    	
    		
    			
    			
    
    			
    		
    
    
    	
    

    And replace it with:

    
    	
    		
    			
    			
    			
    			4
    		
    	
    
    
    	
    		
    			
    			
    			
    			4
    		
    	
    

    It will allow the columns on the search page to be divided in 4 and each contains 4 items.

  6. Now search results will be displayed in 4 columns. You can also clear or disable Magento cache, if the results are still being displayed in 4 columns.

Thank you for checking our tutorial. Now you know how to change number of columns for search results page in Magento.

Feel free to check the detailed video tutorial below:

Magento. How to change number of columns on search results page
Magento Ecommerce Templates
This entry was posted in Magento Tutorials and tagged column, Magento, number, page, results, search. Bookmark the permalink.

Submit a ticket

If you are still unable to find a sufficient tutorial regarding your issue please use the following link to submit a request to our technical support team. We'll provide you with our help and assistance within next 24 hours: Submit a ticket