I have a question about Magento and it's catalog.

In short: what I'm trying to do is: I have a grid layout of a certain category on my homepage. Only it shows with 3 columns. And I want it to show with 4 columns.


Now the full explanation:

As I explained i loaded a category of products on my homepage. I did that with the following code

{{block type="catalog/product_list" category_id="10" template="catalog/product/spotlight.phtml"}}

and just the following piece of template (in list.phtml):

// Non relevant code

<?php // Grid Mode ?>

<?php $_collectionSize = $_productCollection->count() ?>
<?php $_columnCount = $this->getColumnCount(); ?>
<?php $i=0; foreach ($_productCollection as $_product): ?>
    <?php if ($i++%$_columnCount==0):

// Non relevant code

As you can see it uses this piece

<?php $_columnCount = $this->getColumnCount(); ?>

I can't seem to find where it gets it's count. On all the other pages it indeed shows 4 columns (which i can change in the catalog.xml)

// Simplified code
<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
    <action method="setColumnCount"><count>4</count></action>
</block>

Everywhere it shows setColumnCount: 4. In every xml in the modern template I could find. But I just can't seem to find where to change the setColumnCount for the homepage layout.

Can anybody help me with that?

有帮助吗?

解决方案

Yes, I found the answer :)

Pretty simple actually.

Just add

column_count="4"

in

{{block type="catalog/product_list" category_id="10" template="catalog/product/spotlight.phtml"}}

and then it becomes:

{{block type="catalog/product_list" category_id="10" column_count="4" template="catalog/product/spotlight.phtml"}}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top