Copied to clipboard

Flag this post as spam?

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


  • Matt Taylor 873 posts 2086 karma points
    Jan 09, 2012 @ 18:05
    Matt Taylor
    0

    TeaCommerce.Library.GetPaymentForm - Error - "Sequence contains more than one matching element"

    I'm using Tea Commerce1.4.2.0 BETA 4 and getting an error when calling TeaCommerce.Library.GetPaymentForm.

    Sequence contains more than one matching element

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.InvalidOperationException: Sequence contains more than one matching element

    Source Error:

    Line 149:        public static string GetPaymentForm()
    Line 150:        {
    Line 151:            return TeaCommerce.Library.GetPaymentForm("<input id=\"MattButton1\" type=\"button\" value=\"Pay\" />");
    Line 152:        }
    Line 153:

    Source File: D:\Websites\stahldatsx-umbraco\idseefeld.steel\idseefeld.steel\EcommerceHelper.cs    Line: 151

    Stack Trace:

    [InvalidOperationException: Sequence contains more than one matching element]
       System.Linq.Enumerable.SingleOrDefault(IEnumerable`1 source, Func`2 predicate) +4472564
       TeaCommerce.PaymentProviders.PayPal.GenerateForm(Order order, String teaCommerceContinueUrl, String teaCommerceCancelUrl, String teaCommerceCallBackUrl, Dictionary`2 settings) +2444
       TeaCommerce.Base.GeneratePaymentForm(String submitInput) +1359
       TeaCommerce.Library.GetPaymentForm(String submitInput) +69
       idseefeld.steel.EcommerceHelper.GetPaymentForm() in D:\Websites\stahldatsx-umbraco\idseefeld.steel\idseefeld.steel\EcommerceHelper.cs:151
       ASP.usercontrols_idseefeld_ecommercepay_ascx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) +38
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +131
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +246
       umbraco.presentation.templateControls.Macro.Render(HtmlTextWriter writer) +291
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +246
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +246
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +246
       ASP.masterpages_idsstahldatenmaster_master.__Render__control2(HtmlTextWriter __w, Control parameterContainer) +1413
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +131
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +246
       umbraco.presentation.masterpages._default.Render(HtmlTextWriter writer) +61
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +246
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +246
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +246
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +246
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +246
       System.Web.UI.Page.Render(HtmlTextWriter writer) +40
       umbraco.UmbracoDefault.Render(HtmlTextWriter output) +82
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5290
    
    It would seem there's a line of linq logic in TeaCommerce.PaymentProviders.PayPal.GenerateForm that is returning more than one item when only one is expected.
    I've had a look in the back end to see if I have configured anything wrong but it seems OK.
    Further more, the same call to GetPaymentForm works fine if the payment method is Account.
    Regards,
    Matt
  • Anders Burla 2560 posts 8256 karma points
    Jan 10, 2012 @ 09:17
    Anders Burla
    0

    Hi Matt

    Just looked at the code for the PayPal provider - and it may look like we try and fetch some info about the orderline properties for the "productNumber" and "productName" properties. Can you verify that maybe your orderline have two of the same orderline properties for one of the keys?

    Kind regards
    Anders

  • Matt Taylor 873 posts 2086 karma points
    Jan 10, 2012 @ 10:40
    Matt Taylor
    0

    Hi Anders,

    My Tea Commerce 'General settings' are pretty much out of the box

    and so is my Product document type

    I have two sites, German & English and it's all set up pretty much like the multilanguage starter kit although that was not actually installed.

    The English site product node looks like this

    and it links to the Master product which looks like this

    Looking in the database, the TeaCommerce_OrderLineProperty table contains the following records for the orderline (ID 89) in question

    So yes, I do have two orderline properties for one of the keys, one for each language (2 = German, 3 = English UK).
    The language for my PayPal setting (shown above) is US. Could that be the problem?

    Regards,

    Matt

  • Anders Burla 2560 posts 8256 karma points
    Jan 11, 2012 @ 10:21
    Anders Burla
    0

    Hi Matt

    Looks like you found a bug - I have fixed it in the new beta 5 you can download at http://our.umbraco.org/projects/website-utilities/tea-commerce

    Give it a try and tell me if it works :)

    Kind regards
    Anders

  • Matt Taylor 873 posts 2086 karma points
    Jan 11, 2012 @ 10:36
    Matt Taylor
    0

    That's me, beta tester extraordinaire. ;-)

    I'll try it shortly and let you know.

    Thanks.

  • Matt Taylor 873 posts 2086 karma points
    Jan 11, 2012 @ 10:42
    Matt Taylor
    0

    Works great, good work.
    Just in time too as I'm doing a small demo of it this morning.

Please Sign in or register to post replies

Write your reply to:

Draft