Question

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.

Was it helpful?

Solution 2

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');

OTHER TIPS

$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.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top