nopSolutions / nopCommerce

ASP.NET Core eCommerce software. nopCommerce is a free and open-source shopping cart.
https://www.nopcommerce.com
Other
9.08k stars 5.19k forks source link

IIS Localhost Issue with css and javascript #7214

Closed abodehq closed 1 month ago

abodehq commented 1 month ago

nopCommerce version: 4.7

I have downloaded nopcommerce 4.7 and using iis to run it locally so the path of my new site : http://localhost/EShopWeb/en

i have problem in loading javascript and css files so some time the path of resource http://localhost/EShopWeb/EShopWeb/...

so i fix it by change the code in \Presentation\Nop.Web.Framework\UI\NopHtmlHelper.cs for both css na javascript as below :

in public virtual IHtmlContent GenerateScripts(ResourceLocation location) { if (route.Contains(pathBase)) { result.AppendFormat("<script type=\"{0}\" src=\"{1}{2}\">", MimeTypes.TextJavascript, "", route); } else { result.AppendFormat("<script type=\"{0}\" src=\"{1}{2}\">", MimeTypes.TextJavascript, pathBase, route); }

} and for css public virtual IHtmlContent GenerateCssFiles() { if(route.Contains(pathBase)) { result.AppendFormat("<link rel=\"stylesheet\" type=\"{0}\" href=\"{1}{2}\" />", MimeTypes.TextCss, "", route); } else { result.AppendFormat("<link rel=\"stylesheet\" type=\"{0}\" href=\"{1}{2}\" />", MimeTypes.TextCss, pathBase, route); }

result.AppendLine(); }

please let me know if have do it wrong or this actually a bug !!

atulrungta commented 1 month ago

@abodehq can you please share screenshot of your store configuration? This must be because of incorrect host value in your store configuration otherwise it's a bug.

abodehq commented 1 month ago

image image

atulrungta commented 1 month ago

@abodehq can you please share screenshot of store setting? You will able to find store setting from the admin panel.

Something like Your_store_url/Admin/Store/Edit/1

glhays commented 1 month ago

If you don't have that registered in your host file of your local machine it will not resolve when iis fires up so your domains will be different.

There are many community forum posts on Nop that address these local iis setups for local host.

These git issues are meant for Issues not fixing setup issues on dev machines. Just saying.

On Fri, May 31, 2024, 11:19 AM Atul Rungta @.***> wrote:

@abodehq https://github.com/abodehq can you please share screenshot of store setting? You will able to find store setting from the admin panel.

Something like Your_store_url/Admin/Store/Edit/1

— Reply to this email directly, view it on GitHub https://github.com/nopSolutions/nopCommerce/issues/7214#issuecomment-2142764037, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKD4KOYMENMPVW6NV4ZT4QTZFC5JXAVCNFSM6AAAAABITDQ73SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBSG43DIMBTG4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

AndreiMaz commented 1 month ago

Please post all technical questions on our forums. We use GitHub for work items only

abodehq commented 1 month ago

image guys this issue is still exist even in the admin image please let me know if i missed anything

I believe its a bug

abodehq commented 1 month ago

i already suggest a fix that can work for any one face the same issue , please check my first post