Advertisement
Guest User

Untitled

a guest
Jun 15th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. $productCollection = Mage::getModel('catalog/product')->getCollection()
  2. ->addAttributeToFilter('type_id', ['eq' => Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE])
  3. ->addAttributeToFilter('status', ['eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED])
  4. ->addAttributeToSelect('some_custom_attribute')
  5. ->addAttributeToSelect('name');
  6.  
  7. SELECT `e`.*, `at_status`.`value` AS `status` FROM `catalog_product_entity` AS `e`
  8. 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 (`e`.`type_id` = 'configurable') AND (at_status.value = 1))
  9.  
  10. foreach ($productCollection as $product) {
  11. echo "Product is: ".$product->getId()." with name ".$product->getName()." with value of custom attribute ".$product->getSomeCustomAttribute()."n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement