I can't to set it from admin. enter image description here And I must set it by SQL query. So how I can do it? Or where stored url from picture in database? Picture in media already exists.


Check the catalog_product_entity_media_gallery table in database here in 'value' column image path is saved

For writing custom query for this table you need to use core_read and core_write connection to update the table.

For Read Connection :

$readConnection = Mage::getSingleton('core/resource')->getConnection('core_read');
    $sql        = "SELECT * FROM `catalog_product_entity_media_gallery` WHERE `attribute_id`=89";
    $rows       = $readConnection->fetchAll($sql); 

For write connection :

$writeConnection = Mage::getSingleton('core/resource')->getConnection('core_write');
        $sql        = "UPDATE `catalog_product_entity_media_gallery` SET value = 'test.jpeg' WHERE `attribute_id`=89";
        $rows       = $writeConnection->query($sql); 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.