Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ECP-8832] CartPlugin already registered #440

Open
danijelpetkovic opened this issue Dec 7, 2023 · 10 comments
Open

[ECP-8832] CartPlugin already registered #440

danijelpetkovic opened this issue Dec 7, 2023 · 10 comments
Assignees

Comments

@danijelpetkovic
Copy link

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
Copy link
Author

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

@danijelpetkovic
Copy link
Author

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

@hossam-adyen hossam-adyen self-assigned this Dec 19, 2023
@PeterMarteau
Copy link

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
Copy link
Contributor

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

@hossam-adyen hossam-adyen changed the title CartPlugin already registered [ECP-8832] CartPlugin already registered Dec 20, 2023
@PeterMarteau
Copy link

PeterMarteau commented Dec 20, 2023

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
Copy link
Author

@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
Copy link
Contributor

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

@hossam-adyen hossam-adyen reopened this Jan 2, 2024
@PeterMarteau
Copy link

@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
Copy link
Author

@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
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants