prokat/api/modules/find/index.php
2025-06-16 18:28:08 +05:00

43 lines
1.3 KiB
PHP
Executable File

<?php
ini_set('display_errors', 0);
function ekr($text)
{ // ФУНКЦИЯ очистки кода
$old1 = array(" "); #Ищем вредное ">",, "<"
$new1 = array("%"); #Меняем на полезное"&gt;", , "&lt;"
$text = str_replace($old1, $new1, $text); #Собсно сама замена =)
return $text;
}
class modClass
{
static $content = '';
/* ----------------------------------------------------------------------
16.05.2025
Получаем дочерние категории
---------------------------------------------------------------------- */
static function getRootCategory()
{
return \DBmysql::getAll("SELECT `id`, `title`, `json` FROM `ctovar` WHERE `status`=? AND `cat`=? ORDER BY `sort`, `title`", [1, 0]);
}
}
$array=DBmysql::getAll("SELECT tovar.id, tovar.title, tovar.json, cenaarendy.ch4 as cena FROM tovar JOIN cenaarendy ON tovar.id=cenaarendy.tovar_id WHERE title LIKE '%" . $_SESSION['find_txt'] . "%'");
$c=count($array);
for ($i=0; $i<$c; $i++)$array[$i]['images']=core::j($array[$i]['json'])['images'][0];
//print_r($array);
$smarty->assign('tovar', $array);
$smarty->assign('title', "Поиск по сайту - " . $_SESSION['find_txt']);
$smarty->assign('rootCategory', modClass::getRootCategory());
?>