3

I want to show 4 products in one row on my Magento site. I tried some tricks but it doesn’t work..

I set this in list.phtml

<?php $_columnCount = 4; ?>

but nothing..

I also put this in catalog.xml

<action method="setColumnCount"><count>4</count></action>

Here is my list.phtml and my catalog.xml

This is my screenshot:

enter image description here

1

2 Answers 2

3

You can set the column count through the layout XML. I'm guessing your homepage is a CMS page so the block was probably added in the Design tab under Layout Update XML.

The XML syntax should look something like this for adding the list and setting the column count.

[...]
<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
    <action method="setColumnCount"><count>4</count></action>
</block>
[...]
3
  • Yes, i add this to my cms page to show products from one category . '{{block type="catalog/product_list" category_id="14" template="catalog/product/list.phtml" column_count="4""}}' Where i need to put that blocks... This is my Layout Update XML pastebin.com/mv22uugD Commented Feb 19, 2014 at 11:39
  • ah ok, you've added it through the content editor in that case. If you print $this->getColumnCount(); in the list.phtml what do you get on the homepage? Commented Feb 19, 2014 at 11:41
  • I put this in list.phtml but nothing happend.. line 92.. <?php $_columnCount = 4; ?> Commented Feb 19, 2014 at 11:58
0

You have everything doubled in this template, as it is used for two cases. you have set it for the wrong, there should be a second where you could set it and it has effect.

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.