Product pages taking too long to complete loading (20+ seconds)

9 months ago
There is an issue opening product pages in nopcommerce 4.2 beta for a fresh installation with sample data.

When you open a product page (simple or grouped) it loads the top half of the page (header, image, short description, add to cart button, etc) but everything beneath that (full description, related products, footer, etc) takes a while to complete loading.  For myself it is taking 20+ seconds to load (running locally on my development machine).

After puzzling over this for a while I have found that the problem exists in the following partial call in both ProductTemplate.Simple.cshtml and ProductTemplate.Grouped.cshtml:

@await Html.PartialAsync("_ShareButton", Model)


The code for _ShareButton.cshtml is the following:

@model ProductDetailsModel
@if (!string.IsNullOrWhiteSpace(Model.PageShareCode))
{
    <div class="product-share-button">
        @Html.Raw(Model.PageShareCode)
    </div>
}


with the problem existing in the call to @Html.Raw(Model.PageShareCode).

The code in Model.PageShareCode is (formatted here fore readability):

<!-- AddThis Button BEGIN -->
<div class=\"addthis_toolbox addthis_default_style \">
    <a class=\"addthis_button_preferred_1\"></a>
    <a class=\"addthis_button_preferred_2\"></a>
    <a class=\"addthis_button_preferred_3\"></a>
    <a class=\"addthis_button_preferred_4\"></a>
    <a class=\"addthis_button_compact\"></a>
    <a class=\"addthis_counter addthis_bubble_style\"></a>
</div>
<script src=\"http://s7.addcom/js/250/addthis_widget.js#pubid=nopsolutions\">
</script>
<!-- AddThis Button END -->


The issue is the call to the script at http://s7.addcom/js/250/addthis_widget.js#pubid=nopsolutions\ as this source does not exist and is taking a while to timeout.

The link should be http://s7.addthis.com/js/250/addthis_widget.js#pubid=nopsolutions\

This link is set in the CodeFirstInstallationService.  The link was changed to the incorrect link in commit dbf06071 which removed all references to 'this' throughout the code.  It seems that a find and replace was performed for the string "this." to change it to "".  As the commit involved 520 files this change must have got lost amongst them.

The link should be changed back to http://s7.addthis.com/js/250/addthis_widget.js#pubid=nopsolutions\ to correct the issue.
9 months ago
I have raised this on github: https://github.com/nopSolutions/nopCommerce/issues/3815
9 months ago
Hi David,

Thanks a lot for the pull request! Merged