Skip to content

Instantly share code, notes, and snippets.

@steve-ross
Created February 21, 2013 17:37
Show Gist options
  • Save steve-ross/5006574 to your computer and use it in GitHub Desktop.
Save steve-ross/5006574 to your computer and use it in GitHub Desktop.
magento select *...
$ids = Mage::getModel('catalog/product')
->getCollection()
->addAttributeToSelect('entity_id')
->addFieldToFilter('status', array('eq'=>'1'))
->addFieldToFilter('type_id', array('in'=>array('configurable', 'simple')))
->getSelect();
produces:
string 'SELECT `e`.*, `at_status`.`value` AS `status` FROM `catalog_product_entity` AS `e`
INNER JOIN `catalog_product_entity_int` AS `at_status` ON (`at_status`.`entity_id` = `e`.`entity_id`) AND (`at_status`.`attribute_id` = '96') AND (`at_status`.`store_id` = 0) WHERE (at_status.value = '1') AND (`e`.`type_id` IN('configurable', 'simple'))' (length=337)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment