1

I want to get the unmatched product ids of catalog products with a custom module collection product ids.

For Example :

  1. The catalog product entity table has 12,14,15,16 product ids

  2. The custom table has 12,14 product ids.

Result: 15,16 -> Unmatched Product Ids.

How we can achieve this using Magento standard approach?

1
  • Use mysql inner join
    – Sohel Rana
    Jul 4, 2023 at 9:47

1 Answer 1

2

You can use not in the condition in addFieldToFilter() of your collection. Which magento provide.

$arrayIds = [12,13];

$collection->addFieldToFilter('your_id_column', ['nin' => $arrayIds ]);

For more conditions

Your Answer

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

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