Exemple #1
0
 public function sCategoryPath($category)
 {
     $parts = $this->repository->getPathById($category, 'name');
     $level = $this->baseCategory->getLevel() + 1;
     $parts = array_slice($parts, $level);
     return $parts;
 }
Exemple #2
0
 /**
  * Returns the category path for the given category id
  *
  * @param int|$id
  * @param int|null $parentId
  * @return array
  */
 public function sGetCategoryPath($id, $parentId = null)
 {
     if ($parentId === null) {
         $parentId = $this->baseId;
     }
     $path = $this->repository->getPathById($id, 'id');
     foreach ($path as $key => $value) {
         unset($path[$key]);
         if ($value == $parentId) {
             break;
         }
     }
     return $path;
 }