gr4devel Posted September 10, 2013 Share Posted September 10, 2013 Hi community ! I'm trying to implement a module in which BO there are a couple of text area that need to be translatable and editable with the TinyMCE editor. I've successfully implemented the editor by placing the following snippet of code <script type="text/javascript"> var iso = \''.(file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$this->context->language->iso_code.'.js') ? $this->context->language->iso_code : 'en').'\' ; var pathCSS = \''._THEME_CSS_DIR_.'\' ; var ad = \''.dirname($_SERVER['PHP_SELF']).'\' ; </script> <script type="text/javascript" src="'.__PS_BASE_URI__.'js/tiny_mce/tiny_mce.js"></script> <script type="text/javascript" src="'.__PS_BASE_URI__.'js/tinymce.inc.js"></script> <script language="javascript" type="text/javascript"> id_language = Number('.$this->context->language->id.'); tinySetup(); </script> and by marking the text areas like <textarea class="rte" name="description" rows="10" cols="45"></textarea> However now I'm stuck at the point of the translatable feature. Can anyone help me please Link to comment Share on other sites More sharing options...
vekia Posted September 10, 2013 Share Posted September 10, 2013 you've got object definition (to handle adding, saving and editing field values in database?) Link to comment Share on other sites More sharing options...
gr4devel Posted September 10, 2013 Author Share Posted September 10, 2013 I don't believe it! Too fast!!! XD Thank you very much for your response but actually I don't have any object definition yet and I was think to handle the saving of the persistent data without any object. Actually I only need to save two fields (html text) for each id_product_attibute entry in the default PS db. So at the end what I need is to simply extend a the default ps_product_attribute table. P.S: thanks again you're really amazing, always willingly to help! and you succeed in that! Link to comment Share on other sites More sharing options...
vekia Posted September 10, 2013 Share Posted September 10, 2013 okay, it's clear... but it's complicated so, what you want is... add additional multi-language fields to product attributes? Link to comment Share on other sites More sharing options...
gr4devel Posted September 10, 2013 Author Share Posted September 10, 2013 I know but that's actually what I'm trying to accomplish. But I was thinking to handle these two fields separately in a new table. Many lines of this table would correspond to an entry in the ps_product_attribute table in particular a line for each different language of the over mentioned html fields. BTW what I'm trying to do is to add custom description (long and short) to products combinations. Link to comment Share on other sites More sharing options...
vekia Posted September 10, 2013 Share Posted September 10, 2013 why not to edit Combination class and admin template file? it will be much easier! you will not have to define new objects etc Link to comment Share on other sites More sharing options...
vekia Posted September 10, 2013 Share Posted September 10, 2013 i checked sources: it will not be as easy as it seems Link to comment Share on other sites More sharing options...
gr4devel Posted September 10, 2013 Author Share Posted September 10, 2013 Yep you're right . Beside that I always prefer to stay away from overriding the core. If I made a module I can better handle the PS upgrades as it is independent (mostly) from the core. However I realized that I can handle the translations simply with other GUI elements rather that trying to rely on the "magic flags" XD. P.S: I leave the thread unsolved so that if anyone has some suggestions can contribute to the topic. P.P.S: thank you again for your support!!! Link to comment Share on other sites More sharing options...
jgullstr Posted September 10, 2013 Share Posted September 10, 2013 This shouldn't be too hard to accomplish using hookDisplayAttributeForm. I'll check it out and get back. Link to comment Share on other sites More sharing options...
gr4devel Posted September 10, 2013 Author Share Posted September 10, 2013 (edited) Oh man you're right there's that hook!!! But actually the core system of my module will stay the same. The only difference will be that the module BO will be integrated directly in the product attribute page. Or maybe are you thinking using some core functionality of the AdminProductController? Edited September 10, 2013 by gr4devel (see edit history) Link to comment Share on other sites More sharing options...
jgullstr Posted September 10, 2013 Share Posted September 10, 2013 Ok, I looked around a bit. I would say the easiest way would be to alter the attribute_lang table and override the attribute class. Link to comment Share on other sites More sharing options...
gr4devel Posted September 10, 2013 Author Share Posted September 10, 2013 Mmm but wait buddy... I don't need to add some more information to an attribute, I need to add something to a combination. I don't think that override the attribute class is the right thing to do btw thank you very much for your support, I really appreciate it and it helped me to get a good point of view of my problem. Link to comment Share on other sites More sharing options...
jgullstr Posted September 10, 2013 Share Posted September 10, 2013 Oh sorry, then it's a more tedious task Link to comment Share on other sites More sharing options...
gr4devel Posted September 11, 2013 Author Share Posted September 11, 2013 No sorry buddy you have helped me out on this!!! I really appreciate your support like the one given to me by Vekia ! I'm currently trying to develop the module as described in my previous posts. When done (if I can!!!) I'll proceed to close the thread Thanks again!!! Link to comment Share on other sites More sharing options...
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