The default Magento catalog grid is set to display 3 products per column. Most users alter the number of columns by modifying the file catalog/product/list.phtml
. There’s actually a much cleaner approach to this task and you only need to modify an XML file.
Open the catalog.xml
file which can be found in the location below:
/app/design/frontend/<package-name>/<theme>/layout/catalog.xml
Locate the line that declares the block for product listing similar to the one below:
<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
Immediately after the code above, add the XML node below:
<action method="setColumnCount"><columns>4</columns></action>
Save the file and clear the contents of your var/cache
directory. Reload the catalog page to see the changes 🙂
Note: You can also apply this to catalogsearch.xml
or any layout XML file that uses the list.phtml
Sometimes magento truly makes me crazy! Thanks for the short tutorial. Short but constructive 😉
Thanks a bunch, this is definitely the most elegant way to solve the problem.