Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

Batch change property value for product in catalog

$
0
0

I have an Episerver website with the Commerce setup. There are several products in the catalog and for some reasons I have to change the value of one property for all the products (they are a lot). What would be the best way to do it, excluding changing them by hand in the editor interface?

I'm thinking about a database query, but so far I didn't succeed on making it work.

I found out all the properties are stored in [dbo].[CatalogContentProperty] (in my case in the LongString column). I naively tried to run the following query, restricted to a specific object:

UPDATE [database-name].[dbo].[CatalogContentProperty]
SET LongString='NewValue'
WHERE MetaFieldName='PropertyName' and LongString='OldValue'
and ObjectId=IdOfTheObject

The value was correctly changed in the database, but it wasn't changed in the edit UI, even after IIS restart/reset and application rebuild/restart.

What I noticed is that if I change the alue from th edit UI it also changes the field in [dbo].[CatalogContentProperty]. Do ou know if there's something I'm missing or do you have any better idea?

Thanks :)


Viewing all articles
Browse latest Browse all 9076