Jump to content

Add translatable text area in module BO


gr4devel

Recommended Posts

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

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

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

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!!! :D

Link to comment
Share on other sites

Oh man you're right there's that hook!!! :D

 

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 by gr4devel (see edit history)
Link to comment
Share on other sites

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  :huh:

 

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

No sorry buddy you have helped me out on this!!! :D

 

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!!! :D

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...