For Visibility, exists (from Mage_Catalog_Model_Layer :: prepareProductCollection ()):
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
Which installs the CATALONIA and BOTH filters in the collection.
For Status, this looks a little strange, but it still makes sense. In _init, select in app / code / core / Mage / Catalog / Model / Resource / Product / Collection.php The following is performed:
$this->getSelect() ->from(array(self::MAIN_TABLE_ALIAS => $this->getEntity()->getFlatTableName()), null) ->columns(array('status' => new Zend_Db_Expr(Mage_Catalog_Model_Product_Status::STATUS_ENABLED)));
This code is executed when executed.
Mage::getResourceModel('catalog/product_collection')
So basically ENABLED status is already checked on execution
$category->getProductCollection()
Or similar product collection challenges.
tomg
source share