Html.AppendScriptParts Scripts Are in Wrong Order

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
8 years ago
Hi, I'm designing a theme and in my _Root.Head.cshtml file I have the script file ordered as they should be, but when I run the site they are reordered in the wrong order. Can someone tell me what I need to do to get this ordered correctly? This is how I have them:


Html.AppendScriptParts("~/Scripts/jquery-1.10.2.min.js");
Html.AppendScriptParts("~/Scripts/public.ajaxcart.js");
Html.AppendScriptParts("~/Scripts/public.common.js");
Html.AppendScriptParts("~/Scripts/jquery-migrate-1.2.1.min.js");
Html.AppendScriptParts("~/Scripts/jquery-ui-1.10.3.custom.min.js");
Html.AppendScriptParts("~/Scripts/jquery.validate.min.js");
Html.AppendScriptParts("~/Scripts/jquery.validate.unobtrusive.min.js");
Html.AppendScriptParts("~/Themes/MyTheme/Content/js/bootstrap.min.js");
Html.AppendScriptParts("~/Themes/MyTheme/Content/js/grids.js");
Html.AppendScriptParts("~/Themes/MyTheme/Content/js/custom.js");
8 years ago
Use AddScriptParts method instead of AppendScriptParts
8 years ago
That worked perfectly. Thank you.
7 years ago
Thanks ! that helped me too.

I have one more problem related to js and css.

All the Javascript and css files are called in the header which is acting as blocking element for DOM elements and increasing the page load time. It is really critical as far as performance of nopcommerce is concerned.

I tried adding all css and js files in the footer by that didn't work at all(If possible, then do comment). They were still showing up in head section only.

I searched and found a way by using "async and defer" in js & css reference. It's something like this :
<script async src="~/some_folder/jquery.js" type="text/javascript"></script>.

But in nopcommerce, the reference is given as: Html.AddScriptParts("~/some_folder/jquery.js")..

How can i add "async" in nopcommerce ? Can it done this way: Html.AddScriptParts("~/some_folder/jquery.js  async")

If not, Is there some other ways to achieve that ?

Thanks in advance. The answers will be deeply appreciated....
7 years ago
cinna wrote:
...

It's not supported not of the box. But thanks for suggestion. I've just created a work item
7 years ago
Thanks for creating work item.

I have also faced one more issue in order details where in, an order cannot be cancelled by the customers.
I have posted in forum . Here is the url : https://www.nopcommerce.com/boards/t/41807/cancel-order-feature-for-customers-in-nopcommerce.aspx

Do have a look of it & reply. If out of box, then pls create a work item for the same.

Thanks again.
7 years ago
Done. Thanks again for suggestion!
7 years ago
Cool!

I looked up to github and get the option of download the whole 96 MB file.

What next should i do ? How should i implement that ?

Thnaks
7 years ago
Hi,
You have to go to https://github.com/nopSolutions/nopCommerce/commit/214997d10b4b277390fb71259c495316fcb9fb1d

Open your source code Nop.Web.Framework project and make changes, compile the project.
In your View use

Html.AppendScriptParts("~/Scripts/public.ajaxcart.js", true, true);
Html.AppendScriptParts("~/Scripts/public.common.js", true, true);

Upload your compiled Nop.Web.Framework project to your production
7 years ago
Hi, is it possible to do it without recompiling?
Maybe someone will be so kind and share compiled dll's?
Will be very thankful )))
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.