OnePageCheckout huge loading time

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
9 years ago
Hello guys,

First of all, I`m sorry if someone else posted a similar issue, but I couldn't find anything.

I have made this post hoping that someone might be able to help me find some kind of fix.
My issue is that when I go to the checkout page, it takes an awful lot of time to load. Usually between 30-35 seconds. All the other pages within the site work pretty well, except for this one.
I have been searching for a while now, but I wasn't able to find anything to fix this issue, which is very important..

The only clue I found is that the loading takes this much because of the addresses. In the Chrome developer screen, in the network tab, it shows that almost half of the loading time is from "OnePageCheckout" and almost half of the remaining time is from "OpcSaveBilling".
Also, if it helps, each time this step is loaded, Chrome processor usage spikes at arount 30%.

Any kind of help or hints regarding this issue will be very appreciated.

Thank you all in advance,
Calin
9 years ago
Hi Calin,

1. What version of nopCommerce are you using?
2. How many addresses does your customer record has?
3. Try to register as a new customer. Do you still experience this issue?
9 years ago
Hello,
Sorry, i forgot to mention it :)

I`m using nop 3.3

The issue is the same, no matter if the customer is new or old. The one i`m testing with has 3 or 4 addresses saved, but the issue is the same even if i checkout as guest or with any other customer.
9 years ago
1. Do you experience this issue with "multi-step" checkout?
2. Are you using any third-party plugins?
9 years ago
Yes, the delay is more or less the same on woth checkout options.
As for plugins, everything I have is pagespeed insights (the load was the same before I installed it) and  ArtFactory theme with its required seven spikes plugins. I checked within them but I was unable to find anything that could help.
9 years ago
Thanks. But on this case it becomes quite complex to identify the issue without debugging of your solution (with a database backup)
9 years ago
[email protected] wrote:
Yes, the delay is more or less the same on woth checkout options.
As for plugins, everything I have is pagespeed insights (the load was the same before I installed it) and  ArtFactory theme with its required seven spikes plugins. I checked within them but I was unable to find anything that could help.


Hi,

You can enable the MiniProfiler to see if it is a server side issue or not.
The time to first byte (the time it takes to get the HTML from the server) could also be used to indentify if the slow loading comes from the server or it is some resource that is loading very slowly and slows down the whole page.
Please check so that we can advise!

Thanks
Boyko
9 years ago
I have enabled miniprofiler but for some reason it does not work on the checkout page.
I presume something is blocking some content, as there is a similar problem with some images and content from the top menu that are also not being displayed when in the checkout page.
9 years ago
I have found the reason of the long loading.
It's caused by the OpcBillingForm within the checkout controller.
That takes about 20 seconds to load, and the OpcSaveBilling takes about 6-7 seconds.

The OpcBillingForm action calls the following method.  

protected virtual CheckoutBillingAddressModel PrepareBillingAddressModel(int? selectedCountryId = null,
            bool prePopulateNewAddressWithCustomerFields = false)
        {
            var model = new CheckoutBillingAddressModel();
            //existing addresses
            var addresses = _workContext.CurrentCustomer.Addresses
                //allow billing
                .Where(a => a.Country == null || a.Country.AllowsBilling)
                //enabled for the current store
                .Where(a => a.Country == null || _storeMappingService.Authorize(a.Country))
                .ToList();
            foreach (var address in addresses)
            {
                var addressModel = new AddressModel();
                addressModel.PrepareModel(address,
                    false,
                    _addressSettings);
                model.ExistingAddresses.Add(addressModel);
            }

            //new address
            model.NewAddress.CountryId = selectedCountryId;
            model.NewAddress.PrepareModel(null,
                false,
                _addressSettings,
                _localizationService,
                _stateProvinceService,
                () => _countryService.GetAllCountriesForBilling(),
                prePopulateNewAddressWithCustomerFields,
                _workContext.CurrentCustomer);
            return model;
        }


I can't see anything in it that might cause such a long loading time.
If anyone has a better eye than me, please help me sort this out.

Thank you in advance,
Calin
9 years ago
[email protected] wrote:
I have found the reason of the long loading.
It's caused by the OpcBillingForm within the checkout controller.
That takes about 20 seconds to load, and the OpcSaveBilling takes about 6-7 seconds.

The OpcBillingForm action calls the following method.  

protected virtual CheckoutBillingAddressModel PrepareBillingAddressModel(int? selectedCountryId = null,
            bool prePopulateNewAddressWithCustomerFields = false)
        {
            var model = new CheckoutBillingAddressModel();
            //existing addresses
            var addresses = _workContext.CurrentCustomer.Addresses
                //allow billing
                .Where(a => a.Country == null || a.Country.AllowsBilling)
                //enabled for the current store
                .Where(a => a.Country == null || _storeMappingService.Authorize(a.Country))
                .ToList();
            foreach (var address in addresses)
            {
                var addressModel = new AddressModel();
                addressModel.PrepareModel(address,
                    false,
                    _addressSettings);
                model.ExistingAddresses.Add(addressModel);
            }

            //new address
            model.NewAddress.CountryId = selectedCountryId;
            model.NewAddress.PrepareModel(null,
                false,
                _addressSettings,
                _localizationService,
                _stateProvinceService,
                () => _countryService.GetAllCountriesForBilling(),
                prePopulateNewAddressWithCustomerFields,
                _workContext.CurrentCustomer);
            return model;
        }


I can't see anything in it that might cause such a long loading time.
If anyone has a better eye than me, please help me sort this out.

Thank you in advance,
Calin


I think the _storeMappingService.Authorize(a.Country) could take some time, and the time multiplies by how many addresses your customer has
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.