I am working on magento product collection query. My requirement to fetch products which are present in array of category.
Example: $all_selected_categories = array('15','35','48','75');
Above categories are from many seperate websites.
My query is:
$collection_check = Mage::getModel('catalog/product')
->getCollection()
->addAttributeToSelect(array('entity_id','name','description','created_at','price','status','parent_id'))
->addAttributeToFilter('status', 1);
$collection_check->joinField('category_id','catalog/category_product', 'category_id', 'product_id = entity_id',null, 'left');
$collection_check->addAttributeToFilter('category_id', array('in' =>array('finset' => $all_selected_categories)));
But i am getting error of already exists of id.