Hi,
Would be a great feature to be able to restrict Payment Method to one or many Customer Roles.
Eg. Only your "trusted" customers can order with Purchase Order, others have to pay with Credit Card.
--
Kenny
@model CheckoutPaymentMethodModel
@using Nop.Web.Models.Checkout;
@using Nop.Core.Domain.Customers;
@{
List<CustomerRole> crCustRole = new List<CustomerRole>();
List<string> strCustRole = new List<string>();
crCustRole.AddRange(WorkContext.CurrentCustomer.CustomerRoles);
int intCRCount = crCustRole.Count;
bool isCorp = false;
for (int iCRIndex = 0; iCRIndex < intCRCount; iCRIndex++)
{
strCustRole.Add(crCustRole[iCRIndex].Name);
if (crCustRole[iCRIndex].Name == "Corporate")
{
isCorp = true;
}
}
}
<div class="checkout-data">
@Html.Widget("op_checkout_payment_method_top")
<div class="section payment-method">
@if (Model.DisplayRewardPoints && Model.PaymentMethods.Count > 0)
{
<div class="use-reward-points">
@Html.EditorFor(model => model.UseRewardPoints)
@string.Format(T("Checkout.UseRewardPoints").Text, Model.RewardPointsBalance, Model.RewardPointsAmount)
</div>
}
@if (Model.PaymentMethods.Count > 0)
{
<ul class="method-list">
@for (int i = 0; i < Model.PaymentMethods.Count; i++)
{
var paymentMethod = Model.PaymentMethods[i];
var paymentMethodName = paymentMethod.Name;
if (!String.IsNullOrEmpty(paymentMethod.Fee))
{
paymentMethodName = T("Checkout.SelectPaymentMethod.MethodAndFee", paymentMethodName, paymentMethod.Fee).Text;
}
<li>
<div class="method-name">
@if (!isCorp && paymentMethod.Name == "Purchase Order")
{
}
else
{
if (!String.IsNullOrEmpty(paymentMethod.LogoUrl))
{
<div class="payment-logo">
<label for="paymentmethod_@(i)">
<img src="@paymentMethod.LogoUrl" alt="@paymentMethodName" />
</label>
</div>
}
<div class="payment-details">
<input id="paymentmethod_@(i)" type="radio" name="paymentmethod" value="@(paymentMethod.PaymentMethodSystemName)" checked="@paymentMethod.Selected" />
<label for="paymentmethod_@(i)">@paymentMethodName</label>
</div>
}
</div>
</li>
}
</ul>
}
else
{
<div class="message-error">
@T("Checkout.NoPaymentMethods")
</div>
}
</div>
@Html.Widget("op_checkout_payment_method_bottom")
</div>