cancel
Showing results for 
Search instead for 
Did you mean: 

Make custom columns in product grid sortable

Make custom columns in product grid sortable

Hello everybody,

 

i've customized my product grid an added some custom columns. One of them displays the number of orders of this product. In a new extension i did a rewrite of the class Mage_Adminhtml_Block_Catalog_Product_Grid and the functions _prepareColumns() and _prepareCollection(). I've added the column with $this->addColumn(...) and used a renderer to get and return the data.

 

Everything works fine except for the sorting and the filter. Clicking the respective buttons in the product grid doesn't have an effect on the rows.

 

Can someone help me fix that problem?

 

Thanks a lot!

2 REPLIES

Re: Make custom columns in product grid sortable

is the number of orders actually an int attribute of product? If not, you will have to create customized sort and filter method for this column

http://magento.stackexchange.com/questions/4061/column-isnt-sorting-in-custom-admin-report

Re: Make custom columns in product grid sortable

@nah_do

 

 

First check the _prepareCollection() function, return the collection and check if your fields are included in this or not, you may required to use Join if the your column is not included into the collection.

Found something useful, please give "Kudos" or "Accept as Solution" for Token of Appreciation.
Free Magento Extensions : https://magecomp.com/free-magento-extensions.html