@@ -94,8 +94,12 @@ public function addData($storeId, array $indexData)
9494 return $ indexData ;
9595 }
9696
97+
9798 $ websiteId = (int )$ this ->getStore ($ storeId )->getWebsiteId ();
98- $ minFinalPriceData = $ this ->getMinFinalPrice ($ configurableIds , $ websiteId );
99+ $ minFinalPriceData = $ this ->getMinFinalPrice ($ configurableIds , $ websiteId , true );
100+ if (empty ($ minFinalPriceData )) {
101+ $ minFinalPriceData = $ this ->getMinFinalPrice ($ configurableIds , $ websiteId , false );
102+ }
99103 if (empty ($ minFinalPriceData )) {
100104 return $ indexData ;
101105 }
@@ -120,10 +124,11 @@ public function addData($storeId, array $indexData)
120124 *
121125 * @param array $parentIds
122126 * @param int $websiteId
127+ * @param bool $inStock
123128 *
124129 * @return array
125130 */
126- protected function getMinFinalPrice (array $ parentIds , int $ websiteId ): array
131+ protected function getMinFinalPrice (array $ parentIds , int $ websiteId, bool $ inStock ): array
127132 {
128133 $ connection = $ this ->resource ->getConnection ();
129134 $ select = $ connection ->select ()->from (
@@ -139,7 +144,7 @@ protected function getMinFinalPrice(array $parentIds, int $websiteId): array
139144 []
140145 )->join (
141146 ['csi ' => $ connection ->getTableName ('cataloginventory_stock_item ' )],
142- 'csi.product_id = link.child_id AND csi.is_in_stock=1 ' ,
147+ 'csi.product_id = link.child_id AND csi.is_in_stock= ' . $ inStock ? ' 1 ' : ' 0 ' ,
143148 []
144149 )->columns ([
145150 new \Zend_Db_Expr ('t.customer_group_id ' ),
0 commit comments