I have a function which collect products parent categories:
function getParentCategories($catId, $catsList) {
$category = Mage::getModel('catalog/category')->load($catId);
if($category->getParentCategory()->getId()!=2){
$catsList[] = $category->getParentCategory()->getId();
return $this->getParentCategories($category->getParentCategory()->getId(),$catsList);
} else {
return $catsList;
}
which cause high memory usage:
FastCGI sent in stderr: "PHP message: PHP Fatal error: Allowed memory size of 4294967296 bytes exhausted (tried to allocate 72 bytes) in /app/code/local/Mage/Core/Block/Template.php on line 415" while reading response header from upstream...
memory limit is 4G !!!! and even this is not enough. Can you help me with this function?
Magento 1.7.0.2