Why Shopware 6 is caching the events?

Hi

I am creating a plugin. I am using NavigationPageLoadedEvent in my plugin.

But the problem is Shopware cache the events so the events are not working in the dev server.

I have installed the user version of Shopware (6.1.3). and SHOPWARE_HTTP_CACHE_ENABLED is 1.

if I change the SHOPWARE_HTTP_CACHE_ENABLED to 0 it will work.

is there any way to do some functions NavigationPageLoadedEvent even if the Http cache enabled.?

There are no issues with the local installation running on the docker. the events are working even if the  SHOPWARE_HTTP_CACHE_ENABLED is 1. 

Why is the production server caching the events?

1 „Gefällt mir“

The http cache caches the complete html response, when the http-cache is active you can only use ESI-tags or javascript to change the html output. This is not a shopware issue, but the functionality of the caching itself.

https://symfony.com/doc/current/http_cache/esi.html

@Moritz Naczenski schrieb:

The http cache caches the complete html response, when the http-cache is active you can only use ESI-tags or javascript to change the html output. This is not a shopware issue, but the functionality of the caching itself.

https://symfony.com/doc/current/http_cache/esi.html

 

I am using ProductEvents::PRODUCT_SEARCH_CRITERIA event

I want to add some conditions to product search and load only the condition satisfied products.

how to do this with ESI-tags?

Do you have any criterias that are based on the logged in customer and so on? Something that will change between requests?
Because it should work with general criterias (e.g. „only products with stock > 500“), because the output will always be the same. 

@Moritz Naczenski schrieb:

Do you have any criterias that are based on the logged in customer and so on? Something that will change between requests?
Because it should work with general criterias (e.g. „only products with stock > 500“), because the output will always be the same. I

 

I have added two custom fields for products, published from date and published to date. so i want to show the products only if the current date is in between these 2 dates.

This checking must be done in category wise product listing,product search result.

Hi @abinjohnedamana,
this might come a little late, but have you been able to resolve your issue with adding criteria using the ProductSearchCriteriaEvent?

I face a quite similar issue with ProductListingCriteriaEvent.

1 „Gefällt mir“

Have you found the solution? A filter plugin doesn’t work after update to 6.5.7.0.