Пример #1
0
             break;
     }
 }
 if (isset($categoryID)) {
     $objectType = 'cat';
 } else {
     $objectType = isset($_POST['object']) ? $_POST['object'] : null;
 }
 // Get categories tree
 $catTree = catGetCategoryCListMin();
 // Get objects list
 $objects = array();
 switch ($objectType) {
     case 'cat':
         $count = 3;
         $products = prdGetProductByCategory(array('categoryID' => $categoryID, 'fullFlag' => false), $count);
         foreach ($catTree as $cat) {
             if ($cat['parent'] == $categoryID) {
                 $objects[] = array('id' => 'cat_' . $cat['categoryID'], 'name' => $cat['name'], 'uri' => $cat['uri'], 'isFolder' => 1);
             }
         }
         foreach ($products as $product) {
             $pName = !empty($product['sef']) ? $product['sef'] : $product['name'];
             $objects[] = array('id' => 'prod_' . $product['productID'], 'name' => $pName, 'uri' => $product['uri']);
         }
         break;
     case 'news':
         $items = @newsGetAllNews(null, $stub);
         foreach ($items as $item) {
             $objects[] = array('id' => 'news_' . $item['NID'], 'name' => $item['title'], 'uri' => $item['uri']);
         }
Пример #2
0
        $_SESSION['checkedCategories'][$_SubC[$i]] = $_SESSION['checkedCategories'][$_cID];
        $_SESSION['selectedProductsIncSub'][$_SubC[$i]] = $_SESSION['checkedCategories'][$_cID] ? isset($ProductCategories[$_SubC[$i]]['products_count']) ? $ProductCategories[$_SubC[$i]]['products_count'] : 0 : 0;
        if (!$_SESSION['checkedCategories'][$_SubC[$i]]) {
            $_SESSION['selectedProducts'][$_SubC[$i]] = array();
        } else {
            $Products = prdGetProductByCategory(array('categoryID' => $_SubC[$i], 'fullFlag' => false), $_t);
            $_c = count($Products);
            for ($_t = 0; $_t < $_c; $_t++) {
                if ($Products[$_t]['enabled']) {
                    $_SESSION['selectedProducts'][$_SubC[$i]][$Products[$_t]['productID']] = 1;
                }
            }
        }
    }
}
/**
 * getting products by request
 */
if (isset($_POST['showProducts'])) {
    $_POST['showProducts'] = intval($_POST['showProducts']);
    $Products = prdGetProductByCategory(array('categoryID' => intval($_POST['showProducts']), 'fullFlag' => false), $_t);
    foreach ($Products as $_ind => $_Product) {
        if (!$_Product['enabled']) {
            unset($Products[$_ind]);
        }
    }
    $smarty->assign('showProducts', $_POST['showProducts']);
    $smarty->assign('Products', $Products);
    $smarty->assign('ProductsNum', count($Products));
}
$smarty->assign('ProductCategories', $ProductCategories);