I want to get a list of all products available in my Magento installation. Currently I am using the following call to filter out enabled products and limit the result set to those products which are visible both in catalog and search results:
$products = \Mage::getResourceModel('catalog/product_collection')
->addAttributeToFilter('visibility', array('in' => array(
As all children of configurable products are stored as regular products they show up in the resulting collection. However, I don't want them to be included. Is there any way to safely achieve this?
In case you wonder about all these backslashes: My code runs in an PHP-5.3 compatible environment using namespaces so I had to refer to the global namespace when calling Magento functions.
Thanks in advance,
Edit (further explanation of what I want to achieve):
My employer develops an own eCommerce system. This software provides a mechanism similar to Magento's configurable products. All sub-products assigned to a configurable product know about their parent (indicated by the parent's primary key). Hence, it it easy to filter them out by excluding product rows having a non-zero parent ID.
How is this realized in Magento? Don't the sub products know which configurable product they are assigned to?