There is a website on 1C-Bitrix .. You need to make a request to the database for all products .. To request issued: the name of the goods, the number of warehouses for a particular client, the price for a specific group of clients ..

The request should be made on the client's ID .. I simply cannot imagine how to do this .. There is a class https://dev.1c-bitrix.ru/api_help/catalog/classes/ccatalogstoreproduct/index.php but how to use it until the end I do not understand ..

  • one
    I don’t understand how you are trying to use it and what your problem is. In the subject of the question, you specify a request to 1C and in the content a reference to the bitrix method. decide what will appeal. - Nikolaj Sarry
  • I say that I don’t know how to do it ... I wrote it here so that at least a little bit of it was sent on the right path - Maus Kopul
  • So where are you going to send the request? To the site database or database 1C? 1C-Bitrix and 1C are completely different things. - Nikolaj Sarry
  • Well, the same question is why. what you want to do with a separate database request, if the components are already able to output it to the user. The purpose of your actions is not completely clear and what result you want to get. - Nikolaj Sarry
  • explain what you want to do next with the result of the sample. and who is a "client"? How is it related to the goods? It seemed that you are talking about the supplier? - Sergey V.

1 answer 1

//Формируем массив данных $products = array(); $StoreArray = array(); $arGroups = CUser::GetUserGroup($USER->GetID());//Группа покупателя $userID = $USER->GetID();//Айди клиента $rsUser = CUser::GetByID($userID);//Массив с данными клиента $arUser = $rsUser->Fetch(); // Выборка данных с массива о клиенте $arrayStoreUser = $arUser["UF_STORE"]; // Массив доп поля //Выобрка товаров $arSelect = Array("ID", "NAME", "DATE_ACTIVE_FROM", "SECTION_ID", 'IBLOCK_ID'); $arFilter = Array( "IBLOCK_ID"=>10, "SECTION_ID"=>array(305,329,350,351,363,378,410,417,437), /// Это массив для разделов "INCLUDE_SUBSECTIONS"=>"Y" // тут указали выбор подразделов ); $res = CIBlockElement::GetList(Array(), $arFilter, false, Array(), $arSelect); $var = 0; while($ob = $res->GetNextElement()) { $arFields = $ob->GetFields(); $rsStore = CCatalogStoreProduct::GetList(array(), array('PRODUCT_ID' => $arFields['ID'], 'STORE_ID' => $arrayStoreUser), false, false, array('AMOUNT')); //Количество товара по складу $rsStoreProduct = \Bitrix\Catalog\StoreProductTable::getList(array( 'filter' => array('=PRODUCT_ID'=>$arFields['ID'],'STORE_ID'=>$arrayStoreUser), 'select' => array('AMOUNT','STORE_TITLE' => 'STORE.TITLE','STORE_ID','PRODUCT_NAME' => 'PRODUCT.IBLOCK_ELEMENT.NAME') )); //Группа товара $groupProduct = CIBlockElement::GetByID($arFields['ID']); //Выборка цен для группы $db_res = CPrice::GetList( array(), array( "PRODUCT_ID" => $arFields['ID'], "CATALOG_GROUP_ID" => max($arGroups) ) ); if ($arStore = $rsStore->Fetch()) { $products[$arFields['ID']]["product_title"] = $arFields['NAME']; if ($ar_res = $db_res->Fetch()) { $products[$arFields['ID']]["PRICE"] = $ar_res['PRICE']; } else { $products[$arFields['ID']]["PRICE"] = "Цена не найдена!"; } //Выборка группы товара if($obRes = $groupProduct->GetNextElement()) { $array_Group = $obRes->GetGroups(); $nameGroup = $array_Group->Fetch(); $products[$arFields['ID']]['Group'] = $nameGroup['NAME']; } } while($arStoreProduct = $rsStoreProduct->fetch()) { // $products[$arFields['NAME']]['STORE_TITLE'. $var++] = $arStoreProduct['STORE_TITLE']; $products[$arFields['ID']]['AMOUNT' . $var++] = $arStoreProduct['AMOUNT']; $StoreArray[]= $arStoreProduct['STORE_TITLE']; } $resultArray = array_unique($StoreArray); }; 
  • Anyone interested solved this problem like this - Maus Kopul