core/api/modules/tovar_cat/index.php

34 lines
1.3 KiB
PHP
Raw Normal View History

2022-12-11 13:55:49 +05:00
<?php
ini_set('display_errors', 0 );
2022-12-17 18:15:09 +05:00
$smarty -> caching = false;
2022-12-11 13:55:49 +05:00
$smarty -> cache_lifetime = 3600;
2022-12-17 18:15:09 +05:00
$_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`", $_GET['id'] );
$smarty->assign('list', $childrenCategory);//получаем дочерние категории
$childrenTovar=\DB::getAll("SELECT * FROM `tovar` WHERE `status` = 1 AND `category` = ? ORDER BY `title`", $_GET['id'] );
for($i=0; $i<count($childrenTovar);$i++)$childrenTovar[$i]['img']=\DB::getValue("SELECT `filename` FROM `tovar_img` WHERE `tovar_id`=?", $childrenTovar[$i]['id']);
$smarty->assign('list2', $childrenTovar);//получаем дочерние категории
2022-12-11 13:55:49 +05:00
/* ----------------------------------------------------------------------
19.09.2022
Узнаем обложку раздела
---------------------------------------------------------------------- */
2022-12-17 18:15:09 +05:00
$mainImg=\DB::getValue("SELECT `filename` FROM `tovar_category_img` WHERE `tovar_category_id`=?", $_GET['id']);
$smarty->assign('oblozhka', $mainImg);
2022-12-11 13:55:49 +05:00
?>