Magento – Update Product Prices and Images Using SQL Query

catalogdatabaseproduct-pricessql

I have about 5k products. I would like to update the sale price and its main image using a query, is this possible?

I'm looking for something like:

UPDATE products 
SET 
    sale_price = 25.00, 
    main_image = 'http://source.com/589002200.jpg' 
WHERE sku = 589002200;

Best Answer

You probably don't want to do this.

Given you're updating a sale price could you just use the promotions for this?

If you really want to however either use magmi as it's easier or you'll need to dig into the magento EAV database.

Price is stored on the catalog_product_entity_decimal table linked to product ID (called entity_id) and images are stored on in the catalog_product_entity_varchar table. Not sure if the attribute_id will be the same across stores or not but for images mine are 74 75 76 (for main, small and thumbnail respectively)

I would highly recommend you don't go down this route (if you're unsure), and come up with a better solution, for what you want to do.

Related Topic