Jump to content

Configure Custom text blocks ? How do you change text height


gray

Recommended Posts

Hi - its the Custom text blocks module - configuration page.

 

The page you type in all the text and insert images.

 

Also not mentioned - But how do you add a 2nd Custom text block, as it does say blocks (plural) ?

Link to comment
Share on other sites

  • 3 weeks later...
I've reported this issue in the Betas and RCs, but PrestaShop decided not to allow multiple text blocks to be configured, even though the blocks are stored in a separate database table. I managed to hack a solution by changing line 256 of modules/ps_customtext/ps_customtext.php from:
            'cms_infos' => Db::getInstance()->getRow($sql),

to:

            'cms_infos' => Db::getInstance()->executeS($sql),

and modules/ps_customtext/ps_customtext.tpl from:

<div id="custom-text">
  {$cms_infos.text nofilter}
</div>

to:

{foreach from=$cms_infos item=cms_info}
<div id="custom-text">
  {$cms_infos.text nofilter}
</div>
​{/foreach}

I can then add multiple blocks one after the other, but I must manually add new rows to the ps_info and ps_info_lang tables in the database.

 

It really would be better for PrestaShop to create a list of blocks on the configuration page that can be edited, but they've ignored my requests so far.

Link to comment
Share on other sites

  • 6 months later...
  • 1 month later...

 

I've reported this issue in the Betas and RCs, but PrestaShop decided not to allow multiple text blocks to be configured, even though the blocks are stored in a separate database table. I managed to hack a solution by changing line 256 of modules/ps_customtext/ps_customtext.php from:
            'cms_infos' => Db::getInstance()->getRow($sql),

to:

            'cms_infos' => Db::getInstance()->executeS($sql),

and modules/ps_customtext/ps_customtext.tpl from:

<div id="custom-text">
  {$cms_infos.text nofilter}
</div>

to:

{foreach from=$cms_infos item=cms_info}
<div id="custom-text">
  {$cms_infos.text nofilter}
</div>
​{/foreach}

I can then add multiple blocks one after the other, but I must manually add new rows to the ps_info and ps_info_lang tables in the database.

 

It really would be better for PrestaShop to create a list of blocks on the configuration page that can be edited, but they've ignored my requests so far.

 

Hi, I've tried in 1.7.2 as you suggested, inserted lines in the database, however I cannot see list of blocks anywhere therefore I'm unable to edit the second block. Can you have two blocks on home page? Or better ... is this hack working in 1.7.2?

Link to comment
Share on other sites

  • 10 months later...
  • 4 months later...
On 14/08/2017 at 4:48 AM, mr_absinthe said:

Hi, I've tried in 1.7.2 as you suggested, inserted lines in the database, however I cannot see list of blocks anywhere therefore I'm unable to edit the second block. Can you have two blocks on home page? Or better ... is this hack working in 1.7.2?

 

I tried this in 1.7.4.3.

 

PS_Customtext version 4.1.0

 

Added a test text entry in the database in these tables

(prefix)info_lang 

(prefix)info

 

I noticed there is a third table related to this module:

(prefix)info_shop

I didn't modify this one.

 

Then: Modified the files as described by rocky.

 

'cms_infos' => Db::getInstance()->getRow($sql)

this is now in row 290 of customtext.php, replaced as indicated with this

  'cms_infos' => Db::getInstance()->executeS($sql),

 

 

For customtext.tpl:

<div id="custom-text">
  {$cms_infos.text nofilter}
</div>

This is the only entry really in this file, replaced as indicated by rocky to

{foreach from=$cms_infos item=cms_info}
<div id="custom-text">
  {$cms_infos.text nofilter}
</div>
{/foreach}

 

 

There was a change, but not the one I wanted.

Backoffice:

I don't get the list of those two info blocks. The module will automatically reload to the custom text block no. 1. When clicking "back to list", it will shortly display a list only displaying this one item, and then automatically reload the edit page for this one item.

Same issue as mr_absinthe.

Hint from DICE appears not useful.

 

 

However:

In frontoffice now I suddently had my info block replicated. I suddently had the same custom text 4 times instead of once.

I did not get the test info block which I had created in the database, but only a copy of the original text I had written through backoffice.

My shop has 5 languages, maybe the modification rocky proposed is designed for a shop with one language. Only a wild guess.

I deleted the new database entries and nothing changed. Still the info block was replicated three times. All in the same language, I didn't get the translations, just four times the same text block.

 

I reverted back to the original version.

For me it doesn't seem to work unfortunately.

 

 

 

 

 

Edited by sumsel
found third table, and changed behaviour (see edit history)
Link to comment
Share on other sites

  • 2 months later...

Can someone from Prestashop that this is the desired functionality for this module?  It's been half baked since v1.7 launch?

I am on 1.7.4.2 with Module version 4.1.0 and this appears useful only to put a block of text on the homepage as it is shown. 

The back to list button does nothing.

https://github.com/PrestaShop/PrestaShop/issues/9902

Looks like it is "Major" outstanding bug at this time, but was submitted back in October 2017.   I don't have the skills to contribute to fixing it, sadly...

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

  • 1 year later...

@num47 could you please stop spamming the forum. You opened the same question 5 times. I understood this is important for you, and modules can be duplicated (we usually do for payment modules), however this creates also certain other issues, like having 2 JS with the same name, sharing class, etc. If it's something you can avoid rather buy substitute module for it.

The duplicate holds several steps. 

1. You need to duplicate the module using FTP 

2. You change the parameters of the modules : like the name, which needs to be match with the modulesname.php!

You change the name of the class, the name of the module ($ this-> name), the display name ($ this-> displayName) and the path to the view file:

3. You need to check all the values saved into the DB, and change those. (bear in mind that changing the DB tables is not always needed)

4. You change the parameters for the translation.

Once this steps have been done- you should be able to  have a module duplicate. 

Bear in  mind that this depends from the module you would like to duplicate. The steps described above are a ruff approach as we don't know what module you would like to duplicate. 

Last point. just stop spamming the forum...

I hope I helped, 

cheers, 

Leo

  • Like 1
Link to comment
Share on other sites

  • 2 years later...
On 11/13/2018 at 9:43 AM, sumsel said:

 

I tried this in 1.7.4.3.

 

PS_Customtext version 4.1.0

 

Added a test text entry in the database in these tables

(prefix)info_lang 

(prefix)info

 

I noticed there is a third table related to this module:

(prefix)info_shop

I didn't modify this one.

 

Then: Modified the files as described by rocky.

 

'cms_infos' => Db::getInstance()->getRow($sql)

this is now in row 290 of customtext.php, replaced as indicated with this

  'cms_infos' => Db::getInstance()->executeS($sql),

 

 

For customtext.tpl:

<div id="custom-text">
  {$cms_infos.text nofilter}
</div>

This is the only entry really in this file, replaced as indicated by rocky to

{foreach from=$cms_infos item=cms_info}
<div id="custom-text">
  {$cms_infos.text nofilter}
</div>
{/foreach}

 

 

There was a change, but not the one I wanted.

Backoffice:

I don't get the list of those two info blocks. The module will automatically reload to the custom text block no. 1. When clicking "back to list", it will shortly display a list only displaying this one item, and then automatically reload the edit page for this one item.

Same issue as mr_absinthe.

Hint from DICE appears not useful.

 

 

However:

In frontoffice now I suddently had my info block replicated. I suddently had the same custom text 4 times instead of once.

I did not get the test info block which I had created in the database, but only a copy of the original text I had written through backoffice.

My shop has 5 languages, maybe the modification rocky proposed is designed for a shop with one language. Only a wild guess.

I deleted the new database entries and nothing changed. Still the info block was replicated three times. All in the same language, I didn't get the translations, just four times the same text block.

 

I reverted back to the original version.

For me it doesn't seem to work unfortunately.

 

 

 

 

 

not work

 

Link to comment
Share on other sites

Hi,
and what doesn't work for you
Please express yourself with your own description without clicking on the quote.

It is good to attach pictures of what is involved.

Text height?
The module contains an editor in which you can format the text as you need.

It is polite to say hello, thank you and not be afraid to use the word "please".

Edited by ps8moduly.cz (see edit history)
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...