From 9e1769dffea982dce9aa799687ba5d8c2da1f227 Mon Sep 17 00:00:00 2001 From: robert Date: Tue, 16 Apr 2024 14:22:03 +0200 Subject: [PATCH] Implement category path --- src/ViewModel/CategoryPath.php | 11 ++++-- src/view/frontend/layout/default.xml | 2 + .../layout/factfinder_category_view.xml | 9 ++++- .../templates/category/category_page.phtml | 15 ++++++++ .../templates/category/history_callback.phtml | 38 ------------------- src/view/frontend/templates/ff/asn.phtml | 3 +- .../frontend/templates/ff/communication.phtml | 2 - .../frontend/templates/ff/record-list.phtml | 19 ++++++---- 8 files changed, 44 insertions(+), 55 deletions(-) create mode 100644 src/view/frontend/templates/category/category_page.phtml diff --git a/src/ViewModel/CategoryPath.php b/src/ViewModel/CategoryPath.php index 0f59034a..00149872 100644 --- a/src/ViewModel/CategoryPath.php +++ b/src/ViewModel/CategoryPath.php @@ -26,13 +26,16 @@ public function __toString() ) : $this->getAddParams(); } - public function getCategoryPath(): string + public function getCategoryPath(): array { - if ($this->communicationConfig->getVersion() === Version::NG) { - return implode(',', $this->ngPath($this->getCurrentCategory())); + $values = []; + + foreach ($this->getParentCategories($this->getCurrentCategory()) as $item) { + $categoryName = trim($item->getName()); + $values[] = $categoryName; } - return ''; + return $values; } public function getAddParams(): string diff --git a/src/view/frontend/layout/default.xml b/src/view/frontend/layout/default.xml index 354e64dd..78b43a2f 100644 --- a/src/view/frontend/layout/default.xml +++ b/src/view/frontend/layout/default.xml @@ -6,12 +6,14 @@ true Omikron\Factfinder\ViewModel\ProductBasedComponent + true false Omikron\Factfinder\ViewModel\ProductBasedComponent + false diff --git a/src/view/frontend/layout/factfinder_category_view.xml b/src/view/frontend/layout/factfinder_category_view.xml index 2ed01716..266098b1 100644 --- a/src/view/frontend/layout/factfinder_category_view.xml +++ b/src/view/frontend/layout/factfinder_category_view.xml @@ -8,6 +8,11 @@ + + + + + @@ -25,9 +30,9 @@ - + - + false diff --git a/src/view/frontend/templates/category/category_page.phtml b/src/view/frontend/templates/category/category_page.phtml new file mode 100644 index 00000000..ee3de4d1 --- /dev/null +++ b/src/view/frontend/templates/category/category_page.phtml @@ -0,0 +1,15 @@ +getData('category_path'); +?> + + diff --git a/src/view/frontend/templates/category/history_callback.phtml b/src/view/frontend/templates/category/history_callback.phtml index 1ec9cc78..ca5658f0 100644 --- a/src/view/frontend/templates/category/history_callback.phtml +++ b/src/view/frontend/templates/category/history_callback.phtml @@ -7,41 +7,3 @@ - diff --git a/src/view/frontend/templates/ff/asn.phtml b/src/view/frontend/templates/ff/asn.phtml index 7f44193d..9c842103 100644 --- a/src/view/frontend/templates/ff/asn.phtml +++ b/src/view/frontend/templates/ff/asn.phtml @@ -5,7 +5,8 @@ /** @var string $categoryPathFieldName */ $categoryPathFieldName = (string) $block->getData('category_path_field_name'); /** @var bool $isCategoryPage */ -$isCategoryPage = (bool) $block->getData('is_category_page'); ?> +$isCategoryPage = (bool) $block->getData('is_category_page'); +?>
diff --git a/src/view/frontend/templates/ff/communication.phtml b/src/view/frontend/templates/ff/communication.phtml index d32cf353..60584788 100644 --- a/src/view/frontend/templates/ff/communication.phtml +++ b/src/view/frontend/templates/ff/communication.phtml @@ -5,8 +5,6 @@ $viewModel = $block->getViewModel(); $communicationParameters = (array) $block->getData('communication_parameters'); $parameters = $viewModel->getParameters($communicationParameters); - -//dump($communicationParameters); die(); ?> diff --git a/src/view/frontend/templates/ff/record-list.phtml b/src/view/frontend/templates/ff/record-list.phtml index 6aebddf9..2a92a09f 100644 --- a/src/view/frontend/templates/ff/record-list.phtml +++ b/src/view/frontend/templates/ff/record-list.phtml @@ -3,6 +3,7 @@ /** @var Magento\Framework\View\Element\Template $block */ /** @var Omikron\Factfinder\ViewModel\ProductBasedComponent $viewModel */ $viewModel = $block->getViewModel(); +$isSearchRequest = (bool) $block->getData('is_search_request'); ?>
getViewModel();
- + + +