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; }
}
}
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
Hi Rasmus
How about this method? :)
http://documentation.teacommerce.net/razor-api/order/getallfinalizedordersasxml/
Just use xpath to fetch data.
Kind regards
Anders
Yo :)
Well its a start, dont you have something nice and snazzy that throws me an List<Order> ?
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
I will stick with the XML solution then :)
Pure SQL is no 2009 :)
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 :)
@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
is working on a reply...