I've got a collection from the factory method getCollection(). The problem is that when I use get_class_methods($class) to list all the methods that the collection possesses I can't seem to find one which groups the records in the collection.
I found this How to use group by in magento collection with join query
But I don't have the group() method in my collection class. How can I group by in that case ?

1 Answer 1


You cannot use group directly from the collection.
But each collection has an instance of Zend_Db_Select associated to it. This is the actual query that is going to be executed when the collection is loaded.
So you can use:

$collection = ....
  • i have create a custom product attribute "sample_attribute" with drop down value i want to add group by in product collection but this gives unknown column how can i add group by in product collection Commented Mar 11, 2021 at 14:09

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.