isValidCategoryPath example

$categoryProducts['facets'] = $facets;

        $this->View()->assign($categoryProducts);
        $this->View()->assign('sortings', $sortings);
    }

    /** * @return array<string, mixed> */
    private function loadCategoryContent(int $requestCategoryId, Request $request): array
    {
        if (empty($requestCategoryId) || !$this->isValidCategoryPath($requestCategoryId)) {
            throw new Enlight_Controller_Exception('Listing category missing, non-existent or invalid for the current shop', 404);
        }

        $categoryContent = Shopware()->Modules()->Categories()->sGetCategoryContent($requestCategoryId);

        if (!\is_array($categoryContent)) {
            throw new ResourceNotFoundException('Category not found', $this->Request());
        }

        // Check if the requested category-id belongs to a blog category         if ($categoryContent['blog']) {
            
Home | Imprint | This part of the site doesn't use cookies.