0

Is there any way to filter simple and configurable products together on some attribute. And then show the products list. The configurable product would just be shown as any other simple product after the filter if it satisfies the filtering condition. I have tried some tricks but after filtering, the configurable products do not show up as they by themselves do not satisfy the filter though their child products satisfy the filter.

I know a way to separately take the configurable products and then apply the filter. But that's not wat i am looking for.

Any help is greatfully appreciated...

2 Answers 2

2

I believe that you're looking for a collection that includes both simple and configurable products. Use this:

$collection = Mage::getModel('catalog/product')->getCollection()
  ->addAttributeToFilter('type_id', array('in' => array('simple','configurable')));
1
  • it is not type but type_id, please fix your answer
    – WonderLand
    Mar 21, 2016 at 9:55
2

SIMPLE PRODUCT

$collectionSimple = Mage::getResourceModel('catalog/product_collection')
            ->addAttributeToFilter('type_id', array('eq' => 'simple'));

CONFIGURABLE PRODUCT

$collectionConfigurable = Mage::getResourceModel('catalog/product_collection')
            ->addAttributeToFilter('type_id', array('eq' => 'configurable'));

try this

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.