1

i have to get the products which do not contain any custom option, but not using has_options flag. The aim of doing this if the products do not contain any option, i have to set has_options to 0 progmatically(may be through magmi).

Is there any filter statement can select the products which do not have have custom options?

1 Answer 1

1

It not proper way to get non custom option products using has_options field.has_option is set to 1 when it bundle.

Good idea to join the table catalog_product_option to collection and and using join query check product have custom option or not

Here Step1: Get Collection of product which have option and then group them by product id

$Option=Mage::getResourceModel('catalog/product_option_collection')->addFieldToSelect('product_id');
$Option->getSelect()->group('main_table.product_id');

Step2: filter product collection by excluding those products getting from step1

   $entityIds = new Zend_Db_Expr($Option->getSelect()->__toString());
    $Collection=Mage::getResourceModel('catalog/product_collection');
    echo $Collection->getSelect()->where('e.entity_id not in(?)', $entityIds);
1
  • you are welcome.I have give upvote for your question
    – Amit Bera
    Mar 19, 2015 at 3:43

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.