I created an EAV attribute on product entity, this attribute named user_id and has the ID of the user who's added the product.

After works, I crashed on this point, I need to join tables to get products added by a specific user.

So, I try with this code

           'product' => 'catalog_product_entity'),
           'product.user_id = 2',

but always I get this error Unknown column 'user_id'

is there any solution?

  • what is the type of this EAV attribute? int|text|varchar| Jun 3, 2019 at 17:11
  • @vitoriodachef int type
    – sayou
    Jun 4, 2019 at 9:50

1 Answer 1


Late in the party but whoever is seeing this nowadays: you need to explicitly add your custom attribute to the collection, then filter it, like that:

$userProducts = $this->productsCollectionFactory->create()
    ->addAttributeToFilter("user_id", 2);

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.