【发布时间】: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