core/api/modules/main/tk-ligat.ru.php

15 lines
715 B
PHP

<?php
/* ----------------------------------------------------------------------
24.12.2022
Берем рандомные 99 товаров.....
---------------------------------------------------------------------- */
$rndTovar=\DB::getAll('SELECT * FROM `tovar` WHERE `artikul`<>"" ORDER BY RANDOM() LIMIT 20');
for ($i=0; $i<count($rndTovar); $i++) {
$rndTovar[$i]['cena']=\DB::getValue("SELECT `cena` FROM `tovar_price_history` WHERE `tovar_id`=? ORDER BY `t` DESC LIMIT 1", $rndTovar[$i]['id']);
$rndTovar[$i]['img']=\DB::getValue("SELECT `filename` FROM `tovar_img` WHERE `tovar_id`=? LIMIT 1", $rndTovar[$i]['id']);
}
$smarty -> assign( 'rndTovar', $rndTovar );
?>