/**
* Sets the internal path field for given category based on it's parents
*
* @return Category
*/
public function setPathForCategory(Category
$category) { $parentId =
$category->
getParent()->
getId();
$parents =
$this->
getCategoryComponent()->
getParentCategoryIds($parentId);
$path =
implode('|',
$parents);
if (empty($path)) { $path = '';
} else { $path = '|' .
$path . '|';
} $category->
internalSetPath($path);
return $category;
}