我有这个查询,它不是我写的,我不是很擅长PHP和Magento,我的一个客户在一些产品中有几个图像,比方说,有14个图像,但有一半被排除在外,他们不想显示它们。所以我的查询返回每个产品的所有图片。您可以看到以下代码:
$_mediaGalleryData = $_read->fetchAll('SELECT
main.entity_id, `main`.`value_id`, `main`.`value` AS `file`,
`value`.`label`, `value`.`position`, `value`.`disabled`, `value`.`label` AS `label_default`,
`value`.`position` AS `position_default`,
`value`.`disabled` AS `disabled_default`
FROM `catalog_product_entity_media_gallery` AS `main`
INNER JOIN `catalog_product_entity_media_gallery_value` AS `value`
ON main.value_id=value.value_id AND value.store_id=' . $store_id . '
WHERE (
value.disabled = 0
AND main.attribute_id = ' . $_read->quote($_mediaGalleryAttributeId) . ')
AND (main.entity_id IN (' . $_read->quote($collection->getAllIds()) . '))
ORDER BY IF(value.position IS NULL, value.position, value.position) ASC
');
但我仍然在这个查询中得到排除的图像。我做错了吗?