Pergunta

I have non-EAV model which extends Mage_Core_Model_Resource_Db_Collection_Abstract.

This is my code:

$this->getCollection()
        ->removeAllFieldsFromSelect()
        ->removeFieldFromSelect('credit_id')
        ->addFieldToSelect('product_id')
        ->addExpressionFieldToSelect('income', 'SUM({{income}})', 'income');

I need to group by *product_id* but all parents classes doesn't have this function. Is it possible to group by somehow?

Foi útil?

Solução

This should work:

$this->getCollection()->getSelect()->group('product_id')
Licenciado em: CC-BY-SA com atribuição
Não afiliado a magento.stackexchange
scroll top