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; } /** * Calculate next position relative to our parent */ protected function addCriteriaToPositionQuery($query) { $query->filterByParent($this->getParent()); } /** * {@inheritDoc} */ public function preInsert(ConnectionInterface $con = null) { $this->setPosition($this->getNextPosition()); return true; } public function postInsert(ConnectionInterface $con = null) { //$this->generateRewrittenUrl($this->getLocale()); } }