CK Editor in Full Power (for almost all version of OpenCart)
Posted: Mon Oct 17, 2011 9:47 am
Hello guys,
For a while I've been missing some features in the CK Editor (the WYSIWYG editor used on OpenCart), such as Find & Replace, View Tags, etc... After a while trying to pretend those features (and other) won't matter, the lack of those capabilities that should be there by default got so annoying that I've decided to "fix" it once and for all.
As I don't like to change original files, my first attempt was to create a VQMod XML file for that, but for some reason it didn't work (neither generate any error)... I suppose VQMods cannot be used to fix/change/hack CSS and JS files, and so the only other solution was to edit the original file.
If someone know how to make VQMod XML files work with CSS and JS please let me know how.
Anyway, for the hard coded fix (hack), here is how you can do it:
Open your admin/view/javascript/ckeditor/config.js and find the line (probably line 26):
Replace it with the following code:
Do not change anything else. Leave the rest untouched (you are simply adding a new custom toolbar and making it as default with the command config.toolbar = 'Best';.
Save the file and enjoy now a Full Featured Editor.
Important Note: I've left the 'Styles' and 'Format' enabled because on my installation it worked fine. If it doesn't work for you simply change the line:
to:
I hope it helps other to be more productive on a daily basis.
This "hack" should be "compatible" with any OpenCart vesion that uses the CK Editor version 3.0 or newer (maybe it will work for older versions too, but I haven't tested it).
Please notice those changes will affect the CK Editor globally (Product, Catalog, Mail, etc)... Which, IMO, is a good thing!
Enjoy it!
Julio Marchi
jcmarchi@gmail.com
For a while I've been missing some features in the CK Editor (the WYSIWYG editor used on OpenCart), such as Find & Replace, View Tags, etc... After a while trying to pretend those features (and other) won't matter, the lack of those capabilities that should be there by default got so annoying that I've decided to "fix" it once and for all.

As I don't like to change original files, my first attempt was to create a VQMod XML file for that, but for some reason it didn't work (neither generate any error)... I suppose VQMods cannot be used to fix/change/hack CSS and JS files, and so the only other solution was to edit the original file.

If someone know how to make VQMod XML files work with CSS and JS please let me know how.

Anyway, for the hard coded fix (hack), here is how you can do it:
Open your admin/view/javascript/ckeditor/config.js and find the line (probably line 26):
Code: Select all
config.toolbar = 'Custom';
Code: Select all
config.toolbar = 'Best';
config.toolbar_Best = [
['Source','ShowBlocks','-','Maximize','Preview'],
['Save','-','NewPage','Templates'],
['Undo','Redo','-','Cut','Copy','Paste','PasteText','PasteFromWord','-','Print','SpellChecker','Scayt'],
['Find','Replace','-','SelectAll','RemoveFormat'],
'/',
['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
['Link','Unlink','Anchor'],
['Image','Flash','-','Table','HorizontalRule','PageBreak','-','SpecialChar','Smiley'],
'/',
['Styles','Format','Font','FontSize'],
['TextColor','BGColor']
];
Save the file and enjoy now a Full Featured Editor.

Important Note: I've left the 'Styles' and 'Format' enabled because on my installation it worked fine. If it doesn't work for you simply change the line:
Code: Select all
['Styles','Format','Font','FontSize'],
Code: Select all
['Font','FontSize'],
This "hack" should be "compatible" with any OpenCart vesion that uses the CK Editor version 3.0 or newer (maybe it will work for older versions too, but I haven't tested it).
Please notice those changes will affect the CK Editor globally (Product, Catalog, Mail, etc)... Which, IMO, is a good thing!

Enjoy it!
Julio Marchi
jcmarchi@gmail.com