When a bundle does not have a "Is Default" item, we keep hitting the "continue" line 798.
|
if (count($optionIds) > 1) { |
|
foreach ($selectionCollection as $selection) { |
|
if (!$selection->getIsDefault()) { |
|
continue; |
|
} |
|
$bundleOptions[$selection->getOptionId()][] = [ |
|
'product_id' => (int) $selection->getProductId(), |
|
'default_qty' => (int) $selection->getSelectionQty() |
|
]; |
|
} |
Then $bundleOptions ends up being an empty array.
That means that $quantities remains being an empty array.
|
$quantities = []; |
|
$bundleOptions = $this->getBundleOptionsProductIds($this->product); |
|
foreach ($bundleOptions as $option) { |
|
|
|
foreach ($option as $dataProduct) { |
|
$productId = $dataProduct['product_id']; |
|
$defaultQty = ($dataProduct['default_qty'] > 0) ? $dataProduct['default_qty'] : 1; |
|
$stockQty = $this->stockRegistry->getStockItem($productId, $this->store->getId())->getQty(); |
|
$quantities[$productId] = floor($stockQty / $defaultQty); |
|
} |
|
} |
|
return min($quantities) > 0 ? (int) min($quantities) : 0;; |
And finally the "min" line 766 crashes because it is not allowed.
min(): Argument #1 ($value) must contain at least one element
When a bundle does not have a "Is Default" item, we keep hitting the "continue" line 798.
plugin-magento2/Model/Export/Product.php
Lines 795 to 804 in b4c7416
Then $bundleOptions ends up being an empty array.
That means that $quantities remains being an empty array.
plugin-magento2/Model/Export/Product.php
Lines 755 to 766 in b4c7416
And finally the "min" line 766 crashes because it is not allowed.
min(): Argument #1 ($value) must contain at least one element