Skip to main content
added 215 characters in body
Source Link
Rajeev K Tomy
  • 17.3k
  • 6
  • 63
  • 103

Hi Magento have setupedhas simple and configurable product relation on catalog_product_super_linkin catalog_product_super_link table. So you can use advantage from this table.

So.You need filter product COllection by this product idsBasically what you have to do is, filter the simple product collection by the product ids present in catalog_product_super_link table

Step1: Get list of all simple product which is used config product child productall simple products by using below code

$collectionSimple = Mage::getResourceModel('catalog/product_collection')
                ->addAttributeToFilter('type_id', array('eq' => 'simple'));
                
$collectionSimple ->getSelect()->join(array(
    'link_table' => 'catalog_product_super_link'),
            'link_table.product_id = e.entity_id',
            array('product_id')
            ));
         
$IdsSimpleCon=$collectionSimple->getAllIds();

enter image description here

Step2: Make another product Collection exclude of step one product collectionexclude of step one product collection and code

$NonConfigurablecollectionSimple = Mage::getResourceModel('catalog/product_collection')
            ->addAttributeToFilter('type_id', array('eq' => 'simple'))
            ->addAttributeToFilter('entity_id',array('nin'=>$cond ));
         
echo $NonConfigurablecollectionSimple->getSelect();     

Now, $NonConfigurablecollectionSimple would hold all those simple product which does not have a single relationship with configurable products.

Hi Magento have setuped simple and configurable product relation on catalog_product_super_link.

So.You need filter product COllection by this product ids

Step1: Get list of all simple product which is used config product child product by using below code

$collectionSimple = Mage::getResourceModel('catalog/product_collection')
                ->addAttributeToFilter('type_id', array('eq' => 'simple'));
                
$collectionSimple ->getSelect()->join(array('link_table' => 'catalog_product_super_link'),
            'link_table.product_id = e.entity_id',
            array('product_id')
            );
        $IdsSimpleCon=$collectionSimple->getAllIds();

enter image description here

Step2: Make another product Collection exclude of step one product collection and code

$NonConfigurablecollectionSimple = Mage::getResourceModel('catalog/product_collection')
            ->addAttributeToFilter('type_id', array('eq' => 'simple'))
            ->addAttributeToFilter('entity_id',array('nin'=>$cond ));
        echo $NonConfigurablecollectionSimple->getSelect();     

Magento has simple and configurable product relation in catalog_product_super_link table. So you can use advantage from this table.

Basically what you have to do is, filter the simple product collection by the product ids present in catalog_product_super_link table

Step1: Get list of all simple products by using below code

$collectionSimple = Mage::getResourceModel('catalog/product_collection')
    ->addAttributeToFilter('type_id', array('eq' => 'simple'));
                
$collectionSimple ->getSelect()->join(array(
    'link_table' => 'catalog_product_super_link'),
    'link_table.product_id = e.entity_id',
    array('product_id')
));
 
$IdsSimpleCon=$collectionSimple->getAllIds();

enter image description here

Step2: Make another product Collection exclude of step one product collection and code

$NonConfigurablecollectionSimple = Mage::getResourceModel('catalog/product_collection')
    ->addAttributeToFilter('type_id', array('eq' => 'simple'))
    ->addAttributeToFilter('entity_id',array('nin'=>$cond ));
         
echo $NonConfigurablecollectionSimple->getSelect(); 

Now, $NonConfigurablecollectionSimple would hold all those simple product which does not have a single relationship with configurable products.

added 93 characters in body
Source Link
Amit Bera
  • 77.7k
  • 20
  • 124
  • 239

Hi Magento ishave setuped simple and configurable product relation on catalog_product_super_link.

So.You need filter product COllection by this product ids

Step1: Get list of all simple product which is used config product child product byusing belowc odeby using below code

$collectionSimple = Mage::getResourceModel('catalog/product_collection')
                ->addAttributeToFilter('type_id', array('eq' => 'simple'));
                
$collectionSimple ->getSelect()->join(array('link_table' => 'catalog_product_super_link'),
            'link_table.product_id = e.entity_id',
            array('product_id')
            );
        $IdsSimpleCon=$collectionSimple->getAllIds();

enter image description here

Step2: Make another product Collection exclude of step one product collection and code

$NonConfigurablecollectionSimple = Mage::getResourceModel('catalog/product_collection')
            ->addAttributeToFilter('type_id', array('eq' => 'simple'))
            ->addAttributeToFilter('entity_id',array('nin'=>$cond ));
        echo $NonConfigurablecollectionSimple->getSelect();     

Hi Magento is simple and configurable product relation on catalog_product_super_link.

So.You need filter product COllection by this product ids

Step1: Get list of all simple product which is used config product child product byusing belowc ode

$collectionSimple = Mage::getResourceModel('catalog/product_collection')
                ->addAttributeToFilter('type_id', array('eq' => 'simple'));
                
$collectionSimple ->getSelect()->join(array('link_table' => 'catalog_product_super_link'),
            'link_table.product_id = e.entity_id',
            array('product_id')
            );
        $IdsSimpleCon=$collectionSimple->getAllIds();

Step2: Make another product Collection exclude of step one product collection and code

$NonConfigurablecollectionSimple = Mage::getResourceModel('catalog/product_collection')
            ->addAttributeToFilter('type_id', array('eq' => 'simple'))
            ->addAttributeToFilter('entity_id',array('nin'=>$cond ));
        echo $NonConfigurablecollectionSimple->getSelect();     

Hi Magento have setuped simple and configurable product relation on catalog_product_super_link.

So.You need filter product COllection by this product ids

Step1: Get list of all simple product which is used config product child product by using below code

$collectionSimple = Mage::getResourceModel('catalog/product_collection')
                ->addAttributeToFilter('type_id', array('eq' => 'simple'));
                
$collectionSimple ->getSelect()->join(array('link_table' => 'catalog_product_super_link'),
            'link_table.product_id = e.entity_id',
            array('product_id')
            );
        $IdsSimpleCon=$collectionSimple->getAllIds();

enter image description here

Step2: Make another product Collection exclude of step one product collection and code

$NonConfigurablecollectionSimple = Mage::getResourceModel('catalog/product_collection')
            ->addAttributeToFilter('type_id', array('eq' => 'simple'))
            ->addAttributeToFilter('entity_id',array('nin'=>$cond ));
        echo $NonConfigurablecollectionSimple->getSelect();     
Source Link
Amit Bera
  • 77.7k
  • 20
  • 124
  • 239

Hi Magento is simple and configurable product relation on catalog_product_super_link.

So.You need filter product COllection by this product ids

Step1: Get list of all simple product which is used config product child product byusing belowc ode

$collectionSimple = Mage::getResourceModel('catalog/product_collection')
                ->addAttributeToFilter('type_id', array('eq' => 'simple'));
                
$collectionSimple ->getSelect()->join(array('link_table' => 'catalog_product_super_link'),
            'link_table.product_id = e.entity_id',
            array('product_id')
            );
        $IdsSimpleCon=$collectionSimple->getAllIds();

Step2: Make another product Collection exclude of step one product collection and code

$NonConfigurablecollectionSimple = Mage::getResourceModel('catalog/product_collection')
            ->addAttributeToFilter('type_id', array('eq' => 'simple'))
            ->addAttributeToFilter('entity_id',array('nin'=>$cond ));
        echo $NonConfigurablecollectionSimple->getSelect();