Can I use the replacefunction within a Javascript object or use a variable? -


i'm using google dynamic remarketing , have set price product. i'm getting price variable shop template, outputs comma, need replace dot

30,00 => 30.00

i did so:

var price = "[{$sfrom}] [{oxprice price=$oprice currency=$currency}]"; // price shop template price = price.replace(/,/g, '.'); 

then within script google have set variables within object

<script type="text/javascript">    var google_tag_params = {                     ecomm_prodid: '[{$odetailsproduct->oxarticles__oxartnum->value}]',                     ecomm_pagetype: 'product',                     ecomm_totalvalue: [{$sfrom}][{oxprice price=$oprice}],                     }; </script> 

can use replacefunction within ecomm_totalvalue: or use variable? tried ecomm_totalvalue: price,

but doesn't work

try this:

<script type="text/javascript">    var google_tag_params = {                     ecomm_prodid: '[{$odetailsproduct->oxarticles__oxartnum->value}]',                     ecomm_pagetype: 'product',                     ecomm_totalvalue: ('[{$sfrom}] [{oxprice price=$oprice currency=$currency}]').replace(/,/g, '.'),                     }; </script> 

Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -