radykal | Support Center Chooser

For which product do you need support?

Fancy Product Designer Multistep Product Configurator Another

Start a new topic

method getTranslation - check for undefined

When upgrading to a new version of the jquery FPD, I ran into an error. The error was caused by a call to toUpperCase to an undefined value.


After a bit of debugging I found out, that in the latest version of the desiger a check for undefined was deleted from the method getTranslation.


old and ok:

 

this.getTranslation = function (section, label) {
        if (instance.langJson) {
            section = instance.langJson[section];
            if (section) {
                if (typeof section[label] !== 'undefined') {
                    return section[label];
                }
            }
        }
        return '';
    };

 now without check

 

this.getTranslation = function(section, label) {
		if(instance.langJson) {
			section = instance.langJson[section];
			if(section) {
				return section[label];
			}
		}
		return '';
	};

 

As my custom json file did not contain the key "design_search_in", the new method retured undefined on that key and caused the error.

Login or Signup to post a comment