- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
function getCategories($id, $prefix, &$dl, $extra = '', $sc = '')
{
$dbextra = (!empty($extra)) ? " AND Id = '$extra'" : "";
// $query = $GLOBALS['db']->Query("SELECT * FROM " . PREFIX . "_modul_shop_kategorie WHERE Elter = '$id'$dbextra ORDER BY Rang ASC");
// if (!$query->numrows()) return;
//
// $num = $query->numrows();
if (isset($_SESSION['Shop']['Categories'][$id]) && $_SESSION['Shop']['Categories'][$id] === false) {
return;
}
if (isset($_SESSION['Shop']['Categories'][$id]) && $_SESSION['Shop']['Categories'][$id] != '') {
} else {
$sql = $GLOBALS['db']->Query("SELECT * FROM " . PREFIX . "_modul_shop_kategorie WHERE Elter = '$id' ORDER BY Rang ASC");
if (!$sql->numrows()) {
$_SESSION['Shop']['Categories'][$id] = false;
$sql->close();
return;
}
while ($row = $sql->FetchRow()) {
$_SESSION['Shop']['Categories'][$id][$row->Id] = $row;
}
$sql->close();
}
if (!empty($extra)) {
@$Items = $_SESSION['Shop']['Categories'][$id][$extra];
} else {
@$Items = $_SESSION['Shop']['Categories'][$id];
}
// if (!is_array($Items)) return;
// while ($item = $query->fetchrow()) {
foreach ($Items as $item) {
$item->ntr = "";
$item->visible_title = $prefix . '' . $item->KatName;
$item->sub = ($item->Elter == 0) ? 0 : 1;
$item->dyn_link = "index.php?module=shop&categ=$item->Id&parent=$item->Elter&navop=" . (($item->sub==0) ? $item->Id : getParentShopcateg($item->Elter));
$item->dyn_link = $this->shopRewrite($item->dyn_link);
if($item->Elter == 0) $item->ntr = 1;
$mdl = array();
////////////////////////////////////////Рекурсия////////////////////
$this->getCategories($item->Id, $prefix, $mdl, $extra, $sc);
$item->sub = $mdl;
array_push($dl, $item);
}
return $dl;
}