We want to change below line:

->joinField('store_credit','kartparadigm_storecredit_creditinfo','total_credits', 'c_id=entity_id', null, 'left');

with this one:

->joinField('store_credit','kartparadigm_storecredit_creditinfo','total_credits', 't_id =(SELECT t_id FROM `kartparadigm_storecredit_creditinfo` WHERE c_id = e.entity_id ORDER BY action_date DESC LIMIT 1)', 'null', 'left');

Can anyone Please suggest me how to solve this error.


$collection->getSelect()->group('id_field_name_here') is probably a bit more efficient than using a select sub query. It's also how Magento deals with this issue.


Finally I got my answer Here is right code:

 ->joinField('store_credit', 'kartparadigm_storecredit_creditinfo', 'total_credits', 'c_id = entity_id', 't_id =(SELECT tbl1.t_id FROM kartparadigm_storecredit_creditinfo as tbl1 WHERE tbl1.c_id = e.entity_id ORDER BY tbl1.t_id DESC LIMIT 1)', 'left');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.