Skip to content

Commit

Permalink
Prevent missing sub-product data in index
Browse files Browse the repository at this point in the history
  • Loading branch information
aimeos committed Jan 13, 2017
1 parent 6a9c195 commit 05180c2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/mshoplib/src/MShop/Index/Manager/Standard.php
Expand Up @@ -711,7 +711,6 @@ protected function saveSubProducts( array $items )
$manager = \Aimeos\MShop\Factory::createManager( $context, 'product' );
$search = $manager->createSearch( true );
$search->setSortations( array( $search->sort( '+', 'product.id' ) ) );
$search->setSlice( 0, $size );
$defaultConditions = $search->getConditions();

$prodList = array();
Expand All @@ -733,7 +732,7 @@ protected function saveSubProducts( array $items )
);
$search->setConditions( $search->combine( '&&', $expr ) );

$this->saveSubProductsChunk( $search, $domains, $prodList, $size );
$this->saveSubProductsChunk( $search, $domains, $prodList, count( $prodList ) );

$prodList = array();
$numSubProducts = 0;
Expand All @@ -748,7 +747,7 @@ protected function saveSubProducts( array $items )
);
$search->setConditions( $search->combine( '&&', $expr ) );

$this->saveSubProductsChunk( $search, $domains, $prodList, $size );
$this->saveSubProductsChunk( $search, $domains, $prodList, count( $prodList ) );
}
}

Expand Down Expand Up @@ -779,6 +778,7 @@ protected function saveSubProductsChunk( \Aimeos\MW\Criteria\Iface $search, arra
do
{
$items = array();
$search->setSlice( $start, $size );
$result = $manager->searchItems( $search, $domains );

if( !empty( $result ) )
Expand Down Expand Up @@ -809,7 +809,6 @@ protected function saveSubProductsChunk( \Aimeos\MW\Criteria\Iface $search, arra

$count = count( $result );
$start += $count;
$search->setSlice( $start, $size );
}
while( $count == $size );
}
Expand Down

0 comments on commit 05180c2

Please sign in to comment.