54 lines
2.0 KiB
PHP
54 lines
2.0 KiB
PHP
<?php
|
||
ini_set('display_errors', 0 );
|
||
|
||
|
||
|
||
$smarty -> caching = false;
|
||
$smarty -> cache_lifetime = 86400;
|
||
|
||
|
||
$_GET['id'] = ( $_GET['id'] ) ? $_GET['id'] : 0;
|
||
|
||
$categoryInfo=\DB::getAll("SELECT * FROM `tovar_category` WHERE `id`=?", $_GET['id']);
|
||
$smarty->assign('page_info', $categoryInfo);//получаем инфо о категории
|
||
|
||
$childrenCategory=\DB::getAll("SELECT * FROM `tovar_category` WHERE `status` = 1 AND `category` = ? ORDER BY `title` LIMIT 33", $_GET['id'] );
|
||
|
||
$smarty->assign('list', $childrenCategory);//получаем дочерние категории
|
||
|
||
|
||
|
||
if ($_GET['id']>0)
|
||
$childrenTovar=\DB::getAll("SELECT * FROM `tovar` WHERE `category` = ? AND `status`=1", $_GET['id'] );
|
||
else
|
||
$childrenTovar=\DB::getAll("SELECT * FROM `tovar` WHERE `category`IS NULL AND `status`=1 ORDER BY RANDOM() LIMIT 200" );
|
||
|
||
for ($i=0; $i<count($childrenTovar); $i++){
|
||
$childrenTovar[$i]['cena']=\DB::getValue("SELECT `cena` FROM `tovar_price_history` WHERE `tovar_id`=? ORDER BY `t` DESC LIMIT 1", $childrenTovar[$i]['id']);
|
||
$childrenTovar[$i]['img']=\DB::getValue("SELECT `filename` FROM `tovar_img` WHERE `tovar_id`=?", $childrenTovar[$i]['id']);
|
||
}
|
||
|
||
|
||
$smarty->assign('list2', $childrenTovar);//получаем дочерние категории
|
||
|
||
|
||
|
||
/* ----------------------------------------------------------------------
|
||
19.09.2022
|
||
Узнаем обложку раздела
|
||
---------------------------------------------------------------------- */
|
||
|
||
$mainImg=\DB::getValue("SELECT `filename` FROM `tovar_category_img` WHERE `tovar_category_id`=?", $_GET['id']);
|
||
$smarty->assign('oblozhka', $mainImg);
|
||
|
||
|
||
/* ----------------------------------------------------------------------
|
||
28.12.2022
|
||
Получаем теги
|
||
---------------------------------------------------------------------- */
|
||
$meta = \core::getMeta( $_GET['mod'], $_GET['id'] );
|
||
$smarty -> assign( 'keywords', $meta['keywords'] );
|
||
$smarty -> assign( 'description', $meta['description'] );
|
||
|
||
|
||
?>
|