Skip to content

Instantly share code, notes, and snippets.

@razbakov
Last active August 29, 2015 13:58
Show Gist options
  • Save razbakov/9970086 to your computer and use it in GitHub Desktop.
Save razbakov/9970086 to your computer and use it in GitHub Desktop.
<?php
/**
* TecRepair Installator
*
* @category Kirchbergerknorr
* @package Kirchbergerknorr_TecRepair
* @author Aleksey Razbakov <[email protected]>
* @copyright Copyright (c) 2014 kirchbergerknorr GmbH (http://www.kirchbergerknorr.de)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
/* @var $installer Mage_Sales_Model_Entity_Setup */
$installer = $this;
$product = Mage::getModel('catalog/product')->loadByAttribute('sku', 'product_sku');
$image = $Mage::getBaseDir('media') . DS ."image.png";
if (is_file($image))
{
$product->addImageToMediaGallery($image, array ('image', 'small_image', 'thumbnail'), false, false);
$product->save();
}
$installer->endSetup();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment