The 5th annual nopCommerce conference will take place in India on the 10th-11th of October. Please find more about this event here

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

Posted: May 09, 2019 at 6:01 PM Quote #231475
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.
This post/answer is useful
1
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: May 09, 2019 at 6:09 PM Quote #231480
I have raised this on github: https://github.com/nopSolutions/nopCommerce/issues/3815
This post/answer is useful
1
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: May 14, 2019 at 2:09 AM Quote #231795
Hi David,

Thanks a lot for the pull request! Merged
This post/answer is useful
1
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Interested in the dedicated Premium support services provided by core developers? Please visit http://www.nopcommerce.com/supportservices.aspx

Regards,
Andrei Mazulnitsyn
Premium support services
  • Dedicated premium support services provided by core developers are intended for persons who run mission critical websites, work on projects with tight deadlines, or want to get dedicated support.
Professional services
  • Want to open a new store? Want to take your store to the next level? Need a custom extension? We can customize nopCommerce to fit your store perfectly. Request a quote to get started.
eCommerce CONFERENCE 2019
Learn more