Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gallery SQL #4

Open
Genaker opened this issue Oct 12, 2021 · 0 comments
Open

Gallery SQL #4

Genaker opened this issue Oct 12, 2021 · 0 comments

Comments

@Genaker
Copy link
Owner

Genaker commented Oct 12, 2021

SQL to select Gallery stuff for MAgento 2

SELECT main.value_id, main.value AS file, main.media_type, entity.row_id, IFNULL(value.label, default_value.label) AS label, IFNULL(value.position, default_value.position) AS position, IFNULL(value.disabled, default_value.disabled) AS disabled, default_value.label AS label_default, default_value.position AS position_default, default_value.disabled AS disabled_default, IFNULL(value_video.provider, default_value_video.provider) AS video_provider, IFNULL(value_video.url, default_value_video.url) AS video_url, IFNULL(value_video.title, default_value_video.title) AS video_title, IFNULL(value_video.description, default_value_video.description) AS video_description, IFNULL(value_video.metadata, default_value_video.metadata) AS video_metadata, default_value_video.provider AS video_provider_default, default_value_video.url AS video_url_default, default_value_video.title AS video_title_default, default_value_video.description AS video_description_default, default_value_video.metadata AS video_metadata_default FROM catalog_product_entity_media_gallery AS main INNER JOIN catalog_product_entity_media_gallery_value_to_entity AS entity ON main.value_id = entity.value_id LEFT JOIN catalog_product_entity_media_gallery_value AS value ON main.value_id = value.value_id AND value.store_id = 1 AND value.row_id = entity.row_id LEFT JOIN catalog_product_entity_media_gallery_value AS default_value ON main.value_id = default_value.value_id AND default_value.store_id = 0 AND default_value.row_id = entity.row_id LEFT JOIN catalog_product_entity_media_gallery_value_video AS value_video ON value.value_id = value_video.value_id AND value.store_id = value_video.store_id LEFT JOIN catalog_product_entity_media_gallery_value_video AS default_value_video ON default_value.value_id = default_value_video.value_id AND default_value.store_id = default_value_video.store_id WHERE (main.attribute_id = '88') AND (main.disabled = 0) AND (entity.row_id = '81983') ORDER BY IF(value.position IS NULL, default_value.position, value.position)

SELECT main.value_id, main.value AS file, main.media_type, entity.row_id, IFNULL(value.label, default_value.label) AS label, IFNULL(value.position, default_value.position) AS position, IFNULL(value.disabled, default_value.disabled) AS disabled, default_value.label AS label_default, default_value.position AS position_default, default_value.disabled AS disabled_default, IFNULL(value_video.provider, default_value_video.provider) AS video_provider, IFNULL(value_video.url, default_value_video.url) AS video_url, IFNULL(value_video.title, default_value_video.title) AS video_title, IFNULL(value_video.description, default_value_video.description) AS video_description, IFNULL(value_video.metadata, default_value_video.metadata) AS video_metadata, default_value_video.provider AS video_provider_default, default_value_video.url AS video_url_default, default_value_video.title AS video_title_default, default_value_video.description AS video_description_default, default_value_video.metadata AS video_metadata_default FROM catalog_product_entity_media_gallery AS main

  | INNER JOIN catalog_product_entity_media_gallery_value_to_entity AS entity ON main.value_id = entity.value_id
  | LEFT JOIN catalog_product_entity_media_gallery_value AS value ON main.value_id = value.value_id AND value.store_id = 1 AND value.row_id = entity.row_id
  | LEFT JOIN catalog_product_entity_media_gallery_value AS default_value ON main.value_id = default_value.value_id AND default_value.store_id = 0 AND default_value.row_id = entity.row_id
  | LEFT JOIN catalog_product_entity_media_gallery_value_video AS value_video ON value.value_id = value_video.value_id AND value.store_id = value_video.store_id
  | LEFT JOIN catalog_product_entity_media_gallery_value_video AS default_value_video ON default_value.value_id = default_value_video.value_id AND default_value.store_id = default_value_video.store_id WHERE (main.attribute_id = '88') AND (main.disabled = 0) AND (entity.row_id = '81983') ORDER BY IF(value.position IS NULL, default_value.position, value.position) ASC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant