We have an issue where a certain tag wants us to pass them product names. This is fine because I'm already passing that as a data source array (t_product_name). The issue I've come across is that many of our product names have non-alphanumeric characters such as single quotes ('). Since code releases are a no-go until after the holiday season, I've been trying to come up with a way of manipulating this with JS. I've created a new JavaScript extension and added the function I'd like to use to "clean" up each product name. The thing is, I can't find any documentation in the Scope Vars field or Output field. Should the Scope Vars contain the data source variable name t_product_name?
Here is the JS I'm using (without the slashes):
//function cleanProductId(t_product_name) {
// var cleanProductName = decodeURIComponent(t_product_name);
// cleanHtml = cleanHtml.replace(/"/g, '').replace(/'/g, '').replace(/</g, '').replace(/>/g, '').replace(/&/g, '');
// cleanHtml = cleanHtml.replace(/[^a-zA-Z0-9]/g,'');
// return cleanProductName;
//}
... View more