Skip to content

Instantly share code, notes, and snippets.

@brunoconstantino
Created February 26, 2019 02:09
Show Gist options
  • Save brunoconstantino/fa3b5f3012ad58c50649e554e40b343e to your computer and use it in GitHub Desktop.
Save brunoconstantino/fa3b5f3012ad58c50649e554e40b343e to your computer and use it in GitHub Desktop.
SQL Vínculo de Imagens Magento
/*
* Este UPDATE faz o vinculo da segunda imagem (mgv.position) com o atributo small_image (86)
* 85, 86, 87 -> base_image, small_image, thumbnail
* OS ID's variam de cada base Magento, verifique na tabela eav_attribute.
*/
UPDATE catalog_product_entity_media_gallery AS `mg`,
catalog_product_entity_media_gallery_value AS `mgv`,
catalog_product_entity_varchar AS `ev`
SET `ev`.`value` = `mg`.`value`
WHERE `mg`.`value_id` = `mgv`.`value_id`
AND `mg`.`entity_id` = `ev`.`entity_id`
AND `ev`.`attribute_id` IN (86)
AND `mgv`.`position` = 2;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment