Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 601 Vote(s) - 3.47 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Prestashop custom module routing issue after update to 1.7.8.4

#1
I just updated a PrestaShop website from 1.7.8.3 to 1.7.8.4, everything worked fine, but I'm havine 404 errors on custom module routes.

On module install I register routes like:

$this->registerHook('ModuleRoutes')

And my routes are like:

public function hookModuleRoutes() {
$urls = array(
'module-mymodulename-posts' => array(
'controller' => 'posts',
'rule' => 'posts/list',
'keywords' => array(),
'params' => array(
'fc' => 'module',
'module' => 'mymodulename',
)
),
...
);
return $urls;
}

Now **www.mywebsite.com/posts/list** returns 404.

And **www.mywebsite.com/modules/mymodulename/posts** works but url is not looking as good.

It all was working fine until this morning update.

Any idea on how I could get this solved ?
I have nothing about routing in the release logs.
Reply

#2
Apparently a PrestaShop bug:

[To see links please register here]


that just got a fix:

[To see links please register here]


Fix works fine on my side.
Reply

#3
You have to change getHookStatusByName function in classes/Hook.php file :

public static function getHookStatusByName($hook_name): bool
{
$hook_names = [];
if (Cache::isStored('active_hooks')) {
$hook_names = Cache::retrieve('active_hooks');
} else {
$sql = new DbQuery();
$sql->select('lower(name) as name');
$sql->from('hook', 'h');
$sql->where('h.active = 1');
$active_hooks = Db::getInstance()->executeS($sql);
if (!empty($active_hooks)) {
$hook_names = array_column($active_hooks, 'name');
if (is_array($hook_names)) {
Cache::store('active_hooks', $hook_names);
}
}
}

return in_array(strtolower($hook_name), $hook_names);
}
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through