Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Imported images are not displaying
 
sarrazinc
Jr. Member
 
Total Posts:  2
Joined:  2012-10-15
 

I\’m developing a script that imports product data from a 3rd party. I\’m using Magento 1.5.1.0 and upgrade to the most recent version is not an option right now.

Essentially, everything in the product imports correctly, except the images.
For the images, I\’m running this code:

$product Mage::getModel('catalog/product')->load($existingProductId);
$product->addImageToMediaGallery ($local_file, array ('image''small_image''thumbnail'), falsefalse);
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
$product->save();

The function does pass correctly, and when inspecting the $product variable, I can confirm my images are there. Also, the images are correctly moved to the /media/catalog folder and rows in the table mage_catalog_product_entity_media_gallery are correctly inserted.

However, when I go into the product in Magento backend, the \"Images\" section does not display them (I checked the other stores and they are not there either). Am I missing something ?

Thanks in advance !!

 
Magento Community Magento Community
Magento Community
Magento Community
 
sarrazinc
Jr. Member
 
Total Posts:  2
Joined:  2012-10-15
 

I got a little farther, it seems that whatever I add to the product model—I tried changing the description for instance --, this data isn’t saved

$product Mage::getModel('catalog/product')->load($existingProductId);
//image adding code
//properties changed
$product->save(); //Properties are not saved

Any idea ?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top