$cat_count = Mage::registry('current_category'); $query = 'SELECT COUNT(catalog_category_product_index.category_id) AS count FROM catalog_category_product_index WHERE catalog_category_product_index.category_id = '.print_r($cat_count['entity_id']).' GROUP BY catalog_category_product_index.category_id'; $query = Mage::getSingleton('core/resource')->getConnection('core_read')->query($query); //and now you can build up your array or do anything you want (: while($row=$query->fetch()) { $catCount[$row['category_id']]=$row['count']; echo $row['count']; }
Monday, May 9, 2011
How to use mysql select query in magento?
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment