Skip to content

Commit

Permalink
FFWEB-3029: FF category pages implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Rayn93 committed Apr 12, 2024
1 parent b1ff19b commit f701dc3
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 6 deletions.
50 changes: 44 additions & 6 deletions src/view/frontend/templates/category/history_callback.phtml
Original file line number Diff line number Diff line change
@@ -1,9 +1,47 @@
<!--<script>-->
<!-- document.addEventListener('ffCoreReady', function (ff) {-->
<!-- ff.eventAggregator.addBeforeHistoryPushCallback(function (res, event, url) {-->
<!-- url = url.replace(/filter=CategoryPath[^&]+&?/, '').replace(/filterCategoryPathROOT[^&]+&?/g, '');-->
<!-- ff.factfinder.communication.Util.pushParameterToHistory(res, url, event);-->
<!-- return false;-->
<!-- });-->
<!-- });-->
<!--</script>-->
<script>
document.addEventListener('ffCoreReady', function (ff) {
ff.eventAggregator.addBeforeHistoryPushCallback(function (res, event, url) {
url = url.replace(/filter=CategoryPath[^&]+&?/, '').replace(/filterCategoryPathROOT[^&]+&?/g, '');
ff.factfinder.communication.Util.pushParameterToHistory(res, url, event);
return false;
});
document.addEventListener(`ffCoreReady`, ({ factfinder }) => {
// const cfg = factfinder.config.defaults.general;
//
// cfg.url = `https://your-instance.fact-finder.de/fact-finder`;
// cfg.channel = `your-channel`;
//
// factfinder.config.apiKey = `your.apiKey`;
//
// factfinder.request.search(
//
// // Typically, you would make your server application insert the query string here
// // before responding to the client.
// { query: `dynamically generated query` },
//
// // Specifying `origin` is optional.
// // You can use it to tell your 'before search' listeners who initiated the request
// // and allow them to react appropriately.
// { requestOptions: { origin: `searchImmediately` } }
// );
// });

factfinder.config.categoryPage = [
factfinder.utils.filterBuilders.categoryFilter(`Category`, ["Women", "Bottoms"]),
];

factfinder.request.navigation(
// Typically, you would make your server application insert the query string here
// before responding to the client.
{ filters: ['CategoryPath': ['Women/Bottoms/Pants'] },
//
// // Specifying `origin` is optional.
// // You can use it to tell your 'before search' listeners who initiated the request
// // and allow them to react appropriately.
{requestOptions: {origin: `searchImmediately`}}
);
});
</script>
2 changes: 2 additions & 0 deletions src/view/frontend/templates/ff/communication.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
$viewModel = $block->getViewModel();
$communicationParameters = (array) $block->getData('communication_parameters');
$parameters = $viewModel->getParameters($communicationParameters);

//dump($communicationParameters); die();
?>

<!--Init webcomponents-->
Expand Down

0 comments on commit f701dc3

Please sign in to comment.