Skip to content

Instantly share code, notes, and snippets.

@kalenjordan
Last active August 28, 2015 14:30
Show Gist options
  • Save kalenjordan/24c68065993ec0cc79f5 to your computer and use it in GitHub Desktop.
Save kalenjordan/24c68065993ec0cc79f5 to your computer and use it in GitHub Desktop.
<?php
/**
* @param $observer Varien_Event_Observer
*/
public function productImageFetchAfter($observer)
{
/** @var Varien_Object $data */
$data = $observer->getData('data');
/** @var Mage_Catalog_Model_Product $product */
$product = $observer->getData('product');
/**
* The product ID that was requested in the product image URL.
* This may be different from the $product model, because the $product
* model attempts to load a product that has a small_image set on it,
* and if it doesn't have one, it will load the parent product.
*/
$requestedProductId = $observer->getData('requested_product_id');
$data->setData('image_url', 'http://local.magemail.co/app/media/uploads/d2176f2e5d09f7071cf98ea460f0b9b6.png');
return $this;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment