<?php require_once 'admin/classes/ConnectDB.php'; require_once 'admin/classes/DBase.php'; require_once 'admin/classes/login.php'; include "php/config.php"; $site_login = Install::select()[0]["name"]; $page = DB::selectParam('catalog', 'name_en', $_GET['page'], false, false); //узнаем id по значению $_GET['page'] if ($page[0]['parent'] == 0) { //если это родительский каталог, то $arr_number_subcat = DB::selectParam('catalog', 'parent', (int) $page[0]['id'], false, false); // то выводим все подкатегории, соответсвующие id родительского каталога $sections = ''; $count = count($arr_number_subcat); //количество подкатегорий /** * Формируем строку с id-шками подкатегорий */ $i = 0; foreach ($arr_number_subcat as $value) { $i++; $sections .= $value['id']; if ($i < $count) { $sections .= ','; } } /******************************************/ //выводим все товары соответсвующие id-шкам подкатегорий $sql = "SELECT pr.id, pr.section, pr.name, pr.nomer, pr.included_price, pr.title, pr.description, pr.keywords, pr.img, pr.img_title, pr.img_alt, pr.nn, pr.best, pr.hide, ip.id as ip_id, ip.id_price, ip.id_size, ip.id_module, ip.price, ip.price_old, ip.sale, ip.date\n\t\t\tFROM info_prod as ip\n\t\t\tINNER JOIN (SELECT id_price ,MIN(price) AS min_price FROM info_prod as ip2 group by ip2.id_price) AS outerip ON outerip.id_price = ip.id_price AND ip.price = outerip.min_price\n\t\t\tINNER JOIN price as pr ON pr.id=ip.id_price AND pr.section IN({$sections})\n\t\t\torder by best DESC, hide ASC, nn ASC limit 0,5"; $result = DB::selectSql($sql);
<header id="header" class="app-header navbar" role="menu"> <!-- navbar header --> <div class="navbar-header bg-dark"> <button class="pull-right visible-xs" ui-toggle="off-screen" target=".app-aside" ui-scroll="app"> <i class="glyphicon glyphicon-align-justify"></i> </button> <!-- brand --> <a href="kurs.php" class="navbar-brand text-lt"> <span class="hidden-folded m-l-xs"><?php echo Install::select(); ?> </span> </a> <!-- / brand --> </div> </header>
} function del_extra($srt) { $srt = str_replace(',', ' ', $srt); $srt = str_replace('.', ' ', $srt); $srt = str_replace('/', ' ', $srt); $srt = str_replace(' ', '-', $srt); return $srt; } function date_exp($datetime) { list($date, $time) = explode(' ', $datetime); return $date; } function time_exp($datetime) { list($date, $time) = explode(' ', $datetime); return $time; } function data_russian($date) { list($y, $m, $d) = explode('-', $date); $date_new = $d . "." . $m . "." . $y; return $date_new; } require_once '../classes/ConnectDB.php'; require_once 'classes/DBase.php'; require_once 'classes/Install.php'; $settings = new Install(); $data_settings = $settings->select();