Fixed bug with unsetting parent category
Hyphens cannot be used in jQuery UI autocomplete, which results in the parent_id not being changed to 0 when you select 'None' as the parent category in the category form.
Not enough details, unable to reproduce your error.
"You have half-baked knowledge of JS."
First of all, you haven't provided enough details.
Second, as you mentioned, "Hyphens cannot be used". You need to sanitize your knowledge, Hyphens cannot be used in variable names in JS. However variable values can have any characters (provided: they are properly passed and escapes)
Third, the Changes you made, had a hyphen in value. The hyphen was not creating any trouble.
Changes you made are not adding any significant value, so accepting/rejecting doesn't; matter much.
However, existing $_['text_none'] = ' --- None --- '; looks much better
Don't get demotivated by my words. I just posted to correct your knowledge
its not Query UI autocomplete
time waster!
Your social skills leave something to be desired lol, very bizzare replies. I do not have a half-baked knowledge of JS, I am correct about this. The problem also exists on demo.opencart.com.
To reproduce try to set a category with a parent to have the parent "--- None ---", save it, and the parent will not have changed. Try it with my code and it will work - I am correct. It's a pretty obvious bug - I didn't think I'd really need to elaborate any more than I did.
Daniel, it is using jQuery UI autocomplete, see line 225 of upload/admin/view/template/catalog/category_form.twig
And an apology please?
It's not jQuery UI.
I wrote the code my self. Check common.js it's at the bottom.
Okay fair enough but the problem still exists, and my fix rectifies it. I presumed it was jquery UI because it has the same problem and jUI is included with OC
only u have this issue.
Actually, I can reproduce the same issue on OC 4.0.1.1. Will have to test it with the latest master branch, too, to see whether this issue still exists.
Just tested it with today's master branch, this issue still exists!
Just tested it with today's master branch, this issue still exists!
Did I say it was fixed! I spotted it. Will come up with a fix that keeps the current way none is
To reproduce try to set a category with a parent to have the parent "--- None ---", save it, and the parent will not have changed. Try it with my code and it will work - I am correct. It's a pretty obvious bug - I didn't think I'd really need to elaborate any more than I did.
it is using jQuery UI autocomplete, see line 225 of upload/admin/view/template/catalog/category_form.twig
@adamlanningmolyneux Can you provide detailed steps to follow or screen recording? I am unable to reproduce the same error in OC 4.0.1.1 .
I created a category with a parent "---None---" and saved it. It worked. Again, I created another Category with the parent as first created category and saved it. It worked Tried to modify the same too, and it saved without any issue.
You are very much confident about your solution, but you are not giving enough details to reproduce the error. If you don't explain your issue properly, how do you expect us to know what you want? We are not God to dig into your brain and know - what you want. You are just forcing us to use your code without properly explaining what's wrong with the existing code.
@nexadomain : Try it with the 'Mice and Trackballs' category which has the 'Components' as the parent. Change the parent to '---none---' and save it. It will stay with the 'Components' as the parent, won't remove it.
Confirmed I messed around with this issue for a long time.
Its not a hyphen, which is creating the issue. It spaces in both ends, which is creating trouble.
$_['text_none'] = ' --- None --- '; // Not Working
$_['text_none'] = '--- None ---'; // Working
I even tried putting spaces around other array elements, it is not working
// admin/view/template/catalog/category_form.twig Line #237
return {
label: ' - ' + item['name'] + ' - ', // Added Extra Space and Hyphen on both end
value: item['category_id']
}
@adamlanningmolyneux Issues lie because of spaces around the text not because of the hyphen.
Another workaround - Trimming all characters while parsing language files
Hey @danielkerr Can we trim all variables in easy way, while parsing language files?
Removing spaces is a better solution, I presumed it was using jUI's autocomplete function due to the similar arguments
It might be better to just have a button that removes the parent next to the select, rather than expecting the user to know to type out 'None'.
You really should be more polite Daniel, people are helping your business for free and you seem to take it as a personal affront and become rude at the tiniest percieved indiscretion. I would guess hearing this is going to make you angry but maybe you should take a step back and consider whether my intention was to waste your time, or whether it was to improve your product.
uj guys dont know what ur talking aboout. stop giving suggestions. ill fix it afrter i fix other stuff.
Says the guy with a tenuous grasp on the English language. People literally helping you for free and that makes you angry, you need a holiday or something.
Spotted more errors I could help with but due to your bizarre outbursts my contributions end with this comment.
im not removing spaces because the amateur thinks removing spaces is a fix.
the key is a string it needs to act like one