What is the template engine that is being used and...
# suitecommerce
m
What is the template engine that is being used and can we extend it to add helpers? What I want to do is have a specific list value be
.toFixed(2)
.
m
I tried following the instructions and it failed to load the helper. However I loaded Handlbars into the View and registered the helper that way. Is it that more recent versions don't work the same way? This is what worked for me.
Copy code
define("CAFB.EditOrder.CartDetails.View"
    , [
        "cafb_editorder_cart_details.tpl"

        , "CAFB.EditOrder.Main.SS2Model"

        , "Backbone"

        , "Handlebars"
    ]
    , function (
        cafb_editorder_cart_details_tpl

        , MainSS2Model

        , Backbone

        , Handlebars
    ) {
        "use strict";

        // @class CAFB.EditOrder.CartSummary.View @extends Backbone.View
        return Backbone.View.extend({

            template: cafb_editorder_cart_details_tpl

            , initialize: function (options) {
                Handlebars.registerHelper("currency", function (value) {
                    return parseFloat(value || "0").toFixed(2);
                });
            }
        });
    });
s
Whatever brings you joy
😎 1