Magento 2: Update data for a custom product attribute

use bitnami_magento;

SELECT * FROM bitnami_magento.catalog_product_entity_varchar
where ( attribute_id = 73 ) -- and (value = '')
limit 10

replace into bitnami_magento.catalog_product_entity_varchar (attribute_id, store_id, entity_id, value )
SELECT 181, 0, product.entity_id, left(concat("https://www.amazon.com/s?k=", product.value),255)
FROM bitnami_magento.catalog_product_entity_varchar product
inner join catalog_product_entity_int status_t on ( status_t.entity_id = product.entity_id ) and ( status_t.attribute_id = 97 and status_t.value = 1 )
where (product.attribute_id=73) -- and (value = '') -- 73 = product name

SELECT * FROM bitnami_magento.catalog_product_entity_varchar
where ( attribute_id = 181 ) -- and (value = '')
order by value_id desc
limit 10

-- Update Uk Urls -----

use bitnami_magento;

SELECT * FROM bitnami_magento.catalog_product_entity_varchar
where ( attribute_id = 73 ) -- and (value = '')
limit 10

replace into bitnami_magento.catalog_product_entity_varchar (attribute_id, store_id, entity_id, value )
SELECT 180, 0, product.entity_id, left(concat("https://www.amazon.co.uk/s?k=", product.value), 255)
FROM bitnami_magento.catalog_product_entity_varchar product
inner join catalog_product_entity_int status_t on ( status_t.entity_id = product.entity_id ) and ( status_t.attribute_id = 97 and status_t.value = 1 )
where (product.attribute_id=73) -- and (value = '') -- 73 = product name

SELECT * FROM bitnami_magento.catalog_product_entity_varchar
where ( attribute_id = 180 ) -- and (value = '')
order by value_id desc
limit 10

-- *

select max(value_id) from bitnami_magento.catalog_product_entity_varchar

Leave a Reply