core/api/modules/tovar_cat/index.php

34 lines
1.3 KiB
PHP
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
ini_set('display_errors', 0 );
$smarty -> caching = false;
$smarty -> cache_lifetime = 3600;
$_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);//получаем дочерние категории
/* ----------------------------------------------------------------------
19.09.2022
Узнаем обложку раздела
---------------------------------------------------------------------- */
$mainImg=\DB::getValue("SELECT `filename` FROM `tovar_category_img` WHERE `tovar_category_id`=?", $_GET['id']);
$smarty->assign('oblozhka', $mainImg);
?>