Then trying to iterate over the orders and cast each order as a TeaCommerce.Data.Order but receiving the following error
@foreach (Order order in finalizedOrders) {
Unable to cast object of type 'umbraco.MacroEngines.DynamicXml' to type 'TeaCommerce.Data.Order
I can cast the finalizedOrders as a var and each item as a var (as indicated below) but wondering if it is possible to cast as a TeaCommerce.Data.Order instead.
The finalized orders you get from the .NET API is pure XML as to performance - so thats why you cant cast it to an Order object. Im sorry to say that this part of the API cant return Order objects. Its a thing that will definitely work for the Tea Commerce version for Umbraco 5 as its more Razor based - but at the time we started developing Tea Commerce - Razor wasent that big of a thing in umbraco. Can you still implement your desired functionality?
Perfect - thanks for the update! And yes we hope the umbraco 5 version will be even better than the current version - but takes times to write such a big program like Tea Commerce - but we love to do it :)
Unable to cast object of type 'umbraco.MacroEngines.DynamicXml' to type 'TeaCommerce.Data.Order
Pulling order data back as follows
umbraco.MacroEngines.DynamicXml finalizedOrders = @Library.ToDynamicXml(TeaCommerce.Library.GetFinalizedOrdersXml());
Then trying to iterate over the orders and cast each order as a TeaCommerce.Data.Order but receiving the following error
@foreach (Order order in finalizedOrders) {
Unable to cast object of type 'umbraco.MacroEngines.DynamicXml' to type 'TeaCommerce.Data.Order
I can cast the finalizedOrders as a var and each item as a var (as indicated below) but wondering if it is possible to cast as a TeaCommerce.Data.Order instead.
umbraco.MacroEngines.DynamicXml finalizedOrders = @Library.ToDynamicXml(TeaCommerce.Library.GetFinalizedOrdersXml());
@foreach (var order in finalizedOrders) {
Any ideas?
Hi Sean
The finalized orders you get from the .NET API is pure XML as to performance - so thats why you cant cast it to an Order object. Im sorry to say that this part of the API cant return Order objects. Its a thing that will definitely work for the Tea Commerce version for Umbraco 5 as its more Razor based - but at the time we started developing Tea Commerce - Razor wasent that big of a thing in umbraco. Can you still implement your desired functionality?
Kind regards
Anders
Hi Anders
I can still implement the desired functionality without casting it as an Order. Being able to cast it as an Order enabled the intellisense.
Looking forward to the Umbraco 5 version.
Thanks
Sean
*** Update ***
Have amended the code as shown below, which enables the intellisense
var finalizedOrders = @Library.ToDynamicXml(TeaCommerce.Library.GetFinalizedOrdersXml());
<ul>
@foreach (var o in finalizedOrders) {
Order order = Order.GetOrder(long.Parse(o.id));
@order.Email
}
</ul>
Perfect - thanks for the update! And yes we hope the umbraco 5 version will be even better than the current version - but takes times to write such a big program like Tea Commerce - but we love to do it :)
is working on a reply...