Thank you for your reply,JNeuhoff wrote: ↑Tue Jan 09, 2024 2:33 amIt's a similar logic for OpenCart 4:
Code: Select all
// event handler for admin/view/catalog/product_form/before public function eventViewCatalogProductFormBefore( string &$route, array &$data, string &$template_code ): void { // .... $code = $this->getTemplateCode($route,$code); // .... modify $code $template_code = $code; } protected function getTemplateCode( $route, &$code ) { if (!empty($code)) { return $code; } $file = DIR_TEMPLATE . $route . '.twig'; if (is_file($file)) { $code = file_get_contents( $file ); } else { trigger_error("Cannot find template file for route '$route'"); exit; } return $code; }
I have tested the code but I got error:
Code: Select all
Notice: Cannot find template file for route 'extension/opencart/dashboard/recent_info'
Code: Select all
admin/view/extension/opencart/dashboard/recent_info.twig