Reading list Switch to dark mode

    Magento Set default image from product images

    Updated 16 July 2021

    Get filename from here
    $_product = Mage::getModel('catalog/product')->load($ProductId)->getMediaGalleryImages();
    foreach ($_product as $value) {
         if($value->getFile() == $yourfilename){
            $newimage = $value->getFile(); //get your file you want to set
    Now set your default image
    $objprod->setSmallImage($newimage); //newimage is filename you want to set

    Searching for an experienced
    Magento Company ?
    Find out More
    . . .

    Leave a Comment

    Your email address will not be published. Required fields are marked*

    Be the first to comment.

    Back to Top

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home