Unable to add fontawesome css to payment plugin

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 years ago
I want to add font-awesome.min.css to Nop.Plugin.Payments.CheckMoneyOrder. So I did:

In Nop.Plugin.Payments.CheckMoneyOrder plugin project, under Views\PaymentInfo.cshtml, I added the file like below.
After that I built and gave a it a run. The css file is not loaded even though the code is executed when I debugged. What am I missing?

By the way I'm using Pavilion theme.

PaymentInfo.cshtml:

@{
    Layout = "";
    Html.AddCssFileParts("~/Plugins/Payments.CheckMoneyOrder/Content/font-awesome.min.css");
}

@using Nop.Web.Framework.UI
@model Nop.Plugin.Payments.CheckMoneyOrder.Models.PaymentInfoModel
<table width="100%" cellpadding="0" cellspacing="0">
    <tr>
        <td>
            @Html.Raw(Model.DescriptionText)
        </td>
    </tr>
</table>
7 years ago
Best practices of folder structure is:

- Nop.Plugin.Payments.CheckMoneyOrder
  -Content
   -fontawesome
     -font-awesome.min.css
   -fonts


If you're following same structure, then path should be

Html.AddCssFileParts("~/Plugins/Payments.CheckMoneyOrder/Content/fontawesome/font-awesome.min.css");

I'm not sure about Pavilion theme! please check without it also!
7 years ago
make sure the Content/font-awesome.min.css file exists in the content folder
in your project  
click on the file  -> properties
Copy to output directory: Copy if newer

then build and check if the file exists in your plugin folder
7 years ago
I already tried that.

When I verified the url below, it's there. However it's no where in the html when it's rendered.
https://storeurl/plugins/payments.checkmoneyorder/content/css/font-awesome.min.css
7 years ago
I tried at my end as described above, and it's just working fine!
[email protected] wrote:
I already tried that.

When I verified the url below, it's there. However it's no where in the html when it's rendered.
https://storeurl/plugins/payments.checkmoneyorder/content/css/font-awesome.min.css


Can you please check the status of that css file in console!
7 years ago
It's not loaded but the url pointing to the css file is working. So what actually happened is in 3.9 we have to load the method @Html.NopCssFiles(this.Url, ResourceLocation.Head) after you add the css file or else it won't be added. Another way is to add the file into _Root.Head.cshtml if it's being used throughout the application.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.