15 lines
733 B
PHP
15 lines
733 B
PHP
<?php
|
|
|
|
/* ----------------------------------------------------------------------
|
|
24.12.2022
|
|
Берем рандомные 10 товаров.....
|
|
---------------------------------------------------------------------- */
|
|
|
|
$rndTovar = \DB::getAll( 'SELECT * FROM `tovar` WHERE `artikul`<>"" ORDER BY RANDOM() LIMIT 10' );
|
|
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 );
|
|
|
|
?>
|