Skip to content

Instantly share code, notes, and snippets.

@ScreamingDev
Last active December 21, 2015 20:59
Show Gist options
  • Select an option

  • Save ScreamingDev/6365372 to your computer and use it in GitHub Desktop.

Select an option

Save ScreamingDev/6365372 to your computer and use it in GitHub Desktop.
Magento: First image as Shop Image
# Find out the id to attribute_code "image" (here: 85)
# Find out the according entity_type_id (here: 4)
INSERT INTO catalog_product_entity_varchar (
entity_type_id,
attribute_id,
entity_id,
value
) (
SELECT
4 as entity_type_id,
85 as attribute_id,
entity_id,
value
FROM
catalog_product_entity_media_gallery
GROUP BY
entity_id
)
ON DUPLICATE KEY UPDATE
value=VALUES(value),
entity_type_id=VALUES(entity_type_id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment