i have written custom code to display all product by their category id now i want to add name filter which searches and show name matching with product
1: my category code works fine 2: when i add like filter to sort name i get null result please help me find out issue i had used addAttributeToFilter which does not seems working
$category_id = $_GET['category_id'];
$catagory_model = Mage::getModel('catalog/category')->load($category_id);
$collection = Mage::getResourceModel('catalog/product_collection');
$collection->addCategoryFilter($catagory_model); //category filter
$collection->addAttributeToFilter('status',1); //only enabled product
$collection->addAttributeToSelect(array('id','name','url','small_image','price')); //add product attribute to be fetched
if($_GET['keyword']!=''){
$needle= $_GET['keyword'];
$collection->addAttributeToFilter('name', array(
array('like' => '% '.$needle.' %')
));
}
$collection->addStoreFilter();