.js added multiple times in 2022.04

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
columbo
Advanced
Posts: 127
Joined: 09 Oct 2019, 09:42

.js added multiple times in 2022.04

Post by columbo » 05 May 2022, 21:31

Hi,

updated to Aimeos 2022.04
After clicking on the attribute filter tree, the tree opens for a second and then closes again.
I checked the HTML and found that the catalog-filter.js are added multiple times in @yield('aimeos_header').

Code: Select all

 ...
<link rel="stylesheet" href="/vendor/shop/themes/gw/basket-mini.css?v=1">
<script defer src="/vendor/shop/themes/mytheme/basket-mini.js?v=1"></script>

<link rel="stylesheet" href="/vendor/shop/themes/gw/catalog-filter.css?v=1">
<script defer src="/vendor/shop/themes/mytheme/catalog-filter.js?v=1"></script>

<link rel="stylesheet" href="/vendor/shop/themes/gw/catalog-filter.css?v=1">
<script defer src="/vendor/shop/themes/mytheme/catalog-filter.js?v=1"></script>

<script defer src="/shop/count"></script>
<link rel="stylesheet" href="/vendor/shop/themes/mytheme/catalog-filter.css?v=1">
<script defer src="/vendor/shop/themes/mytheme/catalog-filter.js?v=1"></script>

<script defer src="/shop/count"></script>
<link rel="stylesheet" href="/vendor/shop/themes/gw/catalog-stage.css?v=1">
<script defer src="/vendor/shop/themes/gw/catalog-stage.js?v=1"></script>

<title>Unsere Produkte | Default</title>
<meta name="keywords" content="Unsere Produkte">
<meta name="description" content="Unsere Produkte">

<link rel="canonical" href="http://localhost/shop">
<meta name="application-name" content="Aimeos">

<link rel="stylesheet" href="/vendor/shop/themes/mytheme/catalog-lists.css?v=1">
<script defer src="/vendor/shop/themes/mytheme/catalog-lists.js?v=1"></script>
...
I could not find any reasons in \vendor\aimeos\ai-client-html\templates\client\html\catalog\lists\header.php
Any clue why?

Thank you!

User avatar
aimeos
Administrator
Posts: 7941
Joined: 01 Jan 1970, 00:00

Re: .js added multiple times in 2022.04

Post by aimeos » 06 May 2022, 05:21

The catalog-filter.{css,js} files are included multiple times because the catalog filter plugin is added three times to the page (as catalog/filter, catalog/search and catalog/tree). Nevertheless, browsers are smart enough to download the files only once.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

columbo
Advanced
Posts: 127
Joined: 09 Oct 2019, 09:42

Re: .js added multiple times in 2022.04

Post by columbo » 06 May 2022, 07:13

ah ok, thanks.
Any other clue why the js for the attribute filter is being fired twice? After clicking on eg. "Color" tree is opened and closed again

User avatar
aimeos
Administrator
Posts: 7941
Joined: 01 Jan 1970, 00:00

Re: .js added multiple times in 2022.04

Post by aimeos » 06 May 2022, 13:28

This was a side effect of including the JS files more than once because then, the event listeners are also registered multiple times for the same event. By clicking on the attribute type in the filter, the first call opens the filter and the second JS which registered for the same event closes it again.

We've reverted the change and released a new version of the aimeos/ai-client-html package. Please run "composer up" to get the latest version which fixes the issue.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

columbo
Advanced
Posts: 127
Joined: 09 Oct 2019, 09:42

Re: .js added multiple times in 2022.04

Post by columbo » 09 May 2022, 14:41

thanks, but now there are issues on the catalog detail page
after last "composer up" catalog-filter.css and .js are missing on catalog detail page

User avatar
aimeos
Administrator
Posts: 7941
Joined: 01 Jan 1970, 00:00

Re: .js added multiple times in 2022.04

Post by aimeos » 11 May 2022, 06:15

We can't reproduce that problem.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply