Copied to clipboard

Flag this post as spam?

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


  • phil 58 posts 78 karma points
    Apr 11, 2012 @ 14:47
    phil
    0

    show Members Orders

    I have setup my site to allow members to login to my site using the members functionality in umbraco and the .net member wizard. I am now trying to show all the finialised orders for the logged in member i have the following code but getting an error "CS0103: The name 'GetFinalizedOrdersXmlForMember' does not exist in the current context" am i calling the wrong method or have i missed something / wrong syntax

    @using TeaCommerce.Razor
    @using TeaCommerce.Data
    @using umbraco.cms.businesslogic.member
    @{
      var member Member.GetCurrentMember();
      foreach (Order order in GetFinalizedOrdersXmlForMember(@member.Id))
      {
       
      }
    }
  • Anders Burla 2560 posts 8256 karma points
    Apr 12, 2012 @ 16:48
    Anders Burla
    0

    Hi Phil

    You are missing TeaCommerce - as the GetFinalizedOrdersXmlForMember is in the Library class. So it should be:

    @using TeaCommerce

    XPathNodeIterator itr = Library.GetFinalizedOrdersXmlForMember(memberId) - this gives you a xpath node iterator and not an order object. So you will have to use xpath C# code to get the data.

    You can also use the TeaCommerce.Data.Order.OrdersXmlCache.Root.XPathSelectElements( "./order [@memberId=" + memberId + "]" ) to get it as XElements and use that.

    Hope this helps

    Kind regards
    Anders

  • phil 58 posts 78 karma points
    Apr 13, 2012 @ 17:05
    phil
    0

    Thanks I am using TeaCommerce.Data.Order.OrdersXmlCache.Root.XPathSelectElements("./order [@memberId=" + member.Id + "]") to get the order details which i am axtracting fine but I want to get the order Id so I can then use TeaCommerce.Data.Order.GetOrder(orderId) when a user selects an order for more details I am using string id = order.Attribute("id").Value; to extract the id which gives me an int with a 3 digit number id but the TeaCommerce.Data.Order.GetOrder(orderId) is asking for a type long how can I get this

  • Anders Burla 2560 posts 8256 karma points
    Apr 13, 2012 @ 19:07
    Anders Burla
    0

    When you have the id as a string you can just use the long.Parse method to parse it to a long value.

    Kind regards
    Anders 

  • phil 58 posts 78 karma points
    Apr 16, 2012 @ 11:03
    phil
    0

    Is the 3 digit number the correct Id to use to get the order details I keep getting Object reference not set to an instance of an object with the following code and all I can think of is that its not finding the order or have I missed something

    var orders = TeaCommerce.Data.Order.OrdersXmlCache.Root.XPathSelectElements("./order [@memberId=" + member.Id + "]");
    
    foreach (var order in orders)
    {
        string id = order.Attribute("id").Value;
        string name = order.Attribute("name").Value;
        HtmlAnchor htmlanchor = new HtmlAnchor();
        htmlanchor.HRef = "~/member-area?order=" + id;
        htmlanchor.InnerText = name;
        this.Controls.Add(htmlanchor);
    }
    string selectedOrder = Request.QueryString["order"];
    if (selectedOrder != "")
    {
        var sOrder = TeaCommerce.Data.Order.GetOrder(long.Parse(selectedOrder));
        selectedOrderPanel.Visible = true;
        selectedOrderTitle.Text = sOrder.Name;
        totalPrice.Text = sOrder.TotalPriceFormatted;
    }
  • Anders Burla 2560 posts 8256 karma points
    Apr 16, 2012 @ 11:16
    Anders Burla
    0

    Hi Phil

    Try and make a test - find a order id in the DB and try call TeaCommerce.Data.Order.GetOrder( yourDBOrderId ) and see if that works.If it does - then something else must be wrong.

    Kind regards
    Anders

  • phil 58 posts 78 karma points
    Apr 16, 2012 @ 17:21
    phil
    0

    Thanks realised the list of orders I has included all the orders I have made under that user even tho some had been deleted from the database as I had reached my 20 limit so was looking for an order that didn't exist in the database I have it all working now using but it lists thm out from oldest to newest is there a way I can list them out newest to oldest

    TeaCommerce.Data.Order.OrdersXmlCache.Root.XPathSelectElements("./order [@memberId=" +member.Id +]");
    foreach(var order in orders)
    {
      ...
    }
  • Anders Burla 2560 posts 8256 karma points
    Apr 17, 2012 @ 01:42
  • rich hamilton 117 posts 136 karma points
    Apr 17, 2012 @ 14:56
    rich hamilton
    0

    Anyone got an XSLT example of this?

    Many thanks

  • Anders Burla 2560 posts 8256 karma points
    Apr 17, 2012 @ 16:29
    Anders Burla
    0

    <xsl:variable name="test" select="teacommerce:GetFinalizedOrdersXmlForMember(umbraco.library:GetCurrentMember()/@id)/order" />

    That should give your all orders for the logged in member

    Kind regards
    Anders

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies