171 if (empty(
$data) || empty(
$data[self::FLAT_AVAILABLE_QUANTITY_LIST]))
175 if (!is_array(
$data[self::FLAT_AVAILABLE_QUANTITY_LIST]))
182 $quantityByStore = [];
184 foreach ($products as $productId => $item)
186 $quantityByStore[$productId] = $this->distributeQuantityByStore($item[
'QUANTITY_LIST_BY_STORE'],
$data[self::FLAT_AVAILABLE_QUANTITY_LIST][$productId]);
190 self::STORE_AVAILABLE_QUANTITY_LIST => $quantityByStore
196 private function distributeQuantityByStore($needQuantityList, $availableQuantity) :
array
200 foreach ($needQuantityList as $quantityByStore)
202 foreach ($quantityByStore as $storeId => $quantity)
204 if (abs($quantity) < abs($availableQuantity))
207 $availableQuantity -= $quantity;
211 $result[$storeId] = $availableQuantity;
212 $availableQuantity = 0;
230 if (empty(
$data) || empty(
$data[self::SUMMMARY_PRODUCT_LIST]))
234 if (!is_array(
$data[self::SUMMMARY_PRODUCT_LIST]))
241 $summary =
$data[self::SUMMMARY_PRODUCT_LIST];
244 !empty($summary[self::FLAT_PRICE_LIST])
245 && is_array($summary[self::FLAT_PRICE_LIST])
247 ? $summary[self::FLAT_PRICE_LIST]
251 !empty($summary[self::FLAT_AVAILABLE_QUANTITY_LIST])
252 && is_array($summary[self::FLAT_AVAILABLE_QUANTITY_LIST])
259 self::SUMMMARY_PRODUCT_LIST => [
260 self::FLAT_PRICE_LIST => $priceList,
261 self::STORE_AVAILABLE_QUANTITY_LIST => $quantityList,
264 unset($quantityList, $priceList, $summary,
$data);
272 $storeId = static::getDefaultStoreId();
273 foreach (array_keys($quantityList) as $productId)
276 $storeId => $quantityList[$productId],
static getDefaultStoreId()
const STORE_QUANTITY_LIST
getFilledDefaultStore(array $quantityList)
getAvailableQuantityByStore(array $products)
isNeedShip(array $products)
static getDefaultStoreId()
getAvailableQuantityAndPrice(array $products)
__construct(array $context=array())
getProductListStores(array $products)
getAvailableQuantity(array $products)
getCatalogData(array $products)
const FLAT_AVAILABLE_QUANTITY_LIST
const STORE_AVAILABLE_QUANTITY_LIST
getAvailableQuantityAndPriceByStore(array $products)
tryUnship(array $products)
viewProduct(array $products)
const FLAT_RESERVED_QUANTITY_LIST
checkBarcode(array $items)
const SUMMMARY_PRODUCT_LIST
getBundleItems(array $products)
const STORE_RESERVED_QUANTITY_LIST
getProductData(array $products)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)