i trying list of categories confine search query $searchstring 1 have filter products
$_productcollection = mage::getmodel('catalog/product') ->getcollection() ->addattributetosort('created_at', 'desc') ->addattributetoselect('*') ->setpagesize(20) ->addattributetofilter('name', array('like' => '%'.$searchstring.'%'))<---this line ->load();
but need filter categories .how can edit following code filter categories 1 above
$_helper = mage::helper('catalog/category'); $_categories = $_helper->getstorecategories(); if (count($_categories) > 0){ foreach($_categories $_category){ $_category = mage::getmodel('catalog/category')->load($_category->getid()); $_subcategories = $_category->getchildrencategories(); if($_category->getimageurl()!= ""){$categoryimage = $_category->getimageurl();}else{$categoryimage = "http://www.flintout.com/img/roughrock.jpg";} echo $categoryimage; echo $_category->getname(); echo $_category->getdescription(); if (count($_subcategories) > 0){ foreach($_subcategories $_subcategory){ if($_subcategory->getimageurl()!= ""){$subcategoryimage = $_subcategory->getimageurl();}else{$subcategoryimage = "http://www.flintout.com/img/roughrock.jpg";} echo $subcategoryimage; echo $_subcategory->getname(); echo $_subcategory->getdescription(); } } } }
thanks
Comments
Post a Comment