/** * @param int $categoryId * @return int */ public function getProductBoxLayout($categoryId) { /** @var \Shopware\Models\Category\Category $category */ $category = $this->repository->find($categoryId); if ($category->getProductBoxLayout() !== 'extend' && $category->getProductBoxLayout() !== null) { return $category->getProductBoxLayout(); } while (null !== ($parent = $category->getParent())) { $category = $parent; if ($category->getProductBoxLayout() !== 'extend' && $category->getProductBoxLayout() !== null) { return $category->getProductBoxLayout(); } } return 'basic'; }
/** * Returns category level for the given category id * * @param int $id * @return int|null */ public function sGetCategoryDepth($id) { $category = $this->repository->find($id); return $category !== null ? $category->getLevel() - 1 : null; }