Jump to content

Custom Text Blocks allows only single instance in 1.7


MRost

Recommended Posts

Hi,

 

i have the following problem: the build-in ps_customtext module ( also named Custom Text Blocks, CMS Block, etc..) allows me to create only single instance. I'm running a clean, updated installation of prestashop 1.7.

 

When i want to add more blocks - by navigating from list of modules and choosing 'Configure', it leads directly to editing of the single CMS block instance -instead of offering a list of created instances like Link Widget does.

 

Same problem goes for Banner widget - i distinctly remember that this wasn't a problem in prestashop 1.5, i could have multiple CMS blocks.

 

Have these modules been downgraded to single instance? Is this a bug? If this cannot be fixed, could You suggest a module that provides this function (multiple custom html blocks) ?

 

I apologize in advance if this has been answered before - i have failed to find anything related to my problem with google.

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

In the end i have solved this by creating a new module which merges classes and functions from ps_customtext and ps_linklist.

 

Finally i can create multiple different text or html blocks for any hook ...

 

Edit: Message me if anyone would like to have it. I haven't put it up because not all of the code is mine...

 

Edit 2: Because there have been many people asking about the module, here is a link to it on my google drive: https://drive.google.com/open?id=0B_uyCHgQ-ZNGdjNPZWFTX1NjZ0k

 

I don't know if it works on Prestashop 1.6. It probably does not, since the modules ps_customtext and ps_linklist are coded differently there. However there are many modules offering this function for 1.6.

 

I hope that one day someone from Prestashop team will take time to integrate this vital function into the original ps_customtext module.

Edited by MRost (see edit history)
  • Like 3
  • Thanks 3
Link to comment
Share on other sites

  • 1 month later...

Thank you MRost for sharing your module. That's exacly what I was looking for.
I can also recommend modules from Vekia

Free HTML box https://mypresta.eu/modules/front-office-features/html-box.html

Paid HTML box PRO https://mypresta.eu/modules/front-office-features/html-box-pro.html

 

I haven't used them with 1.7, but they were very helpful on my previous project with 1.6

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

  • 11 months later...
  • 3 months later...

Hi!

Thanks for your zip archive, that's great!

I'm running PS 1.7 on a MAMP server, it uploaded OK, but when I try accessing the configuration panel of the module, I have an error 500.
Any idea of how I can fix this?

Thanks!

Capture d’écran 2018-07-05 à 11.02.32.png

Link to comment
Share on other sites

  • 4 months later...

Hi,

@MRost, I also have a bug when acessing the edit form(no bug when I create a new content)

Symfony\Component\Debug\Exception\ContextErrorException:
Notice: Undefined offset: 6

  at var/cache/dev/smarty/compile/30/de/68/30de6866b5ee4335652f37f7ceb3066339e2045f_0.file.form.tpl.php:909
  at Block_17476902695bdf8c8fdacab9_55862765->callBlock(object(Smarty_Internal_Template))
     (vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php:247)
  at Smarty_Internal_Runtime_Inheritance->callBlock(object(Block_17476902695bdf8c8fdacab9_55862765), object(Smarty_Internal_Template))
     (vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php:183)
  at Smarty_Internal_Runtime_Inheritance->process(object(Smarty_Internal_Template), object(Block_17476902695bdf8c8fdacab9_55862765))
     (vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php:157)
  at Smarty_Internal_Runtime_Inheritance->instanceBlock(object(Smarty_Internal_Template), 'Block_17476902695bdf8c8fdacab9_55862765', 'input', 1)
     (var/cache/dev/smarty/compile/30/de/68/30de6866b5ee4335652f37f7ceb3066339e2045f_0.file.form.tpl.php:1470)
  at Block_15639054845bdf8c8fda7226_94902090->callBlock(object(Smarty_Internal_Template))
     (vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php:247)
  at Smarty_Internal_Runtime_Inheritance->callBlock(object(Block_15639054845bdf8c8fda7226_94902090), object(Smarty_Internal_Template))
     (vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php:183)
  at Smarty_Internal_Runtime_Inheritance->process(object(Smarty_Internal_Template), object(Block_15639054845bdf8c8fda7226_94902090))
     (vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php:157)
  at Smarty_Internal_Runtime_Inheritance->instanceBlock(object(Smarty_Internal_Template), 'Block_15639054845bdf8c8fda7226_94902090', 'field', 1)
     (var/cache/dev/smarty/compile/30/de/68/30de6866b5ee4335652f37f7ceb3066339e2045f_0.file.form.tpl.php:1505)
  at Block_13177499905bdf8c8fd849d7_48845545->callBlock(object(Smarty_Internal_Template))
     (vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php:247)
  at Smarty_Internal_Runtime_Inheritance->callBlock(object(Block_13177499905bdf8c8fd849d7_48845545), object(Smarty_Internal_Template))
     (vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php:231)
  at Smarty_Internal_Runtime_Inheritance->callParent(object(Smarty_Internal_Template), object(Block_9654378495be029143e5016_15361295), '{$smarty.block.parent}')
     (var/cache/dev/smarty/compile/9f/5c/de/9f5cdea73625a19b667c1a09fa83234b3d31c958_0.file.form.tpl.php:249)
  at Block_9654378495be029143e5016_15361295->callBlock(object(Smarty_Internal_Template))
     (vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php:247)
  at Smarty_Internal_Runtime_Inheritance->callBlock(object(Block_9654378495be029143e5016_15361295), object(Smarty_Internal_Template))
     (vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php:183)
  at Smarty_Internal_Runtime_Inheritance->process(object(Smarty_Internal_Template), object(Block_9654378495be029143e5016_15361295), object(Block_13177499905bdf8c8fd849d7_48845545))
     (vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php:185)
  at Smarty_Internal_Runtime_Inheritance->process(object(Smarty_Internal_Template), object(Block_13177499905bdf8c8fd849d7_48845545))
     (vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php:157)
  at Smarty_Internal_Runtime_Inheritance->instanceBlock(object(Smarty_Internal_Template), 'Block_13177499905bdf8c8fd849d7_48845545', 'input_row', 1)
     (var/cache/dev/smarty/compile/30/de/68/30de6866b5ee4335652f37f7ceb3066339e2045f_0.file.form.tpl.php:1663)
  at Block_14402741245bdf8c8fd66f20_66197582->callBlock(object(Smarty_Internal_Template))
     (vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php:247)
  at Smarty_Internal_Runtime_Inheritance->callBlock(object(Block_14402741245bdf8c8fd66f20_66197582), object(Smarty_Internal_Template))
     (vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php:183)
  at Smarty_Internal_Runtime_Inheritance->process(object(Smarty_Internal_Template), object(Block_14402741245bdf8c8fd66f20_66197582))
     (vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php:157)
  at Smarty_Internal_Runtime_Inheritance->instanceBlock(object(Smarty_Internal_Template), 'Block_14402741245bdf8c8fd66f20_66197582', 'fieldset', 1)
     (var/cache/dev/smarty/compile/30/de/68/30de6866b5ee4335652f37f7ceb3066339e2045f_0.file.form.tpl.php:1830)
  at Block_4210089755bdf8c8fcd17e9_57289595->callBlock(object(Smarty_Internal_Template))
     (vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php:247)
  at Smarty_Internal_Runtime_Inheritance->callBlock(object(Block_4210089755bdf8c8fcd17e9_57289595), object(Smarty_Internal_Template))
     (vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php:183)
  at Smarty_Internal_Runtime_Inheritance->process(object(Smarty_Internal_Template), object(Block_4210089755bdf8c8fcd17e9_57289595))
     (vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php:157)
  at Smarty_Internal_Runtime_Inheritance->instanceBlock(object(Smarty_Internal_Template), 'Block_4210089755bdf8c8fcd17e9_57289595', 'defaultForm')
     (var/cache/dev/smarty/compile/30/de/68/30de6866b5ee4335652f37f7ceb3066339e2045f_0.file.form.tpl.php:39)
  at content_5bdf8c901e5a99_21157914(object(Smarty_Internal_Template))
     (vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php:123)
  at Smarty_Template_Resource_Base->getRenderedTemplateCode(object(Smarty_Internal_Template))
     (vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php:114)
  at Smarty_Template_Compiled->render(object(Smarty_Internal_Template))
     (vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php:206)
  at Smarty_Internal_Template->render()
     (vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php:365)
  at Smarty_Internal_Template->_subTemplateRender('helpers/form/form.tpl', null, null, 0, 3600, array(), 2, false, null, null)
     (vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php:127)
  at Smarty_Internal_Runtime_Inheritance->endChild(object(Smarty_Internal_Template), 'helpers/form/form.tpl')
     (var/cache/dev/smarty/compile/9f/5c/de/9f5cdea73625a19b667c1a09fa83234b3d31c958_0.file.form.tpl.php:44)
  at content_5be0291440a7c5_76688195(object(Smarty_Internal_Template))
     (vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php:123)
  at Smarty_Template_Resource_Base->getRenderedTemplateCode(object(Smarty_Internal_Template))
     (vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php:114)
  at Smarty_Template_Compiled->render(object(Smarty_Internal_Template))
     (vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php:206)
  at Smarty_Internal_Template->render(false, 0)
     (vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php:232)
  at Smarty_Internal_TemplateBase->_execute(null, null, null, null, 0)
     (vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php:116)
  at Smarty_Internal_TemplateBase->fetch()
     (classes/helper/Helper.php:113)
  at HelperCore->generate()
     (classes/helper/HelperForm.php:272)
  at HelperFormCore->generate()
     (classes/helper/HelperForm.php:67)
  at HelperFormCore->generateForm(array(array('form' => array('tinymce' => true, 'legend' => array('title' => 'Edit the link block.', 'icon' => 'icon-edit'), 'input' => array(array('type' => 'hidden', 'name' => 'id_html_block'), array('type' => 'text', 'label' => 'Name of the HTML block', 'name' => 'name', 'required' => true), array('type' => 'select', 'label' => 'Point d\'accroche', 'name' => 'id_hook', 'class' => 'input-lg', 'options' => array('query' => array(array('id' => '19', 'name' => 'displayAfterBodyOpeningTag'), array('id' => '70', 'name' => 'displayAfterCarrier'), array('id' => '132', 'name' => 'displayAfterProductThumbs'), array('id' => '217', 'name' => 'displayApSC'), array('id' => '92', 'name' => 'displayAttributeForm'), array('id' => '79', 'name' => 'displayAttributeGroupForm'), array('id' => '86', 'name' => 'displayAttributeGroupPostProcess'), array('id' => '46', 'name' => 'displayAuthenticateFormBottom'), array('id' => '209', 'name' => 'displayBanner'), array('id' => '20', 'name' => 'displayBeforeBodyClosingTag'), array('id' => '69', 'name' => 'displayBeforeCarrier'), array('id' => '119', 'name' => 'displayCarrierExtraContent'), array('id' => '59', 'name' => 'displayCarrierList'), array('id' => '110', 'name' => 'displayCartExtraProductActions'), array('id' => '222', 'name' => 'displayCartTotalPriceLabel'), array('id' => '220', 'name' => 'displayCheckoutSubtotalDetails'), array('id' => '226', 'name' => 'displayCheckoutSummaryTop'), array('id' => '224', 'name' => 'displayCMSDisputeInformation'), array('id' => '223', 'name' => 'displayCMSPrintButton'), array('id' => '11', 'name' => 'displayContentWrapperBottom'), array('id' => '10', 'name' => 'displayContentWrapperTop'), array('id' => '45', 'name' => 'displayCreateAccountEmailFormBottom'), array('id' => '168', 'name' => 'displayCrossSellingShoppingCart'), array('id' => '42', 'name' => 'displayCustomerAccount'), array('id' => '47', 'name' => 'displayCustomerAccountForm'), array('id' => '63', 'name' => 'displayCustomerAccountFormTop'), array('id' => '114', 'name' => 'displayCustomerLoginFormAfter'), array('id' => '194', 'name' => 'displayDashboardToolbarIcons'), array('id' => '193', 'name' => 'displayDashboardToolbarTopMenu'), array('id' => '129', 'name' => 'displayDashboardTop'), array('id' => '82', 'name' => 'displayFeatureForm'), array('id' => '87', 'name' => 'displayFeaturePostProcess'), array('id' => '88', 'name' => 'displayFeatureValueForm'), array('id' => '89', 'name' => 'displayFeatureValuePostProcess'), array('id' => '35', 'name' => 'displayFooter'), array('id' => '210', 'name' => 'displayFooterAfter'), array('id' => '165', 'name' => 'displayFooterBefore'), array('id' => '27', 'name' => 'displayFooterProduct'), array('id' => '204', 'name' => 'displayGDPRConsent'), array('id' => '13', 'name' => 'displayHome'), array('id' => '28', 'name' => 'displayInvoice'), array('id' => '37', 'name' => 'displayInvoiceLegalFreeText'), array('id' => '12', 'name' => 'displayLeftColumn'), array('id' => '56', 'name' => 'displayLeftColumnProduct'), array('id' => '229', 'name' => 'displayLeoCartAttribute'), array('id' => '227', 'name' => 'displayLeoCartButton'), array('id' => '228', 'name' => 'displayLeoCartQuantity'), array('id' => '234', 'name' => 'displayLeoCompareButton'), array('id' => '236', 'name' => 'displayLeoProducReviewCompare'), array('id' => '233', 'name' => 'displayLeoProductListReview'), array('id' => '230', 'name' => 'displayLeoProductReviewExtra'), array('id' => '231', 'name' => 'displayLeoProductTab'), array('id' => '232', 'name' => 'displayLeoProductTabContent'), array('id' => '215', 'name' => 'displayLeoProfileProduct'), array('id' => '235', 'name' => 'displayLeoWishlistButton'), array('id' => '2', 'name' => 'displayMaintenance'), array('id' => '97', 'name' => 'displayMyAccountBlock'), array('id' => '103', 'name' => 'displayNav'), array('id' => '160', 'name' => 'displayNav1'), array('id' => '190', 'name' => 'displayNav2'), array('id' => '22', 'name' => 'displayNavFullWidth'), array('id' => '39', 'name' => 'displayOrderConfirmation'), array('id' => '167', 'name' => 'displayOrderConfirmation2'), array('id' => '71', 'name' => 'displayOrderDetail'), array('id' => '104', 'name' => 'displayOverrideTemplate'), array('id' => '111', 'name' => 'displayPaymentByBinaries'), array('id' => '218', 'name' => 'displayPaymentEu'), array('id' => '5', 'name' => 'displayPaymentReturn'), array('id' => '76', 'name' => 'displayPaymentTop'), array('id' => '36', 'name' => 'displayPDFInvoice'), array('id' => '51', 'name' => 'displayProductAdditionalInfo'), array('id' => '121', 'name' => 'displayProductExtraContent'), array('id' => '212', 'name' => 'displayProductInformation'), array('id' => '102', 'name' => 'displayProductListFunctionalButtons'), array('id' => '3', 'name' => 'displayProductPageDrawer'), array('id' => '219', 'name' => 'displayProductPriceBlock'), array('id' => '191', 'name' => 'displayReassurance'), array('id' => '7', 'name' => 'displayRightColumn'), array('id' => '23', 'name' => 'displayRightColumnProduct'), array('id' => '186', 'name' => 'displaySearch'), array('id' => '60', 'name' => 'displayShoppingCart'), array('id' => '44', 'name' => 'displayShoppingCartFooter'), array('id' => '21', 'name' => 'displayTop'), array('id' => '100', 'name' => 'displayTopColumn'), array('id' => '9', 'name' => 'displayWrapperBottom'), array('id' => '8', 'name' => 'displayWrapperTop')), 'id' => 'id', 'name' => 'name')), array('type' => 'text', 'label' => 'Position', 'name' => 'position'), array('type' => 'textarea', 'label' => 'Content - Français (French)', 'name' => 'content', 'lang' => true, 'cols' => 40, 'rows' => 10, 'class' => 'rte', 'autoload_rte' => true)), 'buttons' => array('cancelBlock' => array('title' => 'Annuler', 'href' => 'http://dev.amareni.com/admin2603/index.php?controller=AdminHTMLBlocks&token=79b57cde01544ebd1dfde92c2d230dc4', 'icon' => 'process-icon-cancel')), 'submit' => array('name' => 'submitHTMLBlock', 'title' => 'Enregistrer')))))
     (modules/htmlblocks/controllers/admin/AdminHTMLBlocksController.php:186)
  at AdminHTMLBlocksController->renderForm()
     (classes/controller/AdminController.php:2067)
  at AdminControllerCore->initContent()
     (classes/controller/Controller.php:255)
  at ControllerCore->run()
     (classes/Dispatcher.php:428)
  at DispatcherCore->dispatch()
     (adminxxxxx/index.php:99)

 

On 19/02/2017 at 5:49 PM, MRost said:

In the end i have solved this by creating a new module which merges classes and functions from ps_customtext and ps_linklist.

 

Finally i can create multiple different text or html blocks for any hook ...

 

Edit: Message me if anyone would like to have it. I haven't put it up because not all of the code is mine...

 

Edit 2: Because there have been many people asking about the module, here is a link to it on my google drive: https://drive.google.com/open?id=0B_uyCHgQ-ZNGdjNPZWFTX1NjZ0k

 

I don't know if it works on Prestashop 1.6. It probably does not, since the modules ps_customtext and ps_linklist are coded differently there. However there are many modules offering this function for 1.6.

 

I hope that one day someone from Prestashop team will take time to integrate this vital function into the original ps_customtext module.

 

Link to comment
Share on other sites

On 2017-04-12 at 10:14 AM, web-design-milano said:

So there is still really no simple way in 2017 to add multiple text blocks in basic PS or am I missing something?

 

Check this free module, it does what you are looking for, I guess: ContentBox: link

Link to comment
Share on other sites

  • 9 months later...

I have rewrite some parts of the module because html content wasn't escaped correctly during SQL insert or update.

Now you can fully use html content with single quotes in your html blocks.

The function i've used are natives from prestashop 1.6 so i think the compatibility is ok.

 

htmlblocks.zip

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

  • 2 weeks later...
  • 1 month later...
  • 1 year later...

Does anyone know how to do this on PS 1.7.7.1 

 

I was trying to duplicate the module but i couldn’t because it was loading the main modules info from the database.i guess i have to create a new database table for the duplicate one but apparently i could not do it. 

 

Anyway. If anyone can help then it would be a great help. Thank you. 

Link to comment
Share on other sites

  • 2 months later...

ciao a tutti il modulo funziona benissimo ma mi chiedo come faccio a metterlo in una categoria ...magari incrementare un text in piu alla descrizione categoria ...spero di essere stato chiaro

Grazie mille anticipatamente

Saldan

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