This is probably right in front of me but hopefully someone can put me right!
I am creating a custom payment provider. Have looked through the posts on doing it but I'm missing one bit of information.
It will be the only payment method and I want to skip the "Payment" checkout step, avoiding the input of selecting a method and entering card details, jumping right to the final confirmation screen so I can send the user to the remote payment page.
I can't find any configuration way of doing this and I've been carefully avoiding modifying the Nop source to preserve my upgrade-ability.
I don't believe this is possible without making code changes. If you're able to make code changes, then if you wanted to skip the Payment Method selection (e.g., because you only have one payment method) you could add something like the code shown below in bold to the BindData() method in CheckoutPaymentMethod.ascx (this is using the 1.7 codebase)
if (boundPaymentMethods.Count == 0) { if (hasButtonMethods) { phSelectPaymentMethod.Visible = false; pnlPaymentMethodsError.Visible = false;
//no reward points in this case pnlRewardPoints.Visible = false; } else { phSelectPaymentMethod.Visible = false; pnlPaymentMethodsError.Visible = true; lPaymentMethodsError.Text = GetLocaleResourceString("Checkout.NoPaymentMethods");
//no reward points in this case pnlRewardPoints.Visible = false; } } else if (boundPaymentMethods.Count == 1) { PaymentMethodSelected(boundPaymentMethods[0].PaymentMethodId); } else { phSelectPaymentMethod.Visible = true; pnlPaymentMethodsError.Visible = false; dlPaymentMethod.DataSource = boundPaymentMethods; dlPaymentMethod.DataBind(); }
If you wanted to skip the PaymentInfo page then you could add some further code at the end of the BindData() method in CheckPaymentInfo.ascx
else if (paymentMethod != null && paymentMethod.IsActive) { this.PaymentInfo = this.GetPaymentInfo(); var args1 = new CheckoutStepEventArgs() { PaymentInfoEntered = true }; OnCheckoutStepChanged(args1); if (!this.OnePageCheckout) Response.Redirect("~/checkoutconfirm.aspx"); }
However you would need to recompile the application after these changes. Someone may have a better solution to this requirement...
No, I really like that. I'll create a copy of the ascx in another location so it doesn't get overwritten when I upgrade and then modify it. Very neat solution.
Many thanks indeed for taking the time to have a look!