Custom wysiwyg text blocks aren’t parsed for variables like {{media }} in magento 1.4

1
77
views
Advertisement

So far one big cause of the problem is that the configuration for the Wysiwyg on custom fields is different than that on CMS/Product Description fields. In particular the Varien Widget menu options are not included.

If these are missing then the bug is exposed, in js/mage/adminhtml/wysiwyg/tiny_mce/setup.js the beforeSetContent and saveContent methods incorrectly assume that widgets have to be configured before it will process directives.

beforeSetContent: function(o) {
o.content = this.encodeDirectives(o.content); //add
if(this.config.add_widgets) {
o.content = this.encodeWidgets(o.content);
//o.content = this.encodeDirectives(o.content); // removed
}
},

saveContent: function(o) {
o.content = this.decodeDirectives(o.content);//add
if(this.config.add_widgets) {
o.content = this.decodeWidgets(o.content);
//o.content = this.decodeDirectives(o.content); // removed
}
},

Still to do
1) you can still stuff things up if you show the editor, then press submit when its still showing – even though the saveContent method gets called it no longer functions correctly, so I suspect the wrong object is being passed to it in this sequence…this is where I’m currently stuck, any suggestions most welcome!
2) custom wysiwyg text blocks currently aren’t parsed for variables like {{media }} or {{skin }} so it needs to be generically extended to cope with that, or filtered in the .phtml file that renders it.
The filter for a custom attribute is of the form:


$_cmsHelper = Mage::helper('cms');
$_process = $_cmsHelper->getBlockTemplateProcessor();
echo $_process->filter($_product->getMyCustomAttribute()); //pass the variable which is use to display content of wysiwyg editor

Thanks,
Mayank Zalavadia 🙂

Previous articleMagento : change admin URL …
Next articleGet Store Email address
I am Magento Certified Developer Plus and I enjoy building new code as much as I loves nature.
SHARE