Important
- For the pre-sale question, please feel free to contact us via live chat on Landofcoder.com ( From Monday to Friday 8:30 am - 5:30 pm GMT+7 ) or leave an offline message, we will give you a response asap.
- For technical questions, please submit a ticket below (recommended option) or send us an email via [email protected]. Our dev will support you within 24 hours since the submitted time (DO NOT support free extensions)
While editing a menu there is a js error appearing in devtools:
Uncaught TypeError: Failed to set an indexed property on 'HTMLCollection': Index property setter is not supported
I forgot to note that I am on Magento EE 2.2.0.
If I comment out line 33 in editor.js, I no longer get any errors and it appears that all of the different fields now fill out correctly. However, I assume this line was meant to do something useful so I don't want to just run with this as a "solution".
Hopefully this helps you in your debug process
Hello Steve,
Have a nice day!
Did you comment the line code?
item['children'][x] = optimizeJson(current_item);
Please try to download my attach file, then update the file into your site again. Let me know the result.
Hello,
That is the line I commented out. When I tried your new version of editor.js I received this error:
Uncaught TypeError: Cannot assign to read only property 'children' of object '#<HTMLDivElement>'
at optimizeJson (editor.js:38)
at updateListData (editor.js:61)
at editor.js:327
The error is pretty clear, 'children' is not a writable property. I got around this by assigning a _children variable to item['children']. I had to use Object.defineProperty() to make the item['children'] writable and then set item['children'] to _children. Here is my updated optimizeJson function:
function optimizeJson(item) {
//console.log("\n\n item:\n"+window.JSON.stringify(item));
if (typeof(item['children']) != "undefined" && item['children']) {
var _children;
if(typeof(item['children']) === 'object') {
_children = ObjectToArray(item['children']);
}
else {
_children = item['children'];
}
for (var x = 0; x < item['children'].length; x++) {
var current_item = item['children'][x];
if(typeof(current_item) != "undefined"){
_children[x] = optimizeJson(current_item);
}
}
Object.defineProperty(item, 'children', { writable: true });
item['children'] = _children;
}
delete item['bind'];
return item;
}
This runs as expected without any errors. One thing to mention is that (typeof(item['children']) === 'object') evaluates to true every time it runs within my current environment/configuration. I don't know if it would ever not be an object (I don't see how).
Are other users having this issue? This does not appear to be a Magento version compatibility issue, I expect that this code should break for everyone that has this module installed. I want to make sure that this is indeed a bug in the module and not an error on my end.
Here is editor.js with my changes applied
Hello Steve,
Have a nice day!
We resolved it and updated for the latest version in download page.
Or you can download the file editor.js and update for your site.
I am getting the same errors
I cannot save the menu and each time I make a new child item it drops it to the bottom
I am using 2.1.6 EE
Khaleel Mughal,
I have attached the official editor.js file that I received from landofcoder/venusthemes. They told me this file will be included in the next update but you can add it to your current installation if you would like. Drop it here:
app/code/Ves/Megamenu/view/adminhtml/web/js
I would rather have an official patch the @steves code (I have not tested his code) but I really appreciate his efforts !
Hi Stevek
Does that file work safely compared with your own changes? Some cool code JS you did!
Yes, I tested it and it is working without any problems. Thank you :)
Hello Khaleel Mughal,
Yes, that the fixed file which we updated for latest version of the module, it will fix the issue in backend design menu.
When is the new version going to be released?
Hello Mate,
It was released on yesterday. We updated on same version file which you purchased before. Decompress it on local you will get the module file for right magento 2 version of your site.