I created a dropdown on admin product page which works fully great. I also added the string resources for dropdown values.
I am trying to show this values on product detail page but I cannot show the string resources. Any help will be appreciated.
Here is the steps I followed,
1- Created a new cs file for dropdown
nopCommerce_3.80_Source/Libraries/Nop.Core/Domain/Catalog/Stowageunit.cs
namespace Nop.Core.Domain.Catalog
{
/// <summary>
/// Represents the ship size
/// </summary>
public enum Stowageunit
{
/// <summary>
/// Please Select
/// </summary>
PleaseSelect = 0,
/// <summary>
/// cbm/MT
/// </summary>
cbmMT = 10,
/// <summary>
/// cbft/MT
/// </summary>
cbftMT = 20,
/// <summary>
/// cbm/LT
/// </summary>
cbmLT = 30,
/// <summary>
/// cbft/LT
/// </summary>
cbftLT = 40,
}
}
2- Added following code to nopCommerce_3.80_Source/Libraries/Nop.Core/Domain/Catalog/Product.cs
/// <summary>
/// Stowage Unit Id
/// </summary>
public int? StowageunitId { get; set; }
/// <summary>
/// Gets or sets the Stowage Factor Unit
/// </summary>
public Stowageunit Stowageunits
{
get
{
return (Stowageunit)this.StowageunitId;
}
set
{
this.StowageunitId = (int)value;
}
}
3- this.Ignore(p => p.Stowageunits); on nopCommerce_3.80_Source/Libraries/Nop.Data/Mapping/Catalog/ProductMap.cs and .ForMember(dest => dest.Shipsizes, mo => mo.Ignore()) on nopCommerce_3.80_Source/Presentation/Nop.Web/Administration/Infrastructure/Mapper/AutoMapperConfiguration.cs
4- Added on my ProductModel and _CreateOrUpdate.Info.cshtml and entered the language strings for enums.
After these steps,this works completely fine on Admin.
5- To show on product detail page added the StowageunitId to the ProductDetailsMotel in Nop.Web and in ProductTemplate.Simple.cshtml added following lines;
@if (Model.stowagefactor.HasValue && Model.stowagefactor.Value > 0)
{
<div class="additional-details">
<span class="label">@T("Admin.Catalog.Products.Fields.stowagefactor"):</span>
@Html.Raw(Model.stowagefactor)
@Html.Raw(((Stowageunit)Model.StowageunitId))
</div>
This gives me the cbmMT instead of the language string cbm/MT
When I try DisplayFor it gives me the integer like 10, 20, etc.
How can I display the language string on product detail page?