getId()); } /** * * count all products for current category and sub categories * * @return int */ public function countAllContents() { $children = FolderQuery::findAllChild($this->getId()); array_push($children, $this); $contentsCount = 0; foreach($children as $child) { $contentsCount += ProductQuery::create() ->filterByCategory($child) ->count(); } return $contentsCount; } }