Configure allowed shipping methods based on selected payment method

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
Hello,
the question is as in the title: is it possible to configure allowing some shipping methods based on selected payment method (or the other way round) ?

The example is that if client selects sending the package by UPS then he shouldn't be allowed to select "Pay in store" option, because that makes no sense.

Thank you.
12 years ago
It's not possible with the standard version of nop.

But everything is possible though, with a bit of programming this would not seem so much work to do.
My suggestion would be to first let the user choose the delivery method (since this is the first in the payment sequence) and then, based on that, show the payment methods (or not).
12 years ago
Thx. I just wanted to be sure I'm not missing something. I'll probably implement that myself. I've already started analysing the code.. The thing that puzzles me right now is why are there two separate object contexts and every entity is defined twice - once using the database first approach and once again code-only, but that's a different story...
12 years ago
This is really needed to be on the roadmap. many need this feature.
12 years ago
I've already implemented this, so I can contribute my work if anyone wants to.
12 years ago
yes please. could you please post the codes that needs change with a bit of clarification?
or if anything downloadable helps would you send it to me?
I'm using nop 1.9
12 years ago
The change requires creation of one table in the database and modifications in the checkout process. I'll prepare the code and post somewhere, but that's not going to be very soon.
12 years ago
Because the shipping and payment methods in nearly all shops are the same (and because of shortage in time) I considered to hardcode the required codes,
these are the codes that need change:
(in modules\checkoutpaymentmethod.ascx.cs)
something like this:

var paymentMethods = this.PaymentService.GetAllPaymentMethods(filterByCountryId);
            foreach (var pm in paymentMethods)
            {
                switch (pm.PaymentMethodType)
                {
                    case PaymentMethodTypeEnum.Unknown:
                    case PaymentMethodTypeEnum.Standard:
                        {
//ADDITIONAL CODE FROM HERE
switch (NopContext.Current.User.LastShippingOption.Name.Trim())
                            {
                                case "SHIPPING1":
                                case "SHIPPING2":
                                case "SHIPPING3":
                                    if (pm.SystemKeyword.Equals("PAYINSTORE") || pm.SystemKeyword.Equals("CashOnDelivery"))
                                        continue;
                                    break;
                                case "SHIPPING4":
                                    if (pm.SystemKeyword.Equals("CashOnDelivery"))
                                        continue;
                                    break;
                                case "SHIPPING5":
                                    if (pm.SystemKeyword.Equals("PAYINSTORE"))
                                        continue;
                                    break;
                            }
//ADDITIONAL ENDED

                            if (!Cart.IsRecurring || this.PaymentService.SupportRecurringPayments(pm.PaymentMethodId) != RecurringPaymentTypeEnum.NotSupported)
                                boundPaymentMethods.Add(pm)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.