Jump to content

Shop Information Comments Output in HTML


AllInJoe

Recommended Posts

Hey there,

i am looking for help with the shop information.

there is a field to set comments. Which ist actually perfect for our needs.

but the input textarea doesn’t support HTML. 
 

maybe someone can bring me to the right direction because i really don’t know for what I have to search to make a textarea giving HTML output.

 

thanks in advance and sorry for my english 

Edited by AllInJoe (see edit history)
Link to comment
Share on other sites

Hi thanks for reply,

--

Prestashop version ? 1.7.6.7

Page name ? Its still in localhost

BO or FO ? Actually the Input comes from the BO, i was trying to add a HTML code in the field but the FO output is like not rendering just giving text output without formating.

You cut it so you can't see what's going on and where it is. Sorry i made now the example with the PS Demo

 

Link: https://demo.prestashop.com/#/en/front

*attachments*

presta_demo_stores.png

presta_demo_stores_fo.png

Link to comment
Share on other sites

./controllers/admin/AdminStoresController.php

find:

array(
                    'type' => 'textarea',
                    'label' => $this->trans('Note', array(), 'Admin.Global'),
                    'name' => 'note',
                    'lang' => true,
                    'cols' => 42,
                    'rows' => 4,
                ),

replace to:

array(
                    'type' => 'textarea',
                    'label' => $this->trans('Note', array(), 'Admin.Global'),
                    'name' => 'note',
                    'lang' => true,
                    'cols' => 42,
                    'rows' => 4,
                    'class' => 'rte',
                    'autoload_rte' => true,
                ),

 

Link to comment
Share on other sites

Thank you for your help.

 

So the editor is showing in the BO. But if i add simple HTML code like line breaks or bold font etc. its not showing in the FO.

After saving the store information and going back to the editor, the HTML is not saving. All the HTML Tags are removed.

So i add the html code in the database, {prefix}_store_lang -> note and the result in the FO is like in the attachment.

Do i need to change it in the template file or is it again a controler?

Link to comment
Share on other sites

Open ./classes/Store.php

find

'note' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCleanHtml', 'size' => 65000),

change to

'note' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml', 'size' => 65000),

 

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...