I am using Knockout as a View Model to fill values of my view template, It is working fine for all except one function getConvertedTotal is returning NaN.
define([
'ko',
'uiComponent',
'mage/url',
'mage/storage',
'Magento_Checkout/js/model/quote',
],function (ko, Component, urlBuilder,storage,quote)
{
'use strict';
return Component.extend({
defaults: {template: 'Ishaq_CheckoutTotal/custom-block-order-summary',},
initialize: function(config) {
this._super();
var currencyRate = config.currencyRate;
var currencySymbol = config.currencySymbol;
},
getSubtotal: function() {
var totals = quote.totals();
return (totals ? totals : quote)['subtotal'];
},
getGrandTotal: function() {
var totals = quote.totals();
return (totals ? totals : quote)['grand_total'] ;
},
getConvertedTotal: function() {
var totals = quote.totals();
var temp = (totals ? totals : quote)['grand_total'] ;
return (temp*this.currencyRate);
}
});
});