Skip to content

Commit

Permalink
FFWEB-3197: Fix double request issue on category pages
Browse files Browse the repository at this point in the history
Fix double request issue on category pages
  • Loading branch information
Rayn93 authored Oct 17, 2024
1 parent 6f49296 commit 09da57a
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{% block sw_cms_element_paging_config %}
<div>
<sw-text-field
<sw-switch-field
label="Show Only"
placeholder="Show Only"
v-model:value="element.config.showOnly.value">
</sw-text-field>
</sw-switch-field>
<sw-switch-field label="Subscribe" v-model:value="element.config.subscribe.value"></sw-switch-field>
</div>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Shopware.Service('cmsService').registerCmsElement({
source: 'static',
},
showOnly: {
value: 'true',
value: false,
source: 'static',
},
},
Expand Down

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion src/Resources/views/storefront/base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
return false;
}
});
//
{% if page.extensions.factfinder.searchImmediate and not page.extensions.factfinder.ssr %}
const searchParams = factfinder.utils.env.searchParamsFromUrl();
Expand Down
3 changes: 1 addition & 2 deletions src/Subscriber/CategoryPageSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public function onPageLoaded(NavigationPageLoadedEvent $event): void
$disableImmediate = safeGetByName($category->getCustomFields(), OmikronFactFinder::DISABLE_SEARCH_IMMEDIATE_CUSTOM_FIELD_NAME);
$isHome = $route === 'frontend.home.page';
$isCategory = !$isHome && !$disableImmediate;
$searchImmediate = $this->config->isSsrActive() === false && $isCategory;

$baseAddParams = array_filter(explode(',', (string) safeGetByName($event->getPage()->getExtension('factfinder')->get('communication'), 'add-params')));
/**
Expand Down Expand Up @@ -77,7 +76,7 @@ public function onPageLoaded(NavigationPageLoadedEvent $event): void
'communication' => $communication,
'trackingSettings' => $this->extensionConfig->getTrackingSettings(),
'redirectMapping' => (string) $this->extensionConfig->getRedirectMapping(),
'searchImmediate' => $searchImmediate ? 'true' : 'false',
'searchImmediate' => false,
'categoryPathFieldName' => "{$this->fieldName}ROOT",
'communicationAttributes' => !empty($communicationConfig) ? $this->getCommunicationAttributes($communicationConfig) : $communication,
]
Expand Down
2 changes: 1 addition & 1 deletion src/Subscriber/ConfigurationSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function onPageLoaded(ShopwareSalesChannelEvent $event): void
'communication' => $communicationConfig,
'trackingSettings' => $this->extensionConfig->getTrackingSettings(),
'redirectMapping' => (string) $this->extensionConfig->getRedirectMapping(),
'searchImmediate' => $this->isSearchImmediate($event) ? 'true' : 'false',
'searchImmediate' => $this->isSearchImmediate($event),
'userId' => $customer ? $customer->getId() : null,
'ssr' => $this->config->isSsrActive(),
'communicationAttributes' => $this->getCommunicationAttributes($communicationConfig),
Expand Down

0 comments on commit 09da57a

Please sign in to comment.