Copied to clipboard

Flag this post as spam?

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


  • Rasmus Fjord 675 posts 1566 karma points c-trib
    Apr 04, 2014 @ 11:08
    Rasmus Fjord
    0

    Search all orders for matching customer email

    Hey there

    I wanna make a lookup on all orders and check for the customers email exists amongs them and then return their old address infomation.

    But i cannot seem to figure out how to pull all orders as i did in TC1.

     

    This is s a TC 2 project

  • Anders Burla 2560 posts 8256 karma points
    Apr 04, 2014 @ 11:13
    Anders Burla
    100

    Hi Rasmus

    How about this method? :)
    http://documentation.teacommerce.net/razor-api/order/getallfinalizedordersasxml/

    Just use xpath to fetch data.

    Kind regards
    Anders

  • Rasmus Fjord 675 posts 1566 karma points c-trib
    Apr 04, 2014 @ 11:14
    Rasmus Fjord
    0

    Yo :)

    Well its a start, dont you have something nice and snazzy that throws me an List<Order> ?

  • Anders Burla 2560 posts 8256 karma points
    Apr 04, 2014 @ 11:16
    Anders Burla
    0

    How about just make a simple sql statement to search and return ids and then load those orders using http://documentation.teacommerce.net/razor-api/order/getorders/

    Kind regards
    Anders

  • Rasmus Fjord 675 posts 1566 karma points c-trib
    Apr 04, 2014 @ 11:21
    Rasmus Fjord
    0

    I will stick with the XML solution then :) 

    Pure SQL is no 2009 :)

  • Jonas Eriksson 930 posts 1825 karma points
    Mar 10, 2015 @ 19:51
    Jonas Eriksson
    0

    Is GetAllOrdersAsXml removed ?

    Currenly I get the orders directly from the db. Works for now - but it would be good to have some supported api call for it :)

    @using Umbraco.Core;
    
    
    @{
    
        var db = ApplicationContext.Current.DatabaseContext.Database;
        var getAllFinalizedOrders = db.Fetch<TeaCommerce_Order>("Select * FROM TeaCommerce_Order WHERE DateFinalized IS NOT NULL");
    <table> @foreach (var order in getAllFinalizedOrders) { <tr> <td>@order.Id</td> <td>@order.OrderNumber</td> <td>@order.CartNumber</td> <td>@order.CustomerId</td> <td>@order.TransactionId</td> <td>@order.AmountAuthorized.Value</td> </tr> } </table> } @functions{ public class TeaCommerce_Order
    { public Guid Id { get; set; } public int StoreId { get; set; } public string OrderNumber { get; set; } public string CartNumber { get; set; } public string CustomerId { get; set; } public string TransactionId { get; set; } public decimal? AmountAuthorized { get; set; } } }

     

     

  • Anders Burla 2560 posts 8256 karma points
    Mar 11, 2015 @ 08:34
    Anders Burla
    0

    @Jonas - the method is gone. Now you need to make custom SQL to fetch order ids and then use the http://documentation.teacommerce.net/razor-api/order/getorders/ to get the orders using the API.

    Kind regards
    Anders

Please Sign in or register to post replies

Write your reply to:

Draft