Copied to clipboard

Flag this post as spam?

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


  • James Drever 118 posts 149 karma points
    May 17, 2011 @ 11:36
    James Drever
    0

    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.

     

  • Rune Grønkjær 1372 posts 3103 karma points
    May 17, 2011 @ 11:45
    Rune Grønkjær
    0

    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:

    /// <summary>
        /// Indication if current customer has an order
        /// </summary>
        public static bool HasOrder() 
    
        /// <summary>
        /// Generates a Json string representing the current order
        /// </summary>
        public static Order GetOrder() 
    
        /// <summary>
        /// Indication if current customer has an finalized order
        /// </summary>
        public static bool HasFinalizedOrder()
    
        /// <summary>
        /// Get the users current finalized order
        /// </summary>
        public static Order GetFinalizedOrder()
    
        /// <summary>
        /// Get the users current order
        /// </summary>
        public static Order GetOrder( long orderId )
    
        /// <summary>
        /// Gets all available shipping methods filtered by the current country
        /// </summary>
        public static IEnumerable<ShippingMethod> GetShippingMethods() 
        /// <summary>
        /// Gets all available payment methods filtered by the current country
        /// </summary>
        public static IEnumerable<PaymentMethod> GetPaymentMethods() 
    
        /// <summary>
        /// Gets all available countries
        /// </summary>
        public static IEnumerable<Country> GetCountries() 
    
        /// <summary>
        /// Gets the current country
        /// </summary>
        public static Country GetCurrentCountry() 
    
        /// <summary>
        /// Gets all available currencies
        /// </summary>
        public static IEnumerable<Currency> GetCurrencies()
    
        /// <summary>
        /// Gets the current currency
        /// </summary>
        public static Currency 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>
        public static string 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>
        public static string 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>
        public static string 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>
        public static string 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>
        public static decimal? 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 :)

    Hope that answers your question.

    /Rune

  • James Drever 118 posts 149 karma points
    May 17, 2011 @ 12:11
    James Drever
    0

    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.

  • Rune Grønkjær 1372 posts 3103 karma points
    May 17, 2011 @ 12:17
    Rune Grønkjær
    0

    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

Please Sign in or register to post replies

Write your reply to:

Draft