【问题标题】:update product thumbnail ,small image and base image programatically Magento以编程方式更新产品缩略图、小图像和基本图像 Magento
【发布时间】:2014-02-21 05:44:44
【问题描述】:

需要更新产品缩略图、小图和基础图 以编程方式

为此我使用下面的代码

$collection1->addImageToMediaGallery($importDir,$mediaArray,false);

    //$collection1->setStoreId(0);
        $collection1->save();
if (isset($mediaGallery['images'])){
            //loop through the images
            foreach ($mediaGallery['images'] as $image){
            //set the first image as the base image
            Mage::getSingleton('catalog/product_action')->updateAttributes(array($collection1->getId()), array('image'=>$image['file'],'thumbnail'=>$image['file'],'small_image'=>$image['file']), 0);
            //stop
            break;
            }
            }

使用此代码 a

图片添加到图库

但我需要将最新图像设置为图像和基础图像

。请建议我如何实现这一点,谢谢

【问题讨论】:

    标签: image magento zend-framework set


    【解决方案1】:

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-02-09
    • 2021-11-10
    • 2011-05-19
    • 1970-01-01
    • 1970-01-01
    • 2012-02-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多