In Magento 2, Set base image as small image
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
add a comment |
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
You want to set small image which is already set in base image?
– Rohan Hapani
Nov 23 '18 at 12:23
I want to set a base image which is already set in the small image.
– Akash
Nov 23 '18 at 12:52
add a comment |
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
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
magento2 product-images
asked Nov 23 '18 at 11:52
AkashAkash
613220
613220
You want to set small image which is already set in base image?
– Rohan Hapani
Nov 23 '18 at 12:23
I want to set a base image which is already set in the small image.
– Akash
Nov 23 '18 at 12:52
add a comment |
You want to set small image which is already set in base image?
– Rohan Hapani
Nov 23 '18 at 12:23
I want to set a base image which is already set in the small image.
– Akash
Nov 23 '18 at 12:52
You want to set small image which is already set in base image?
– Rohan Hapani
Nov 23 '18 at 12:23
You want to set small image which is already set in base image?
– Rohan Hapani
Nov 23 '18 at 12:23
I want to set a base image which is already set in the small image.
– Akash
Nov 23 '18 at 12:52
I want to set a base image which is already set in the small image.
– Akash
Nov 23 '18 at 12:52
add a comment |
2 Answers
2
active
oldest
votes
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
add a comment |
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.
Image Url does not generate When I import via CSV file.I have done this
– Akash
Nov 23 '18 at 12:13
add a comment |
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',
autoActivateHeartbeat: false,
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
add a comment |
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
add a comment |
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
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
answered Nov 23 '18 at 12:15
HiteshHitesh
1,2931423
1,2931423
add a comment |
add a comment |
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.
Image Url does not generate When I import via CSV file.I have done this
– Akash
Nov 23 '18 at 12:13
add a comment |
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.
Image Url does not generate When I import via CSV file.I have done this
– Akash
Nov 23 '18 at 12:13
add a comment |
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.
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.
answered Nov 23 '18 at 12:10
Sunny RahevarSunny Rahevar
1,069112
1,069112
Image Url does not generate When I import via CSV file.I have done this
– Akash
Nov 23 '18 at 12:13
add a comment |
Image Url does not generate When I import via CSV file.I have done this
– Akash
Nov 23 '18 at 12:13
Image Url does not generate When I import via CSV file.I have done this
– Akash
Nov 23 '18 at 12:13
Image Url does not generate When I import via CSV file.I have done this
– Akash
Nov 23 '18 at 12:13
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
You want to set small image which is already set in base image?
– Rohan Hapani
Nov 23 '18 at 12:23
I want to set a base image which is already set in the small image.
– Akash
Nov 23 '18 at 12:52