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

Magento 2.2.3 TypeErrors Cannot read property 'quoteData' / 'storecode' / 'sectionLoadUrl' of undefined #14412

Closed
brvm opened this issue Mar 28, 2018 · 8 comments
Labels
Area: Frontend Component: Checkout Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release

Comments

@brvm
Copy link

brvm commented Mar 28, 2018

Preconditions

  1. Magento 2.2.3
  2. PHP 7.0
  3. MySQL 5.5.38

Steps to reproduce

  1. Create a module in app/code/vendor
  2. Add checkout_cart_index.xml in templates folder under /view/frontend/layout
  3. Add following code:
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <link src="Vendor_Module/js/jquery.cartAjaxQty.js"/>
    </head>
</page>
  1. Add .js-file under /view/frontend/web/js called jquery.cartAjaxQty.js
require(['jquery',
    'domReady!',
    'Magento_Checkout/js/model/totals',
    'Magento_Checkout/js/view/summary/abstract-total',
    'Magento_Customer/js/customer-data',
    'Magento_Checkout/js/model/quote',
    'Magento_Catalog/js/price-utils',
    'Magento_Checkout/js/action/get-totals'], function () {
    jQuery(document).ready(function($){

        $(".cart-container .form-cart .action.update").remove();
        jQuery('#shopping-cart-table')
            .on(
                'change',
                'input[name$="[qty]"]',
                function(){
                    console.log("quantity changed");
                    var form = jQuery(jQuery(this).closest('form'));

                    $.ajax({
                        url: form.attr('action'),
                        data: form.serialize(),
                        type: 'post',
                        showLoader: true,
                        context: this.changedInput,
                        success: function (res) {
                            // var parsedResponse = $.parseHTML(res);
                            // var result = $(parsedResponse).find("#form-validate");
                            // $("#form-validate").replaceWith(result);
                            //
                            console.log('Ajax succes function completed');
                        },
                        error: function (xhr, status, error) {
                            var err = eval("(" + xhr.responseText + ")");
                            console.log(err.Message);
                        }
                    });

                }
            );
    });
});
  1. Add .js file to requirejs-config.js located in root frontend folder in module under /view/frontend
var config = {
    map: {
        '*': {
            ajaxQty: 'Vendor_Module/js/jquery.cartAjaxQty'
        }
    }
};
  1. Run

php bin/magento setup:upgrade

  1. Add item to cart and change the quantity in the input box on the cart page.

Expected result

  1. The .js code should load and requirements should be loaded properly
  2. When quantity changes it should output this in the console

(and later on I want to add code to reload the summary, that's why there are all those requirements in the require[])

Actual result

  1. Three different errors (sometimes displaying all in console, mostly one or two of the three) caused by most of the requirements:

screen shot 2018-03-28 at 11 43 54
screen shot 2018-03-28 at 11 44 19
screen shot 2018-03-28 at 11 44 28

@brvm brvm changed the title Magento 2.2.3 TypeErrors Cannot read property 'quoteData' / 'S Magento 2.2.3 TypeErrors Cannot read property 'quoteData' / 'storecode' / 'sectionLoadUrl' of undefined Mar 28, 2018
@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Mar 28, 2018
@brvm brvm changed the title Magento 2.2.3 TypeErrors Cannot read property 'quoteData' / 'storecode' / 'sectionLoadUrl' of undefined Magento 2.2.3 TypeErrors Cannot read property 'quoteData' / 'storecode' / 'sectionLoadUrl' of undefined Apr 10, 2018
@swayoleg
Copy link

swayoleg commented May 2, 2018

my workaroud was

  1. create quote.js at design package
  2. add 'domReady!'

copy vendor/magento/module-checkout/view/frontend/web/js/model/quote.js
to
app/design/frontend/%YOUR_DESIGNVENDOR%/%themename%/Magento_Checkout/web/js/model/quote.js

Then change define to

define([ 'ko', 'underscore', 'domReady!' ],
(add domReady!)

But its just a workaround. We need a core fix

@brvm
Copy link
Author

brvm commented May 3, 2018

We do. I have made a Stack topic about it and eventually found a (temporary) fix:

https://magento.stackexchange.com/questions/220206/dependecy-error-magento-2-sectionloadurl-error

@renttek
Copy link

renttek commented May 16, 2018

I also encountered this bug today, but only in Chrome and only for quoteData. THe workaround seems to fix this

@LiamKarlMitchell
Copy link

LiamKarlMitchell commented May 16, 2018

A possibly similar issue with Magento ver. 2.2.0
Installed extension if it matters: Free Gift for Magento 2

Cannot read property `quoteData` of undefined at quote.js:32
image

@Notall-wo
Copy link

I also encountered this bug, shield the'Magento_Checkout/js/action/get-totals' will not report an error, I don't know why it's affected, so no data was loaded

@ghost ghost self-assigned this Aug 23, 2018
@ghost ghost added Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Component: Checkout Area: Frontend labels Aug 23, 2018
@ghost
Copy link

ghost commented Aug 23, 2018

Hi @bramulous , thank you for your report.
We've acknowledged the issue and added to our backlog.

@ghost ghost added the Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release label Aug 23, 2018
@ghost ghost removed their assignment Aug 23, 2018
@magento-engcom-team magento-engcom-team added the Fixed in 2.3.x The issue has been fixed in 2.3 release line label Feb 25, 2019
@magento-engcom-team
Copy link
Contributor

Hi @bramulous. Thank you for your report.
The issue has been fixed in #18503 by @ihor-sviziev in 2.3-develop branch
Related commit(s):

The fix will be available with the upcoming 2.3.2 release.

@magento-engcom-team
Copy link
Contributor

Hi @bramulous. Thank you for your report.
The issue has been fixed in #21432 by @amol2jcommerce in 2.2-develop branch
Related commit(s):

The fix will be available with the upcoming 2.2.9 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Frontend Component: Checkout Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release
Projects
None yet
Development

No branches or pull requests

6 participants