I'm problably missing something, but I'm searching for some documentation on using Razor with Tea Commerce. I'd much prefer to develop in Razor, but all the examples in the Starter Kit etc are XSLT. Can you point me in the right direction?
I have not had the time to write that documentation yet, allthough it's pretty simple. I'll just give you a quick rundown here.
We have created a class with a bunch of static methods: namespace: TeaCommerce.Razor ClassName: TeaCommerce
Methods:
///<summary>/// Indication if current customer has an order///</summary>publicstaticbool HasOrder()
///<summary>/// Generates a Json string representing the current order///</summary>publicstaticOrder GetOrder()
///<summary>/// Indication if current customer has an finalized order///</summary>publicstaticbool HasFinalizedOrder()
///<summary>/// Get the users current finalized order///</summary>publicstaticOrder GetFinalizedOrder()
///<summary>/// Get the users current order///</summary>publicstaticOrder GetOrder( long orderId )
///<summary>/// Gets all available shipping methods filtered by the current country///</summary>publicstaticIEnumerable<ShippingMethod> GetShippingMethods()
///<summary>/// Gets all available payment methods filtered by the current country///</summary>publicstaticIEnumerable<PaymentMethod> GetPaymentMethods()
///<summary>/// Gets all available countries///</summary>publicstaticIEnumerable<Country> GetCountries()
///<summary>/// Gets the current country///</summary>publicstaticCountry GetCurrentCountry()
///<summary>/// Gets all available currencies///</summary>publicstaticIEnumerable<Currency> GetCurrencies()
///<summary>/// Gets the current currency///</summary>publicstaticCurrency GetCurrentCurrency()
///<summary>/// Formats a price with the current currency's culturename///</summary>///<param name="price">The price as a decimal</param>///<returns>The formatted price as string</returns>publicstaticstring FormatPrice( decimal price )
///<summary>/// Formats a price with the chosen culturename///</summary>///<param name="price">The price as a decimal</param>///<param name="cultureName">A culture name</param>///<returns>The formatted price as string</returns>publicstaticstring FormatPriceWithSpecificCulture( decimal price, string cultureName )
///<summary>/// Formats a price with the current currency's culturename/// No currency symbol will be added///</summary>///<param name="price">The price as a decimal</param>///<returns>The formatted price as string</returns>publicstaticstring FormatPriceNoSymbol( decimal price )
///<summary>/// Formats a price with the chosen culturename/// No currency symbol will be added///</summary>///<param name="price">The price as a decimal</param>///<param name="cultureName">A culture name</param>///<returns>The formatted price as string</returns>publicstaticstring FormatPriceNoSymbolWithSpecificCulture( decimal price, string cultureName )
///<summary>/// Gets the stock of a specific product///</summary>///<param name="nodeId">Node id of the product</param>///<returns>Will return null if the product does not use stock</returns>publicstaticdecimal? GetStock( int nodeId )
Thats it, lots of documentation ;)
There's no invokeRazor method, like the invokeXSLT, yet. We are still working out how to do that. Any input will be appreciated :)
Thanks Rune, I've got to say that is a blisteringly fast response. OK, I'll digest that information. The thing I'm wondering - as a TeaCommerce novice - is precisely what I lose my not having invokeRazor at present. I can say its key to the implementation of the checkout process, but haven't got to the bottom of how it works.
invokeXSLT is used for the lazy programmer. The optimal thing to do is to update the UI with the return data you get from the server when using the javascript API. InvokeXSLT lets you fetch a lot of html very easily, and you only have to overwrite the existing html. When using razor you will have to update the UI with javascript.
Razor documentation for Tea Commerce
Hi guys,
I'm problably missing something, but I'm searching for some documentation on using Razor with Tea Commerce. I'd much prefer to develop in Razor, but all the examples in the Starter Kit etc are XSLT. Can you point me in the right direction?
Thanking you..
James.
Hi James,
I have not had the time to write that documentation yet, allthough it's pretty simple. I'll just give you a quick rundown here.
We have created a class with a bunch of static methods:
namespace: TeaCommerce.Razor
ClassName: TeaCommerce
Methods:
Thats it, lots of documentation ;)
There's no invokeRazor method, like the invokeXSLT, yet. We are still working out how to do that. Any input will be appreciated :)
Hope that answers your question.
/Rune
Thanks Rune, I've got to say that is a blisteringly fast response. OK, I'll digest that information. The thing I'm wondering - as a TeaCommerce novice - is precisely what I lose my not having invokeRazor at present. I can say its key to the implementation of the checkout process, but haven't got to the bottom of how it works.
invokeXSLT is used for the lazy programmer. The optimal thing to do is to update the UI with the return data you get from the server when using the javascript API. InvokeXSLT lets you fetch a lot of html very easily, and you only have to overwrite the existing html. When using razor you will have to update the UI with javascript.
/Rune
is working on a reply...