echo "Доступ запрещен.";
    exit(0);
}
if (!isset($GLOBALS['REQAR'][1]) && !is_numeric($GLOBALS['REQAR'][1])) {
    header('Location: /404/');
    exit(0);
}
$id_supplier = $GLOBALS['REQAR'][1];
$Supplier = new Suppliers();
$Supplier->SetFieldsById($id_supplier);
$tpl->Assign("supplier", $Supplier->fields);
if (!count($Supplier->fields)) {
    header('Location: /404/');
    exit(0);
}
$Products = new Products();
$Products->SetProductsList(array('a.id_supplier' => $Supplier->fields['id_user'], 'p.visible' => 1), '', array('GROUP_BY' => 'p.id_product'));
$Products->FillAssort($id_supplier);
$tpl->Assign('list', $Products->list);
$Products->SetExclusivList($id_supplier);
$tpl->Assign('exclusiv_list', $Products->list);
$tpl->Assign('id_supplier', $id_supplier);
if (!isset($_POST['smb'])) {
    foreach ($Supplier->fields as $k => $v) {
        $_POST[$k] = $v;
    }
}
$parsed_res = array('issuccess' => true, 'html' => $tpl->Parse($GLOBALS['PATH_tpl'] . 'cp_supplier_cab_admin.tpl'));
if (true == $parsed_res['issuccess']) {
    $tpl_center .= $parsed_res['html'];
}
Exemple #2
0
    }
}
if (isset($_POST['smb']) && isset($_POST['supl'])) {
    $Products->SetProductsList1($_POST['supl']);
    list($r, $cats_cols) = $Products->GetExportRows($Products->list);
    // Формирование заголовка
    $h = array('Артикул');
    for ($ii = 0; $ii < $cats_cols; $ii++) {
        $h[] = "Категория {$ii}";
    }
    $h = array_merge($h, array('Название', 'Сертификат', 'Фото 1', 'Фото 2', 'Фото 3', 'Макс кол-во поставщиков', 'Коэф опт', 'Коэф мелк опт', 'Описание', 'Страна', 'Кол-во в ящ', 'Минимальное количество по мелкому опту', 'Кратность', 'Видимость', 'транслит', 'Вес', 'Объем', 'Обяз прим', 'Ед. измерения'));
    $Products->GenExcelFile($h, $r, $cats_cols);
    exit(0);
}
$orderby = " sort ASC, ord ASC, name ASC";
$Products->SetProductsList(array('cp.id_category' => $id_category), null, array('order_by' => $orderby, 'administration' => '1'));
$arr = $dbtree->GetNodeFields($id_category, array('name', 'category_level'));
// --- --- --- subcats
$l = $arr['category_level'] + 1;
$tpl->Assign('subcats', $dbtree->GetSubCats($id_category, array('id_category', 'name', 'translit', 'art', 'category_level')));
// === === === subcats
$tpl->Assign('list', $Products->list);
$tpl->Assign('catname', $arr['name']);
$tpl->Assign('id_category', $id_category);
$parsed_res = array('issuccess' => true, 'html' => $tpl->Parse($GLOBALS['PATH_tpl'] . 'cp_products.tpl'));
$res = $dbtree->Parents($id_category, array('id_category', 'name', 'category_level'));
$ii = count($GLOBALS['IERA_LINKS']);
foreach ($res as $cat) {
    if ($cat['category_level'] > 0) {
        $GLOBALS['IERA_LINKS'][$ii]['title'] = $cat['name'];
        $GLOBALS['IERA_LINKS'][$ii++]['url'] = $GLOBALS['URL_base'] . 'adm/products/' . $cat['id_category'];
Exemple #3
0
                 $str = selectAll($dbtree, $val["id_category"], $str);
             }
         }
         return $str;
     }
     $where_arr['cp.id_category'] = $id_category;
     if (!_acl::isAdmin()) {
         $where_arr['p.visible'] = 1;
     }
     $params = array('group_by' => 'a.id_product', 'ajax' => true, 'rel_search' => null);
     if (isset($_COOKIE['sorting'])) {
         $sort = json_decode($_COOKIE['sorting'], true);
         $sorting = $sort['products'];
         $params['order_by'] = $sorting['value'];
     }
     $Products->SetProductsList($where_arr, ' LIMIT ' . ($_POST['skipped_products'] + $_POST['shown_products']) . ', 30', $params);
     if ($Products->list) {
         foreach ($Products->list as &$p) {
             $p['images'] = $Products->GetPhotoById($p['id_product']);
         }
     }
     $tpl->Assign('list', $Products->list);
     $i = $_POST['shown_products'] + 1;
     $products_list = $tpl->Parse($GLOBALS['PATH_tpl_global'] . 'products_list.tpl');
     echo $products_list;
     break;
 case "getproductscount":
     $id_category = isset($_POST['id_category']) ? $_POST['id_category'] : null;
     $dbtree = new dbtree(_DB_PREFIX_ . 'category', 'category', $db);
     function selectAll($dbtree, $id_category = null, $str = array())
     {
Exemple #4
0
     $_SESSION['warnings'] = $warnings;
 }
 if (!empty($_SESSION['cart']['unvisible_products'])) {
     foreach ($_SESSION['cart']['unvisible_products'] as $k => &$v) {
         $Cart->UpdateCartQty(array('id_product' => $k, 'quantity' => $v['quantity']));
     }
     unset($_SESSION['cart']['unvisible_products']);
 }
 /* collect cart information */
 $Cart->RecalcCart();
 /* fill product list */
 if (!empty($_SESSION['cart']['products'])) {
     foreach ($_SESSION['cart']['products'] as $id => $p) {
         $where_arr['p.id_product'][] = $id;
     }
     $Products->SetProductsList($where_arr);
     if ($Products->list) {
         foreach ($Products->list as &$p) {
             $p['images'] = $Products->GetPhotoById($p['id_product']);
         }
     }
     $list = $Products->list;
     foreach ($list as $key => &$value) {
         if ($value['visible'] == 0 || $value['active'] == 0 || $value['price_' . $_SESSION['cart']['products'][$value['id_product']]['mode']] == 0) {
             $_SESSION['cart']['unvisible_products'][$value['id_product']]['quantity'] = $_SESSION['cart']['products'][$value['id_product']]['quantity'];
             $unlist[] = $value;
             unset($list[$key], $_SESSION['cart']['products'][$value['id_product']]);
         }
         if (isset($_SESSION['errm']['products'][$value['id_product']])) {
             $value['err'] = 1;
             $value['errm'] = $_SESSION['errm']['products'][$value['id_product']];