In Magento 2, Set base image as small image





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty{ margin-bottom:0;
}






up vote
1
down vote

favorite












I have nearly 40k products and all images have been set to small only. If I go into the backend and then set each image one by one to the base, it will take me forever. Is there any way to do it via the database?










share|improve this question






















  • You want to set small image which is already set in base image?
    – Rohan Hapani
    Nov 23 at 12:23










  • I want to set a base image which is already set in the small image.
    – Akash Patel
    Nov 23 at 12:52

















up vote
1
down vote

favorite












I have nearly 40k products and all images have been set to small only. If I go into the backend and then set each image one by one to the base, it will take me forever. Is there any way to do it via the database?










share|improve this question






















  • You want to set small image which is already set in base image?
    – Rohan Hapani
    Nov 23 at 12:23










  • I want to set a base image which is already set in the small image.
    – Akash Patel
    Nov 23 at 12:52













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I have nearly 40k products and all images have been set to small only. If I go into the backend and then set each image one by one to the base, it will take me forever. Is there any way to do it via the database?










share|improve this question













I have nearly 40k products and all images have been set to small only. If I go into the backend and then set each image one by one to the base, it will take me forever. Is there any way to do it via the database?







magento2 product-images






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 23 at 11:52









Akash Patel

52416




52416












  • You want to set small image which is already set in base image?
    – Rohan Hapani
    Nov 23 at 12:23










  • I want to set a base image which is already set in the small image.
    – Akash Patel
    Nov 23 at 12:52


















  • You want to set small image which is already set in base image?
    – Rohan Hapani
    Nov 23 at 12:23










  • I want to set a base image which is already set in the small image.
    – Akash Patel
    Nov 23 at 12:52
















You want to set small image which is already set in base image?
– Rohan Hapani
Nov 23 at 12:23




You want to set small image which is already set in base image?
– Rohan Hapani
Nov 23 at 12:23












I want to set a base image which is already set in the small image.
– Akash Patel
Nov 23 at 12:52




I want to set a base image which is already set in the small image.
– Akash Patel
Nov 23 at 12:52










2 Answers
2






active

oldest

votes

















up vote
2
down vote



accepted










If you want to do by MySQL way follow below way



First, run below query to know the query is actually working and you will get a list of images



select  ev.value, mg.value from catalog_product_entity_media_gallery AS mg,
catalog_product_entity_media_gallery_value AS mgv,
catalog_product_entity_varchar AS ev
WHERE mg.value_id = mgv.value_id
AND mgv.entity_id = ev.entity_id
AND ev.attribute_id IN (87, 88, 89)
AND mgv.position = 1;


After that run below query to update small image path with a thumbnail image



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 mgv.entity_id = ev.entity_id
AND ev.attribute_id IN (87, 88, 89)
AND mgv.position = 1;


You should run first in test ENV, after making sure you can run on other ENV.



Hope It will solve your issue






share|improve this answer





















  • It's working. Thanks
    – Akash Patel
    Nov 23 at 12:35


















up vote
0
down vote













You can use the CSV.
Please add two more column 'base_image' and 'thumbnail_image' in the csv file and re import all the products.Then after reindex the process.






share|improve this answer





















  • Image Url does not generate When I import via CSV file.I have done this
    – Akash Patel
    Nov 23 at 12:13











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f251081%2fin-magento-2-set-base-image-as-small-image%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
2
down vote



accepted










If you want to do by MySQL way follow below way



First, run below query to know the query is actually working and you will get a list of images



select  ev.value, mg.value from catalog_product_entity_media_gallery AS mg,
catalog_product_entity_media_gallery_value AS mgv,
catalog_product_entity_varchar AS ev
WHERE mg.value_id = mgv.value_id
AND mgv.entity_id = ev.entity_id
AND ev.attribute_id IN (87, 88, 89)
AND mgv.position = 1;


After that run below query to update small image path with a thumbnail image



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 mgv.entity_id = ev.entity_id
AND ev.attribute_id IN (87, 88, 89)
AND mgv.position = 1;


You should run first in test ENV, after making sure you can run on other ENV.



Hope It will solve your issue






share|improve this answer





















  • It's working. Thanks
    – Akash Patel
    Nov 23 at 12:35















up vote
2
down vote



accepted










If you want to do by MySQL way follow below way



First, run below query to know the query is actually working and you will get a list of images



select  ev.value, mg.value from catalog_product_entity_media_gallery AS mg,
catalog_product_entity_media_gallery_value AS mgv,
catalog_product_entity_varchar AS ev
WHERE mg.value_id = mgv.value_id
AND mgv.entity_id = ev.entity_id
AND ev.attribute_id IN (87, 88, 89)
AND mgv.position = 1;


After that run below query to update small image path with a thumbnail image



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 mgv.entity_id = ev.entity_id
AND ev.attribute_id IN (87, 88, 89)
AND mgv.position = 1;


You should run first in test ENV, after making sure you can run on other ENV.



Hope It will solve your issue






share|improve this answer





















  • It's working. Thanks
    – Akash Patel
    Nov 23 at 12:35













up vote
2
down vote



accepted







up vote
2
down vote



accepted






If you want to do by MySQL way follow below way



First, run below query to know the query is actually working and you will get a list of images



select  ev.value, mg.value from catalog_product_entity_media_gallery AS mg,
catalog_product_entity_media_gallery_value AS mgv,
catalog_product_entity_varchar AS ev
WHERE mg.value_id = mgv.value_id
AND mgv.entity_id = ev.entity_id
AND ev.attribute_id IN (87, 88, 89)
AND mgv.position = 1;


After that run below query to update small image path with a thumbnail image



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 mgv.entity_id = ev.entity_id
AND ev.attribute_id IN (87, 88, 89)
AND mgv.position = 1;


You should run first in test ENV, after making sure you can run on other ENV.



Hope It will solve your issue






share|improve this answer












If you want to do by MySQL way follow below way



First, run below query to know the query is actually working and you will get a list of images



select  ev.value, mg.value from catalog_product_entity_media_gallery AS mg,
catalog_product_entity_media_gallery_value AS mgv,
catalog_product_entity_varchar AS ev
WHERE mg.value_id = mgv.value_id
AND mgv.entity_id = ev.entity_id
AND ev.attribute_id IN (87, 88, 89)
AND mgv.position = 1;


After that run below query to update small image path with a thumbnail image



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 mgv.entity_id = ev.entity_id
AND ev.attribute_id IN (87, 88, 89)
AND mgv.position = 1;


You should run first in test ENV, after making sure you can run on other ENV.



Hope It will solve your issue







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 23 at 12:15









Hitesh

1,2941423




1,2941423












  • It's working. Thanks
    – Akash Patel
    Nov 23 at 12:35


















  • It's working. Thanks
    – Akash Patel
    Nov 23 at 12:35
















It's working. Thanks
– Akash Patel
Nov 23 at 12:35




It's working. Thanks
– Akash Patel
Nov 23 at 12:35












up vote
0
down vote













You can use the CSV.
Please add two more column 'base_image' and 'thumbnail_image' in the csv file and re import all the products.Then after reindex the process.






share|improve this answer





















  • Image Url does not generate When I import via CSV file.I have done this
    – Akash Patel
    Nov 23 at 12:13















up vote
0
down vote













You can use the CSV.
Please add two more column 'base_image' and 'thumbnail_image' in the csv file and re import all the products.Then after reindex the process.






share|improve this answer





















  • Image Url does not generate When I import via CSV file.I have done this
    – Akash Patel
    Nov 23 at 12:13













up vote
0
down vote










up vote
0
down vote









You can use the CSV.
Please add two more column 'base_image' and 'thumbnail_image' in the csv file and re import all the products.Then after reindex the process.






share|improve this answer












You can use the CSV.
Please add two more column 'base_image' and 'thumbnail_image' in the csv file and re import all the products.Then after reindex the process.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 23 at 12:10









Sunny Rahevar

894112




894112












  • Image Url does not generate When I import via CSV file.I have done this
    – Akash Patel
    Nov 23 at 12:13


















  • Image Url does not generate When I import via CSV file.I have done this
    – Akash Patel
    Nov 23 at 12:13
















Image Url does not generate When I import via CSV file.I have done this
– Akash Patel
Nov 23 at 12:13




Image Url does not generate When I import via CSV file.I have done this
– Akash Patel
Nov 23 at 12:13


















draft saved

draft discarded




















































Thanks for contributing an answer to Magento Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f251081%2fin-magento-2-set-base-image-as-small-image%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

ComboBox Display Member on multiple fields

Is it possible to collect Nectar points via Trainline?