I am working with some product collection join with custom table, I've a custom product attribute, need to add a join condition with the product custom attribute with the custom table attribute.

The custom table is agreements and in product we're also has a custom attribute called agreement, when i tried to join as like below i am getting error like agreement is undefined field (agreement is a product custom attribute - select)

                'e.agreement = agreement_table.id',

Thanks in advance for your better support.

1 Answer 1


Following code it working for me,

$productCollection = $this->productFactory->create()->getCollection();
$collection = $productCollection->create()->addAttributeToSelect(['sku' , 'entity_id' , 'agreement']);

Thanks & Regards,

Your Answer

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

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