Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Dima Stefantsov 100 posts 225 karma points
    Apr 04, 2013 @ 16:48
    Dima Stefantsov
    0

    Shipping methods: Available Payment Methods

    Let's say I have just installed Razor example store.

    In uCommerce - Settings - Orders - Shipping Methods - Download - Access tab there is Available Payment Methods checkboxes. Even though Invoice is not checked, it will still appear available on Payment page after I have selected Download on Shipping page.

    Is it a bug? If it's not, how it supposed to work then?

  • Morten Skjoldager 440 posts 1499 karma points
    Apr 05, 2013 @ 08:27
    Morten Skjoldager
    0

    Hi, Dimps

    I think it would appear to be not included in the razor store. But i cannot tell. Because i don't know how the paymentmethods are displayed in your version. However you can extract paymentmethods from.

    YourShippingMethod.EligiblePaymentMethods 

    Bear in mind that paymentmethods also filters on ProductCatalogGroups and countries and currency. So it should be a combination of these :) 

    Please feel free to post the code you have so i can take a look at it :) 

  • Nickolaj Lundgreen 233 posts 1132 karma points
    Apr 05, 2013 @ 10:32
    Nickolaj Lundgreen
    0

    You can't just copy past this but im sure you can fill out the "blanks". I hope it helps you in the right direction :)

    public IEnumerable GetShippingMethodsByCountry(Country country)
            {
                return ShippingMethod.All().Where(method => method.EligibleCountries.Any(eligiblecontry => eligiblecontry.CountryId == country.CountryId));
            }
    public IEnumerable ShippingMethods { get { return ShippingMethod.All(); } }
     public IEnumerable ValidShippingMethods
            {
                get
                {
                    var billingAddress = this.Basket.GetBillingAddress();
                    var payments = this.Basket.Payments;
                    var country = billingAddress.Country;
                    var currency = this.Catalog.GetCurrency();
    
                    IEnumerable validShippingMethods = this.ShippingMethods;
    
                    //restrict by choosen billing Address
                    if (billingAddress != null && country != null)
                    {
                        validShippingMethods = this.GetShippingMethodsByCountry(country);
                    }
    
                    //restrict by choosen payment method
                    if (payments.Any())
                    {
                        foreach (var payment in payments)
                        {
                            var method = payment.PaymentMethod;
    
                            validShippingMethods = validShippingMethods.Where(x => x.EligiblePaymentMethods.Any(y => y.PaymentMethodId == method.PaymentMethodId));
                        }
                    }
    
                    return validShippingMethods.Where(x=>x.ShippingMethodPrices.Any(y => y.Currency == currency));
    
                }
            } 
  • Dima Stefantsov 100 posts 225 karma points
    Apr 05, 2013 @ 15:40
    Dima Stefantsov
    0

    Known Issues

    We beleive we've managed to iron all the issues that have been reported so if you spot anything let us know!

    Then this is my way to report the issue in razor store: it indeed only have @foreach (var paymentMethod in TransactionLibrary.GetPaymentMethods()) which only filters by country as far as I can see.

  • Morten Skjoldager 440 posts 1499 karma points
    Apr 10, 2013 @ 10:01
    Morten Skjoldager
    0

    Allrighty Dimps. Thanks for the input.

    Did you manage to filter the paymentMethods you wanted? 

  • Dima Stefantsov 100 posts 225 karma points
    Apr 10, 2013 @ 17:38
    Dima Stefantsov
    0

    Yes, thank you Morten.

    I was wondering why doesn't it work like that by default in demo store. Since then there was commits in demo store repository that address available payment methods, but I haven't checked out and tested them yet.

  • Morten Skjoldager 440 posts 1499 karma points
    Apr 11, 2013 @ 09:51
    Morten Skjoldager
    0

    Okay, neither have i :) 

    If you could mark the thread as solved it would be great. - if it was solved that is ;)  

Please Sign in or register to post replies

Write your reply to:

Draft