1

I declared a specific category in the dashboard of account in Magento but the list shows only 4 products for row. How can I display 6 or 8 products for row?

This is my code

echo $this->getLayout()->createBlock("catalog/product_list")->setTemplate("catalog/product/list.phtml")->setCategoryId('105')->toHtml();

Thanks

1 Answer 1

1

getColumnCount() function is used to get the number of columns to be visible per row. So you can use setColumnCount() function to set the column count value.

You can use this code to show 6 products per row:

<?php echo $this->getLayout()->createBlock("catalog/product_list")->setTemplate("catalog/product/list.phtml")->setCategoryId('3')->setColumnCount(6)->toHtml();?>

You can change the value 6 to 8 in setColumnCount() function to show 8 products per row.

8
  • I tried man but i see ever 4 products for row in my dashboard...why?
    – Gabriel91
    Jun 28, 2018 at 10:16
  • Have you refreshed cache after making the changes, because I first tested the code in my localhost before posting here. Jun 28, 2018 at 10:19
  • I cleared cache but i see ever 4 products for row.
    – Gabriel91
    Jun 28, 2018 at 10:38
  • Then I think you have modifications in the list.phtml or List.php file. Jun 28, 2018 at 11:20
  • Any modifications in list.phtml or list.php for display the products in row. In list.phtml i have the standard code for the columns: $_columnCount = $this->getColumnCount();
    – Gabriel91
    Jun 28, 2018 at 12:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.