I'm trying to change the display of the products to random when only when the category is the child's parent did the following code:
$id = 2;
$cat = Mage::getModel('catalog/category')->load($id);
$subcats = $cat->getChildren();
$categoria = $_productCollection->getCategoryIds();
foreach(explode(',',$subcats) as $subCatid){
$_category = Mage::getModel('catalog/category')->load($subCatid);
if($_category->getIsActive() and $categoria = $_category ){
$_productCollection=$this->getLoadedProductCollection();
}
}
There is a lot of error :( who can help thank you.