Display Reward Points in Header?

2 ヶ月 前
4.60.6
i want to display current users reward points in header _Header.cshtml
tried solution from forum for version 4.10, it didn't work.
how can i do it?
thanks
2 ヶ月 前
use this piece of code at src\Presentation\Nop.Web\Views\Shared\Components\HeaderLinks\Default.cshtml
@using Nop.Services.Orders
@using Nop.Core
@inject IRewardPointService rewardPointService
@inject IWorkContext workContext
@inject IStoreContext storeContext
@{
    var rewardPoints = await rewardPointService.GetRewardPointsBalanceAsync((await workContext.GetCurrentCustomerAsync()).Id, (await storeContext.GetCurrentStoreAsync()).Id);
}

 <li><a>@T("MyRewordPoints") @rewardPoints</a></li>



put your language string value for "MyRewordPoints"
//Rashed
2 ヶ月 前
nopStation wrote:
use this piece of code at src\Presentation\Nop.Web\Views\Shared\Components\HeaderLinks\Default.cshtml
@using Nop.Services.Orders
@using Nop.Core
@inject IRewardPointService rewardPointService
@inject IWorkContext workContext
@inject IStoreContext storeContext
@{
    var rewardPoints = await rewardPointService.GetRewardPointsBalanceAsync((await workContext.GetCurrentCustomerAsync()).Id, (await storeContext.GetCurrentStoreAsync()).Id);
}

 <li><a>@T("MyRewordPoints") @rewardPoints</a></li>



put your language string value for "MyRewordPoints"
//Rashed


Thank you so much nopStation!

Works very well! :)