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

15 lines
731 B
PHP
Raw Permalink Normal View History

2022-12-24 21:12:23 +05:00
<?php
/* ----------------------------------------------------------------------
24.12.2022
2023-01-07 18:55:55 +05:00
Берем рандомные 10 товаров.....
2022-12-24 21:12:23 +05:00
---------------------------------------------------------------------- */
2023-01-14 21:17:46 +05:00
$rndTovar = \DB::getAll( 'SELECT * FROM `tovar` WHERE `artikul`<>"" ORDER BY RAND() LIMIT 10' );
2023-01-07 18:55:55 +05:00
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'] );
2023-01-02 21:33:36 +05:00
}
2022-12-24 21:12:23 +05:00
$smarty -> assign( 'rndTovar', $rndTovar );
?>