I have a script that adds images to my products. It is used to set images, small_image and thumbnails. The code works well for the default view, but when I switch to save, the multimedia gallery is set to "no_image". Causing my product to not have an image in the interface at all.
I tried to reset repository view attributes without success.
$product->addImageToMediaGallery($fileName, array('image', 'small_image', 'thumbnail'), false, false); $attributes = $product->setStoreId(1)->getTypeInstance(true)->getSetAttributes($product); if (isset($attributes['media_gallery'])) { $attributes['media_gallery']->getBackend()->clearMediaAttribute($product, array('image', 'small_image', 'thumbnail')); } $product->save();
How can I change certain store attributes and reset them to use the parent?
Thanks.
php magento
Fred
source share