Good day, there is a script in a procedural style, you need to remake it into OOP, the main part of the script has already been translated, this part remains that you can’t conclude in class in order to inherit everything that is in it
if(isset($_GET['category'])){ $id = (int)$_GET['category']; // хлебные крошки // return true (array not empty) || return false $breadcrumbs_array = $this->model->breadcrumbs($categories, $id); if($breadcrumbs_array){ $breadcrumbs = "<a href='/cat/'>Главная</a> / "; foreach($breadcrumbs_array as $id => $title){ $breadcrumbs .= "<a href='?category={$id}'>{$title}</a> / "; } $breadcrumbs = rtrim($breadcrumbs, " / "); $breadcrumbs = preg_replace("#(.+)?<a.+>(.+)</a>$#", "$1$2", $breadcrumbs); }else{ $breadcrumbs = "<a href='/cat/'>Главная</a> / Каталог"; } // ID дочерних категорий $ids = $this->model->cats_id($categories, $id); $ids = !$ids ? $id : rtrim($ids, ","); if($ids) $products = $this->model->get_products($ids); else $products = null; }else{ $products = $this->model->get_products(); }