php - Display product list from same selected subcategory for this product on product detail page -
i struggling last 2 days display product list (only product name link) @ product detail page have same subcategory detailed product has. in detail, have 2 level category:please take @ image:
now suppose when user goes prodcut "zest" item detail page can see "zest" , "exotic" items list. not other items subcategory (e.g. indonesian... blue border color). here aam able category id of "pods" (its main category) cannot id of "house blend(2)" subcategory.
can please these product list? in advance.
to subcategories of category:
$children = mage::getmodel('catalog/category')->getcategories(50); $searchincategories = ''; foreach ($children $category) { //add , after every id if (strlen($searchincategories) > 0) $searchincategories .= ','; $searchincategories .= $category->getid(); }
where 50 category id, in case pods id.
now need alter search query products:
->addattributetofilter('category_id', array('in' => array('finset' => $searchincategories)))
Comments
Post a Comment