Magento: How to exclude image from gallery programmatically? -
i creating products , images programmatically. thing not working "exclude gallery" feature.
see http://snag.gy/qghpg.jpg details.
how set in code? current code looks that:
$product->addimagetomediagallery($myimage, array('image','thumbnail','small_image'), false, false);
the flag called disabled
think, not sure though.
thanks!
for example, disable images product
$product = mage::getmodel('catalog/product')->load(12345); $images = $product->getmediagalleryimages(); $attributes = $product->gettypeinstance(true)->getsetattributes($product); $mediagalleryattribute = $attributes['media_gallery']; foreach ($images $image) { $mediagalleryattribute->getbackend()->updateimage($product, $image['file'], array('exclude' => true)); } $product->save();
Comments
Post a Comment