Why Jquery scripts don't work in Nopcommerce??

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
10 anos atrás
I have tried adding some jquery scripts and they never seem to work with NopCommerce. I take the same code and the same scripts and add them to a non-NopCommerce site everything works and there is no problems. When I try adding it to NopCommerce the script does not work, I have tried adding it via a new script file as well as manually adding to the head. Never seems to work or function...any help in showing me how to get a jquery script to work would be appreciated...
10 anos atrás
Pdesignz wrote:
I have tried adding some jquery scripts and they never seem to work with NopCommerce. I take the same code and the same scripts and add them to a non-NopCommerce site everything works and there is no problems. When I try adding it to NopCommerce the script does not work, I have tried adding it via a new script file as well as manually adding to the head. Never seems to work or function...any help in showing me how to get a jquery script to work would be appreciated...


Mind to show how are you adding them before we can give any suggestions? :)
10 anos atrás
I have tried adding them via the _root.head.cshtml file. I have tried adding them as  a script file and as well trying  manually adding the entire script inline...I have also tried as I wanted this to work on a topic page, so I tried adding via the topic block and topic details page and even tried via code view in the topic feature via the backend system
10 anos atrás
Pdesignz wrote:
I have tried adding them via the _root.head.cshtml file. I have tried adding them as  a script file and as well trying  manually adding the entire script inline...I have also tried as I wanted this to work on a topic page, so I tried adding via the topic block and topic details page and even tried via code view in the topic feature via the backend system


So when you say it doesn't work, what exactly is the error? :)
10 anos atrás
I believe the error said undefined, but I can try adding the scripts and files back. If I want this on a topic page should I add the scripts to the _root.head.chtml or should I try adding them to the topic details file
10 anos atrás
Pdesignz wrote:
I believe the error said undefined, but I can try adding the scripts and files back. If I want this on a topic page should I add the scripts to the _root.head.chtml or should I try adding them to the topic details file


If it says $ is undefined, you probably have used Html.AppendScriptParts. Try using Html.AddScriptParts instead and see how it works. :)
10 anos atrás
Yes, you are correct as that is what was already there and i just copied one of the files names and changed it to the new files...here is what was already there before I added the new file

Html.AppendCssFileParts(@Url.Content("~/Content/smoothness/jquery-ui-1.8.17.custom.css"));
    
    
    Html.AppendScriptParts(@Url.Content("~/Scripts/public.ajaxcart.js"));
    Html.AppendScriptParts(@Url.Content("~/Scripts/public.common.js"));
    Html.AppendScriptParts(@Url.Content("~/Scripts/jquery-ui.min.js"));
    Html.AppendScriptParts(@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js"));
    Html.AppendScriptParts(@Url.Content("~/Scripts/jquery.validate.min.js"));
    Html.AppendScriptParts(@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js"));
    Html.AppendScriptParts(@Url.Content("~/Scripts/jquery-1.7.1.min.js"));

So you are saying try using Html.AddScriptParts instead, I also noticed in the head.cshtml for the css file it is using Html.AppendCssFileParts, if I want to add additional css files should i use Html.AddCssFileParts or is Append OK...
10 anos atrás
Pdesignz wrote:
Yes, you are correct as that is what was already there and i just copied one of the files names and changed it to the new files...here is what was already there before I added the new file

Html.AppendCssFileParts(@Url.Content("~/Content/smoothness/jquery-ui-1.8.17.custom.css"));
    
    
    Html.AppendScriptParts(@Url.Content("~/Scripts/public.ajaxcart.js"));
    Html.AppendScriptParts(@Url.Content("~/Scripts/public.common.js"));
    Html.AppendScriptParts(@Url.Content("~/Scripts/jquery-ui.min.js"));
    Html.AppendScriptParts(@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js"));
    Html.AppendScriptParts(@Url.Content("~/Scripts/jquery.validate.min.js"));
    Html.AppendScriptParts(@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js"));
    Html.AppendScriptParts(@Url.Content("~/Scripts/jquery-1.7.1.min.js"));

So you are saying try using Html.AddScriptParts instead, I also noticed in the head.cshtml for the css file it is using Html.AppendCssFileParts, if I want to add additional css files should i use Html.AddCssFileParts or is Append OK...


For simplicity, just add all your files (CSS and Scripts) behind the original files, and use Add. :)
10 anos atrás
I will try add and see if that helps make the scripts work, and let you know if works or not, also would you have any recommendations or are there any plugins for nopCommerce that would enable a photo gallery to work with nopCommerce
10 anos atrás
Pdesignz wrote:
I will try add and see if that helps make the scripts work, and let you know if works or not, also would you have any recommendations or are there any plugins for nopCommerce that would enable a photo gallery to work with nopCommerce


No, I don't really know of any. :)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.