2014-02-21 80 views
2

需要使用以下代碼更新產品的縮略圖,小圖像和編程基本圖像的Magento

$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; 
      } 
      } 

更新產品的縮略圖,小圖像和基本圖像 編程

此IA使用此代碼a

圖片添加到圖庫

,但我需要設置的最新圖像設定圖像和基本圖像

。請建議我如何才能做到這一點得益於以下網址

http://www.blog.magepsycho.com/how-to-import-product-images-from-external-url-in-magento/

回答

1

檢查希望這可以幫助你

+0

也檢查http://magento.stackexchange.com/questions/5715/how-to-programatical ly-import-product-and-set-images-default- – shivam

+0

您提供的上述鏈接不存在。而是提供一些解釋。鏈接可能永遠不會存在。 –

+0

嗨@Dushyant Joshi現在檢查.. – shivam