what best practice add filter loaded collection in magento? want hide items out of stocks , last updated date not within last 30 days.
i try create function hide products in front end, realize won’t affect total item counts loaded in pager. discovered _getproductcollection() might method can use can’t add filter onto it.
i’m still new magento guidances highly appreciated.
$collection = mage::getmodel('catalog/product')->getcollection(); $collection->addfieldtofilter( 'status', '1' ); $collection->addfieldtofilter( 'created_at', array( 'lteq'=>$last_day ) ); $collection->addfieldtofilter( 'updated_at', array( 'gteq'=>$first_day ) );
Comments
Post a Comment