Close

Unable to add fontawesome css to payment plugin

chongtto
7 years ago
#13314 Quote
Avatar
  • 6
I'm using Pavilion theme.
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?

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>

Also I already checked that the css file was always copied to deployment dir.
hristian.dimov
7 years ago
#13319 Quote
Avatar
  • Moderator
  • 386
chongtto wrote:
I'm using Pavilion theme.
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?

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>

Also I already checked that the css file was always copied to deployment dir.


Hi,

I don't think that the problem comes from the theme. You can switch to DefaultClean and check if the result is the same.

My best guess is that as the payment plugins are loaded "dynamically" this means that you cannot use extension methods like "AddCssFileParts". Just try to add the CSS file with the <link> tag e.g.:  <link rel="stylesheet" type="text/css" href="link-to-your-css-file.css">
Regards,
Hristian Dimov
Nop-Templates.com