Answer the question
In order to leave comments, you need to log in
How to display the quantity of certain goods in a particular warehouse?
Good day!
Please help me figure it out, I spent the whole night fiddling with the task, but I couldn’t implement it, although I saw a lot of similar posts on the Internet and already tried everything, but for some reason it didn’t work out :(
In general, I have 3 warehouses. Also my cart is filled with 4 items.The task is to display the quantity of each item in the cart in each of the warehouses.Something
like this: Warehouse_#1 :
- Item_#1:
Total stock #1 of these items #1: 1pc
- Item_#2: Total stock #1 of these items #2: 3pcs
- Item_#3: Total stock #1 of these items #3: 7pcs.
- Item_#4: Total stock #1 of these items #4: 0pcs.
Warehouse_#2:
- Product_#1: There are a total of 11 items in warehouse #2 of these products #1 .
- Item_#2: In total, there are 23 items in stock #2 of these items #2 .
- Product_No. 3: In total, there are 2 such products in warehouse No. 3: 2 pcs.
- Product_No. 4: In total, there are 31 items in warehouse No. 2 of such goods No. 4 .
I myself tried to do through requests:
CCatalogStoreProduct::GetList(array(), array("PRODUCT_ID" => $prod_id, , "STORE_ID" => $store_ID), false, false, array("SELECT" => "AMOUNT"));
\Bitrix\Catalog\StoreProductTable::getList(array('filter' => array('=PRODUCT_ID' >= 12391, '=STORE_ID' >= 2))));
Answer the question
In order to leave comments, you need to log in
I tried to use \Bitrix\Catalog\StoreProductTable::getList
Here is a table with data
Here is a query
CModule::IncludeModule("catalog");
$products = [537, 547];
$amount = \Bitrix\Catalog\StoreProductTable::getList([
'filter' => [
'PRODUCT_ID' => $products
]
])->fetchAll();
print_r($amount);
You can use the following:
CModule::IncludeModule('catalog');
$arFilter = Array("PRODUCT_ID"=>array(94247,162284));
$rsStoreAmount = CCatalogStoreProduct::GetList(Array(),$arFilter,false,false,Array());
while($arStoreAmount = $rsStoreAmount->Fetch())
{
echo "<pre>";
print_r($arStoreAmount);
echo "</pre>";
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question