cooponline.it - products list not shown

For support with specific websites

Moderator: trava90

Forum rules
Please always mention the name/domain of the website in question in your topic title.
Please one website per topic thread (to help keep things organized). While behavior on different sites might at first glance seem similar, they are not necessarily caused by the same.

Please try to include any relevant output from the Toolkit Error Console or the Developer Tools Web Console using the following procedure:
  1. Clear any current output
  2. Navigate or refresh the page in question
  3. Copy and paste Errors or seemingly relevant Warnings into a single [ code ] block.
User avatar
paleuser1
New to the forum
New to the forum
Posts: 2
Joined: 2021-03-22, 19:59

cooponline.it - products list not shown

Unread post by paleuser1 » 2022-08-04, 08:26

Any product list I select from the main page menu is shown as empty thus making the site unusable, for example https://www.cooponline.it/Coop/Elettrod ... r-cid61001

The following errors are recorded in the web console:

Code: Select all

Timestamp: 04/08/2022 10:04:28
Error: TypeError: window.mediator is undefined
Source File: https://www.cooponline.it/Coop/Elettrodomestici-e-Tecnologia/Informatica-e-Gaming/Computer-cid61001
Line: 276
Timestamp: 04/08/2022 10:04:28
Error: ReferenceError: event is not defined
Source File: https://www.cooponline.it/_ui/responsive/common/js/algolia/customHierarchicalMenu.js?version=1659600265488
Line: 111
Timestamp: 04/08/2022 10:04:28
Error: TypeError: searchIndex.helper is null
Source File: https://www.cooponline.it/_ui/responsive/common/js/algolia/customToggleRefinement.js?version=1659600265488
Line: 53
Timestamp: 04/08/2022 10:04:30
Error: XML Parsing Error: syntax error
Location: https://consentcdn.cookiebot.com/consentconfig//settings.json
Line Number 1, Column 1:
Source File: https://consentcdn.cookiebot.com/consentconfig//settings.json
Line: 1, Column: 1
Source Code:
Not found
The first and last errors appear in Firefox (103.0) too, but the products lists are shown correctly there.
Using PM version 31.2.0.1

Thanks

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35475
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: cooponline.it - products list not shown

Unread post by Moonchild » 2022-08-04, 09:06

Looks like the site is trying to use the (ambiguous) global window event (which is an MSIE quirk that has been deprecated for quite a while) instead of using the event passed into the handler.

Code: Select all

Error: ReferenceError: event is not defined
Source File: https://www.cooponline.it/_ui/responsive/common/js/algolia/customHierarchicalMenu.js?version=1659600265488
Line: 111
The webmaster should fix their scripting to solve this issue.

Further information:

Offending code

Code: Select all

    if (event != undefined){
      if (eventTarget != ''){
        const categoriesName = hierarchicalLevels(eventTarget);
        const sizeCategory = categoriesName.length;
        // Retrieving all Hierarchical menu levels from algolia response
      if(event.target.responseText != undefined){
        if(Object.values(JSON.parse(event.target.responseText)["results"])[0] != undefined){
        var facets = Object.values(JSON.parse(event.target.responseText)["results"])[0].facets["hierarchicalCategories.lvl" + (sizeCategory - 1)];
        }
    }
      }
Note, trying to make a comparisons of something undefined against undefined will throw. Seems clear to me this wasn't tested.

MDN page: see big red warning up top: https://developer.mozilla.org/en-US/doc ... ndow/event
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
paleuser1
New to the forum
New to the forum
Posts: 2
Joined: 2021-03-22, 19:59

Re: cooponline.it - products list not shown

Unread post by paleuser1 » 2022-08-04, 09:28

Hi Moonchild,
thanks for taking a look so quikly into this issue.
I was almost sure it was related to poor code writing.
I'll try to notify the webmaster of this issue but I don't have big expectations about it since most browsers work fine despite it.

Regards

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35475
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: cooponline.it - products list not shown

Unread post by Moonchild » 2022-08-04, 13:36

paleuser1 wrote:
2022-08-04, 09:28
I don't have big expectations about it since most browsers work fine despite it.
It's why i referred to the MDN page since even mainstream browsers want to stop supporting it.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

Locked