I have a small js modification stored in the core code root/js/tools.js path. I was wondering if an override could be applied to js files similar to the class and controller files so that I don't need to update the file each time the shop is updated.
Override JS questions:
1. Can JS files use an overrride?
2. If so, can just the changed function be added in the override, or does an entire file required to duplicate and override the original?
3. Where should the override file be saved? (e.g. in root/override/js/tools.js or root/themes/mytheme/js/tools.js
The tools.js modification starts on line 375 and is comments out as follows:
function checkCustomizations() {
var pattern = new RegExp(' ?filled ?');
if (typeof customizationFields != 'undefined') {
for (var i = 0; i < customizationFields.length; i++) {
/* If the field is required and empty then we abort */
/**** line below replaced for removing save
if (parseInt(customizationFields[i][1]) == 1 && ($('#' + customizationFields[i][0]).html() == '' || $('#' + customizationFields[i][0]).text() != $('#' + customizationFields[i][0]).val()) && !pattern.test($('#' + customizationFields[i][0]).attr('class'))) {
****/
if (parseInt(customizationFields[i][1]) == 1 && ($('#' + customizationFields[i][0]).val() == '')) {
return false;
}
}
}
return true;
}
Question
Rhapsody
I have a small js modification stored in the core code root/js/tools.js path. I was wondering if an override could be applied to js files similar to the class and controller files so that I don't need to update the file each time the shop is updated.
Override JS questions:
1. Can JS files use an overrride?
2. If so, can just the changed function be added in the override, or does an entire file required to duplicate and override the original?
3. Where should the override file be saved? (e.g. in root/override/js/tools.js or root/themes/mytheme/js/tools.js
The tools.js modification starts on line 375 and is comments out as follows:
function checkCustomizations() { var pattern = new RegExp(' ?filled ?'); if (typeof customizationFields != 'undefined') { for (var i = 0; i < customizationFields.length; i++) { /* If the field is required and empty then we abort */ /**** line below replaced for removing save if (parseInt(customizationFields[i][1]) == 1 && ($('#' + customizationFields[i][0]).html() == '' || $('#' + customizationFields[i][0]).text() != $('#' + customizationFields[i][0]).val()) && !pattern.test($('#' + customizationFields[i][0]).attr('class'))) { ****/ if (parseInt(customizationFields[i][1]) == 1 && ($('#' + customizationFields[i][0]).val() == '')) { return false; } } } return true; }
3 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now