Working with warehouses and quantity of goods in Bitrix D7
Работа со складами и количеством товаров в Битрикс D7

All English-language materials have been translated fully automatically using the Google service

Selecting a warehouse by ID in Bitrix via D7

$arStore = \Bitrix\Catalog\StoreTable::getById($ID)->fetch();

Selection of active warehouses:

// Selection of all active warehouses:
$rsStore = \Bitrix\Catalog\StoreTable::getList(array(
	'filter' => array('ACTIVE'>='Y'),


To select all fields, including custom ones, add to the query the construction 'select' => array ('*', 'UF_ *') :

$arStore = \Bitrix\Catalog\StoreTable::getList(array(

Add caching to the selection of warehouses

$cntIBLOCK_List = 'Stores';
$cache = new CPHPCache();
$cache_time = 3600*24*360; //кеш на год
$cache_id = 'arIBlockListID'.$cntIBLOCK_List;
$cache_path = 'arIBlockListID';
if ($cache_time > 0 && $cache->InitCache($cache_time, $cache_id, $cache_path))
	$res = $cache->GetVars();
	if (is_array($res["arIBlockListID"]) && (count($res["arIBlockListID"]) > 0)){
		$arIBlockListID = $res["arIBlockListID"];

if (!is_array($arIBlockListID))
	//Выборка всех активных складов:
	$rsStore = \Bitrix\Catalog\StoreTable::getList(array(
		'filter' => array('ACTIVE'>='Y'),


	//////////// end cache /////////
	if ($cache_time > 0)
		$cache->StartDataCache($cache_time, $cache_id, $cache_path);

If you are using Aspro store, you can use the built-in function:

$arStores=CNextCache::CCatalogStore_GetList(array(), array("ACTIVE" => "Y"), false, false, array());

Get all information about the product, including the quantity (deprecated method):


Fetching the quantity of a product with an identifier in $ productId in all active warehouses:

$rsStoreProduct = \Bitrix\Catalog\StoreProductTable::getList(array(
	'filter' => array('=PRODUCT_ID'=>$arResult["ID"],'STORE.ACTIVE'=>'Y'),
	'select' => array('*','UF_*'),

	$amount[$arStoreProduct['STORE_ID']] = $arStoreProduct;

Selecting the quantity of goods with the identifier in $ productId in all active warehouses (additionally, select the warehouse name):

$rsStoreProduct = \Bitrix\Catalog\StoreProductTable::getList(array(
    'filter' => array('=PRODUCT_ID'=>$productId,'STORE.ACTIVE'=>'Y'),
    'select' => array('AMOUNT','STORE_ID','STORE_TITLE' => 'STORE.TITLE'),


Fetching the quantity of goods with an identifier in $ productId in a warehouse with an identifier in $ storeId (additionally select the name of the warehouse and the name of the product):

$rsStoreProduct = \Bitrix\Catalog\StoreProductTable::getList(array(
    'filter' => array('=PRODUCT_ID'=>$productId,'=STORE_ID'=>$storeId),
    'limit' => 1,


& nbsp;

Site materials used:


There are no comments yet, you can be the first to leave it

Leave a comment

The site uses a comment pre-moderation system, so your message will be published only after approval by the moderator

You are replying to a user's comment



Email me

Are you developing a new service, making improvements to the existing one and want to be better than your competitors? You have come to the right place. I offer you a comprehensive studio-level website development. From me you can order design, layout, programming, development of non-traditional functionality, implementation of communication between CMS, CRM and Data Analitics, as well as everything else related to sites, except for promotion.

Contact, I will always advise on all questions and help you find the most effective solution for your business. I am engaged in the creation of sites in Novosibirsk and in other regions of Russia, I also work with the CIS countries. You will be satisfied with our cooperation

An error occurred while sending, please try again after a while
Message sent successfully


+7(993) 007-18-96



Россия, г. Москва

By submitting the form, you automatically confirm that you have read and accept the Privacy Policy site

Contact with me
Send message
By submitting the form, you automatically confirm that you have read and accept Privacy policy of site
Sending successful!
Thank you for contacting :) I will contact you as soon as possible
Sending failed
An error occurred while sending the request. Please wait and try again after a while or call my phone number