Skip to content

Instantly share code, notes, and snippets.

@Schrank
Created February 20, 2013 18:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Schrank/4997757 to your computer and use it in GitHub Desktop.
Save Schrank/4997757 to your computer and use it in GitHub Desktop.
Check wether a collection should load an attribute
<?php
class Observer {
protected function _collectionShouldLoadWidthAndHeight(Mage_Catalog_Model_Resource_Product_Collection $collection)
{
$reflection = new ReflectionProperty($collection, '_selectAttributes');
$reflection->setAccessible(true);
$value = $reflection->getValue($collection);
return array_key_exists('original_height', $value) || array_key_exists('original_width', $value);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment