3

I am trying to filter columns from a joined table using addFieldTofilter. I have tried the code below but throws an exception.

$collection->getSelect()
    ->joinInner(array('customerphotos' => $collection->getTable('myphotos/customerphotos')),
    'e.entity_id = customerphotos.customer_id',
    array(
        'customerphotos.entity_id as entity_id',
        'customerphotos.customer_id',
    ));
$collection->addFieldToFilter('customerphotos_created_at', $condition);

I have tried $collection->addFilterToMap('customerphotos_created_at', 'customerphotos.created_at'); but it only works on non EAV table.

3
  • You could try $collection->getSelect()->where(YOUR_CONDITIONS); Nov 28, 2017 at 14:38
  • That's how I solved it currently, but I want to use the advantage of using addFieldToFilter
    – Ner
    Nov 28, 2017 at 14:49
  • @Ner Ever found a way to use addFieldToFilter ?
    – Badong
    Jan 4, 2021 at 12:06

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.