Next button in Payment Information page problem

6 years ago
Hi there,

Currently using SagePay for all users to make payments which is working great!

I wanted to introduce the ability for purchase orders for some of our clients so I installed a great little plugin 'PAYMENT DIRECTOR'.

This does indeed allow me to control the payment methods based on Customer Role which is great!

The biggest problem I have is to do with the next button that appears on the payment information page. I have currently disabled this for SagePay (iFrame) as it isn't required and it was confusing the process but now I want the button to be visible for Purchase Orders - but purchase orders only not sagepay.

Is there a way of controlling this button based on either the customer role or... paymentMethod?

I.E if paymentmethod selected is purchaseorder then show button else hide it.

the button in questions code is:
  
<div class="select-button">
<input type="submit" name="nextstep" value="@T("Checkout.NextButton")" class="button-1 payment-info-next-step-button" />
</div>

Any help greatly appreciated or if someone could point me in the right direction that would be great! :)

regards
6 years ago
OK, so I have managed to patch this with a piece of code from a topic I found on the forum which currently works as a patch  for my set-up.
It is using the Customer Role (which works due to the module I installed selecting the payment method by user role).

If anyone else wants to control this button based on user role as a quick 'patch' in the .cshtml page the code is as follows:

Views/PaymentInfo.cshtml

added to the top of the page:
@using Nop.Core;
@using Nop.Core.Domain.Customers;
@using Nop.Core.Infrastructure;
@using Nop.Services.Customers;

wrapped my input in this:

@if (EngineContext.Current.Resolve<IWorkContext>().CurrentCustomer.IsInCustomerRole("ROLE(s)_HERE"))
{
<div class="select-button" id="test">
<input type="submit" name="nextstep" value="@T("Checkout.NextButton")" class="button-1 payment-info-next-step-button" />
</div>
}

It definitely does the trick as a patch but I would ideally like this to work based on the payment method selected so I will update when I have figured this out or if anyone can assist.

cheers
6 years ago
Have you seen this?

https://www.nopcommerce.com/p/258/sagepay-server-integration-iframe-and-redirect-methods.aspx
6 years ago
Lolololol - missed that, thank you for pointing that one out!
So I can now do it based on role and payment method. :)

Thanks
6 years ago
Hi there,

Ok so it was slightly different to what was posted.....

it says to make the change in:
Presentation\Nop.Web\Themes\Sage\Views\Checkout\PaymentInfo.cshtml

But Sage shouldn't be under 'Themes'??


So i changed the following in the /Views/Checkout/PaymentInfo.cshtml

@if (Model.PaymentInfoControllerName != "PaymentSagePayServer")
                {
                <div class="select-button">
                    <input type="submit" name="nextstep" value="@T("Checkout.NextButton")" class="button-1 payment-info-next-step-button" />
                </div>
                }


Works like a charm!

thanks