Skip to content

Commit

Permalink
optimize existing visibilities
Browse files Browse the repository at this point in the history
  • Loading branch information
garfix committed Jul 18, 2018
1 parent 6386268 commit ba2c7ae
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions Model/Resource/Storage/UrlRewriteStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,11 @@ public function updateRewritesByProductIds(array $productIds, array $storeViewId

$productCategoryIds = array_key_exists($productId, $allProductCategoryIds) ? $allProductCategoryIds[$productId] : [];

if (isset($allVisibilities[$productId][$storeViewId])) {
$visibility = $allVisibilities[$productId][$storeViewId];
} elseif (isset($allVisibilities[$productId][0])) {
$visibility = $allVisibilities[$productId][0];
if (isset($allVisibilities[$productId])) {
if ($allVisibilities[$productId] === ProductStoreView::VISIBILITY_NOT_VISIBLE) {
continue;
}
} else {
$visibility = null;
}

if ($visibility === null || $visibility === ProductStoreView::VISIBILITY_NOT_VISIBLE) {
continue;
}

Expand Down Expand Up @@ -201,11 +197,12 @@ protected function getExistingVisibilities(array $productIds)
FROM `{$this->metaData->productEntityTable}_int`
WHERE `entity_id` IN (" . $this->db->getMarks($productIds) . ") AND
attribute_id = ?
ORDER BY `store_id` ASC
", array_merge($productIds, [$attributeId]));

$visibilities = [];
foreach ($rows as $row) {
$visibilities[(int)$row['entity_id']][(int)$row['store_id']] = (int)$row['value'];
$visibilities[(int)$row['entity_id']] = (int)$row['value'];
}

return $visibilities;
Expand Down

0 comments on commit ba2c7ae

Please sign in to comment.