cancel
Showing results for 
Search instead for 
Did you mean: 

How do I change the number of columns on the New Products Grid?

SOLVED

How do I change the number of columns on the New Products Grid?

I would like to customise the New Products Grid.

 

I've set up a new widget using "Manage Widget Instances", and selected "Catalog New Products List" as the type.

In Layout Updates, I selected "Main Content Area" and "New Products Grid Template"

On the Widget Options, I selected "New Products" as the display type and entered 10 products to display.

 

It all works fine - but I would like to change the number of columns from 5 to 3 (or 4, haven't decided!)

How do I do this? Where is the column count set?

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How do I change the number of columns on the New Products Grid?

its defined in Mage_Catalog_Block_Product_New::_construct

 

    protected function _construct()
    {
        parent::_construct();

        $this->addColumnCountLayoutDepend('empty', 6)
            ->addColumnCountLayoutDepend('one_column', 5)
            ->addColumnCountLayoutDepend('two_columns_left', 4)
            ->addColumnCountLayoutDepend('two_columns_right', 4)
            ->addColumnCountLayoutDepend('three_columns', 3);

        $this->addData(array('cache_lifetime' => 86400));
        $this->addCacheTag(Mage_Catalog_Model_Product::CACHE_TAG);
    }

 its easier to rewirte this class, but the best option would be to add a column count option to this widget.

View solution in original post

2 REPLIES 2

Re: How do I change the number of columns on the New Products Grid?

its defined in Mage_Catalog_Block_Product_New::_construct

 

    protected function _construct()
    {
        parent::_construct();

        $this->addColumnCountLayoutDepend('empty', 6)
            ->addColumnCountLayoutDepend('one_column', 5)
            ->addColumnCountLayoutDepend('two_columns_left', 4)
            ->addColumnCountLayoutDepend('two_columns_right', 4)
            ->addColumnCountLayoutDepend('three_columns', 3);

        $this->addData(array('cache_lifetime' => 86400));
        $this->addCacheTag(Mage_Catalog_Model_Product::CACHE_TAG);
    }

 its easier to rewirte this class, but the best option would be to add a column count option to this widget.

Re: How do I change the number of columns on the New Products Grid?

Thanks. Looks fairly straightforward. Where would I find "Mage_Catalog_Block_Product_New"?

 

Do you mean this one in Core: /app/code/core/Mage/Catalog/Block/Product/new.php

(I can copy that to Local)

 

Also, how would I go about adding a column count option to the widget?