Skip to content
This repository was archived by the owner on Jun 11, 2024. It is now read-only.

Filter product videos by 'default' attribute #401

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,14 @@ public function execute(array $indexData, int $storeId): array

$valueId = $mediaImage['value_id'];

if (isset($videoSet[$valueId])) {
$image['vid'] = $this->prepareVideoData($videoSet[$valueId]);
if (isset($videoSet[$valueId]) && isset($videoSet[$valueId]['url']) && is_string($videoSet[$valueId]['url'])) {
if($videoSet[$valueId]['disabled'] === "0"){
$image['vid'] = $this->prepareVideoData($videoSet[$valueId]);
$indexData[$entityId]['media_gallery'][] = $image;
}
} else{
$indexData[$entityId]['media_gallery'][] = $image;
}

$indexData[$entityId]['media_gallery'][] = $image;
}

$this->rowIdToEntityId = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,17 @@ private function getVideoRawData(array $valueIds, $storeId)
),
$this->videoProperties
);
$select->joinLeft(
['cpemgv' => 'catalog_product_entity_media_gallery_value'],
implode(
' AND ',
[
'cpemgv.value_id = value.value_id',
$this->getConnection()->quoteInto('cpemgv.store_id = ?', (int)$storeId),
]
),
['cpemgv.disabled']
);

return $connection->fetchAll($select);
}
Expand Down