Jump to content

Call to undefined method FrontController::parseCMSContent() after update to 1.7.8.2


Shapes

Recommended Posts

Hello,

I created some custom shortcodes for my PrestaShop by creating a file (override/classes/controller/FrontController.php) with a method like :

public static function parseCMSContent($content) { ... }

And in my module and cms smarty templates I changed:

{$cms.content nofilter}

to:

{FrontController::parseCMSContent($cms.content) nofilter}

Everything was working fine with Prestashop 1.7.7.5, but the update to 1.7.8.2 broke the whole thing.

I get a 500 error saying :

PHP Fatal error: Uncaught Error: Call to undefined method FrontController::parseCMSContent() ... .module.pscustomtextpscustomtext. ...

It's still working fine with debug mode enabled though..

I can't find anything about the function being deprecated, any idea on how I could get this working again please?

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

In case this can help anyone, I fixed this by moving my override into a new smarty plugin.

I created a file **vendor/smarty/smarty/libs/plugins/function.get_shortcoded_content.php**

I added my shortcodes in:

function smarty_function_get_shortcoded_content($params, &$smarty)
{
...
}

And in my smarty files I called:

{get_shortcoded_content content=$cms.content}

instead of:

{$cms.content nofilter}

It seems to work all fine again.

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