I am using the below code for get most-viewed product in my store front:

$storeId = Mage::app()->getStore()->getId();
$products = Mage::getResourceModel('reports/product_collection')
    ->addAttributeToSelect(['name', 'price', 'small_image'])


It's working fine when "Use Flat Catalog Product" is set to no. But when I set "Use Flat Catalog Product" to yes, product name, price and small_image attribute not get in collection.

Please help

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.