문제

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?

도움이 되었습니까?

해결책

This should work:

$this->getCollection()->getSelect()->group('product_id')
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top