I am trying to filter product collection by ids if I use below code, the filter works ok and the product shows.
$this->_productCollection
->addFieldToFilter('entity_id',array('in'=> 460 ));
The problem is that if I set an array to this code and try to filter, I keep getting empty collection.
$getData = array(460);
$this->_productCollection
->addFieldToFilter('entity_id',array('in'=> $getData ));
I've already tried setting array like the following
$getData[$a]= array(460);
and reading like
array('in'=> $getData[$a] )
PS: My array is variable, not only one product I can't see anything wrong with the code and if dump array it is ok I think: array([0] => int(460))
460
is product's ID or category's ID.