Adyen / adyen-shopware6

Adyen Payment plugin for Shopware 6
MIT License
21 stars 22 forks source link

[ECP-8832] CartPlugin already registered #440

Closed danijelpetkovic closed 1 month ago

danijelpetkovic commented 11 months ago

Describe the bug Once you add the plugin to the shop, it keeps giving console error that CartPlugin is already registered.

Versions Shopware version: 6.4.20.2 Plugin version: 3.14.2

To Reproduce Steps to reproduce the behavior:

  1. Go to any page
  2. Open console
  3. check for error: all.js?17019650061415932:3 Uncaught Error: Plugin "CartPlugin" is already registered.
danijelpetkovic commented 10 months ago

Screenshot 2023-12-18 at 10 03 59 Screenshot 2023-12-18 at 10 04 26

danijelpetkovic commented 10 months ago

I tried to use Shopware 6 default theme, and this error still shows.

PeterMarteau commented 10 months ago

I already wrote an email to adyen reporting that problem, but never got an answer. Problem is that the dist.js in shopware/vendor/adyen/adyen-shopware6/src/Resources/app/storefront/dist/storefront/js get also loaded when installing the plugin.

A really dirty workaround:

Copy shopware/vendor/adyen/adyen-shopware6/src/AdyenPaymentShopware6.php somewhere and change the following method so it looks like this:

 public function installJsAssets($shopwareVersion)
    {
        $storefrontAssetPath = __DIR__ . '/Resources/app/storefront/dist/storefront/js/adyen-payment-shopware6.js';
        $adminAssetPath = __DIR__ . '/Resources/public/administration/js/adyen-payment-shopware6.js';
        if (\version_compare($shopwareVersion, '6.5.0.0', '<')) {
            $resultAdmin = copy(
                __DIR__ . '/Resources/public/administration/js/adyen-payment-shopware64.js.dist',
                $adminAssetPath
            );
        } else {
            $resultStorefront = copy(
                __DIR__ . '/Resources/app/storefront/dist/storefront/js/adyen-payment-shopware65.js.dist',
                $storefrontAssetPath
            );
            $resultAdmin = copy(
                __DIR__ . '/Resources/public/administration/js/adyen-payment-shopware64.js.dist',
                $adminAssetPath
            );
        }
    }

In the composer.json and the post-install and post-update cmd add these lines:


"cp **<pathtomodified>**/AdyenPaymentShopware6.php vendor/adyen/adyen-shopware6/src/AdyenPaymentShopware6.php",
"cp vendor/adyen/adyen-shopware6/src/Resources/app/storefront/dist/storefront/js/adyen-payment-shopware64.js.dist vendor/adyen/adyen-shopware6/src/Resources/app/storefront/dist/storefront/js/adyen-payment-shopware6.js || true",
"rm vendor/adyen/adyen-shopware6/src/Resources/app/storefront/dist/storefront/js/*.js.dist || true ",
hossam-adyen commented 10 months ago

Hi @danijelpetkovic @PeterMarteau, thanks for opening the issue and giving more context, we have included the issue in our internal backlog and we will keep you posted of the updates

PeterMarteau commented 10 months ago

Hi, its actually fixed in 4.1.3 :) I tested it in our shop and it works. Just do the update and the workaround is not needed anymore.

Edit: Our support case at adyen for which we got the message that it is fixed for reference: 03125743 with subject [Test Env] JavaScript Error causing other JS to not be executed

danijelpetkovic commented 10 months ago

@hossam-adyen @PeterMarteau Hey guys. What do you mean it is resolved in 4.1.3? That version is not existing. The latest adyen version is 3.14.3. I have that version installed and the error still occurs.

Screenshot 2024-01-02 at 14 50 10 Screenshot 2024-01-02 at 14 50 43

hossam-adyen commented 10 months ago

Hi @danijelpetkovic thanks for your comment, I will reopen this and included in our backlog to investigate this further

PeterMarteau commented 10 months ago

@danijelpetkovic I'm sorry, i of course meant 3.14.3 as the latest version, not 4.1.3. For us it fixed it. I cant test it any further for shopware version 6.4.20.2 because in the meantime we updated to shopware v6.5. But I'm pretty sure it worked with 6.4.20.2 as well. You sure you did run bin/build-storefront.sh after updating? Also i think the problematic stuff happens in the install routine of the plugin. I dont know if Adyen also included some fix in the update routine. So maybe try bin/console plugin:uninstall and then install it again.

And if it still doesnt work then just use the dirty workaround i posted earlier. This definitely worked.

danijelpetkovic commented 10 months ago

@PeterMarteau Thanks for the suggestions. I tried deinstalling and installing the plugin again, but the error still persists and the shop is still broken. I guess I will have to wait for Adyen fix.

@hossam-adyen Hello. Is there maybe any news on the issue? Thanks

khushboo-singhvi commented 10 months ago

Hello @danijelpetkovic,

Thank you sincerely for your patience and collaboration throughout the process. We truly appreciate your dedication to resolving this issue.

I would like to inform you that we have opened an issue in our internal backlog to further investigate and address the reported problem. We are actively working on this, and you can expect to hear from us soon regarding a proposed solution.

Your continued cooperation and valuable insights are crucial to our efforts, and we are committed to ensuring a swift and effective resolution.

If you have any additional thoughts, questions, or updates in the meantime, please don't hesitate to share them with us.

Once again, thank you for your understanding and support.

Regards! Khushboo

adyen-integrations-support commented 1 month ago

Hey all,

This issue is fixed and new V4 and V3 plugin versions are released.

Best Regards.