PrestaShop / hummingbird

81 stars 77 forks source link

Zasilkovna / Packeta module does not work with this theme #657

Open M4RtY opened 2 weeks ago

M4RtY commented 2 weeks ago

Hello, I have found out interesting issue that is related to the Hummingbird theme. This is official module, and I was trying to install it on "clear" themes (classic and hummingbird). When I switch to classic theme, this module works like a charm, when I activate the hummingbird theme, I am getting the JS errors in console.

Replication steps: 1) Install module from this repository (official) https://github.com/Zasilkovna/prestashop 2) Activate the module and connect to delivery option 3) Create the order and initiate the "Packeta" module 4) Open console and check the logs

Stacktrace:

Uncaught TypeError: module is null
    initializePacketaWidget https://eshop:8890/modules/packetery/views/js/front.js?v=2.1.20:101
    onShippingLoadedCallback https://eshop:8890/modules/packetery/views/js/front.js?v=2.1.20:403
    <anonymous> https://eshop:8890/modules/packetery/views/js/front.js?v=2.1.20:66
    u https://eshop:8890/themes/core.js:37
    l https://eshop:8890/themes/core.js:37
    setTimeout handler*204/</Deferred/then/a/< https://eshop:8890/themes/core.js:37
    c https://eshop:8890/themes/core.js:37
    fireWith https://eshop:8890/themes/core.js:37
    fire https://eshop:8890/themes/core.js:37
    c https://eshop:8890/themes/core.js:37
    fireWith https://eshop:8890/themes/core.js:37
    ready https://eshop:8890/themes/core.js:37
    Q https://eshop:8890/themes/core.js:37
    204 https://eshop:8890/themes/core.js:37
    204 https://eshop:8890/themes/core.js:37
    204 https://eshop:8890/themes/core.js:37
    a https://eshop:8890/themes/core.js:37
    <anonymous> https://eshop:8890/themes/core.js:37
    <anonymous> https://eshop:8890/themes/core.js:311
    <anonymous> https://eshop:8890/themes/core.js:311

Conclusion: I know this error comes from the module itself, but it seems that JS is not loaded from the module as expected or there is some conflict. The interesting part is that this module works like a charm with Classic theme, only hummingbird theme is affected. It was not needed to register JS from the module for classic theme and I presume, it should be able to work with the hummingbird theme as well without any compilations.

SharakPL commented 5 days ago

Probably another example of a bad result from an unnecessary switch to BEM. I'm guessing the module's scripts use .some-class-selector but in Hummingbird it got changed to .some--class__selector causing expected object to be null. Check the .js scripts of the module and update the selectors.