diff --git a/src/Model/Resolver/Category/DataProvider/Breadcrumbs.php b/src/Model/Resolver/Category/DataProvider/Breadcrumbs.php index c415fb6..b2bd1e8 100644 --- a/src/Model/Resolver/Category/DataProvider/Breadcrumbs.php +++ b/src/Model/Resolver/Category/DataProvider/Breadcrumbs.php @@ -47,10 +47,19 @@ public function getData(string $categoryPath): array if (count($parentCategoryIds)) { $collection = $this->collectionFactory->create(); - $collection->addAttributeToSelect(['name', 'url_key', 'url_path', 'is_active']); + $collection->addAttributeToSelect(['name', 'url_key', 'url_path', 'is_active', 'description', 'landing_page']); $collection->addAttributeToFilter('entity_id', $parentCategoryIds); foreach ($collection as $category) { + + $landingPageId = $category->getData('landing_page'); + $landingPageContent = ''; + + if ($landingPageId) { + $landingPageBlock = $this->blockFactory->create()->load($landingPageId); + $landingPageContent = $landingPageBlock->getContent(); + } + $breadcrumbsData[] = [ 'category_id' => $category->getId(), 'category_name' => $category->getName(), @@ -59,7 +68,10 @@ public function getData(string $categoryPath): array 'category_url_path' => $category->getUrlPath(), // the only change to fix breadcrumbs 'category_url' => parse_url($category->getUrl(), PHP_URL_PATH), - 'category_is_active' => (bool) $category->getIsActive() + 'category_is_active' => (bool) $category->getIsActive(), + 'category_description' => $category->getDescription() ?? '', + 'category_banner' => $landingPageContent, + ]; } } diff --git a/src/etc/schema.graphqls b/src/etc/schema.graphqls index c213a89..764cec0 100755 --- a/src/etc/schema.graphqls +++ b/src/etc/schema.graphqls @@ -74,6 +74,8 @@ type ProductStockItem { extends type Breadcrumb { category_url: String @doc(description: "Trimmed URL rewrite") category_is_active: Boolean @doc(description: "Is category active") + category_description: String @doc(description: "Category description") + category_banner: String @doc(description: "Category banner") } interface AggregationOptionInterface {