--------------------------------------------------------------------------------
Copy Base Image To Thumbnail Image
--------------------------------------------------------------------------------
UPDATE catalog_product_entity_varchar AS ev,
catalog_product_entity_varchar AS ev2
SET ev.value = ev2.value
WHERE ev.entity_id = ev2.entity_id
AND ev.attribute_id =
(
SELECT `attribute_id`
from eav_attribute a
WHERE attribute_code = 'thumbnail'
AND entity_type_id =
(
SELECT `entity_type_id`
FROM eav_entity_type e
WHERE entity_type_code = "catalog_product"
))
AND ev.value = 'no_selection'
AND ev2.attribute_id =
(
SELECT `attribute_id`
FROM eav_attribute a
WHERE attribute_code = 'image'
AND entity_type_id =(SELECT `entity_type_id`
FROM eav_entity_type e
WHERE entity_type_code = "catalog_product"));
--------------------------------------------------------------------------------
Compare Base Image And Small Image
--------------------------------------------------------------------------------
SELECT `entity_id`
FROM `catalog_product_entity_varchar`
WHERE `attribute_id` = (
SELECT `attribute_id`
FROM eav_attribute a
WHERE attribute_code = 'image'
AND entity_type_id =(SELECT `entity_type_id`
FROM eav_entity_type e
WHERE entity_type_code = "catalog_product"))
AND `entity_id` NOT IN (SELECT `entity_id`
FROM `catalog_product_entity_varchar`
WHERE `attribute_id` = (
SELECT `attribute_id`
from eav_attribute a
WHERE attribute_code = 'thumbnail'
AND entity_type_id =
(
SELECT `entity_type_id`
FROM eav_entity_type e
WHERE entity_type_code = "catalog_product"
)));
--------------------------------------------------------------------------------
Copy Base Image To Thumbnail Image
--------------------------------------------------------------------------------
UPDATE catalog_product_entity_varchar AS ev,
catalog_product_entity_varchar AS ev2
SET ev.value = ev2.value
WHERE ev.entity_id = ev2.entity_id
AND ev.attribute_id =
(
SELECT `attribute_id`
from eav_attribute a
WHERE attribute_code = 'thumbnail'
AND entity_type_id =
(
SELECT `entity_type_id`
FROM eav_entity_type e
WHERE entity_type_code = "catalog_product"
))
AND ev.value = 'no_selection'
AND ev2.attribute_id =
(
SELECT `attribute_id`
FROM eav_attribute a
WHERE attribute_code = 'image'
AND entity_type_id =(SELECT `entity_type_id`
FROM eav_entity_type e
WHERE entity_type_code = "catalog_product"));
--------------------------------------------------------------------------------
Compare Base Image And Small Image
--------------------------------------------------------------------------------
SELECT `entity_id`
FROM `catalog_product_entity_varchar`
WHERE `attribute_id` = (
SELECT `attribute_id`
FROM eav_attribute a
WHERE attribute_code = 'image'
AND entity_type_id =(SELECT `entity_type_id`
FROM eav_entity_type e
WHERE entity_type_code = "catalog_product"))
AND `entity_id` NOT IN (SELECT `entity_id`
FROM `catalog_product_entity_varchar`
WHERE `attribute_id` = (
SELECT `attribute_id`
from eav_attribute a
WHERE attribute_code = 'thumbnail'
AND entity_type_id =
(
SELECT `entity_type_id`
FROM eav_entity_type e
WHERE entity_type_code = "catalog_product"
)));
--------------------------------------------------------------------------------
Comments
Post a Comment