I’m currently creating a simple module that will change the product image depending on the option’s value selected by the user (example: the user choose blue, the product’s image become the one associated with the color blue).
To do this, I need to access the image_media_gallery data of the product in the options file, so I did this at the bottom of template\catalog\product\view\options.phtml:
$_product = $this->getProduct();
$_mgi = $_product->getMediaGalleryImages();
Then if I print_r the $_mgi variable, I can clearly see what I need in the array returned, but if I try to access it, I have a fatal error telling me _items is protected ...
here’s the print_r
[_items:protected] => Array
 => Varien_Object Object
[_data:protected] => Array
[value_id] => 1
[file] => /b/o/body_test_green_1.jpg
[label] => couleur__vert
[position] => 1
And here’s how I try to access to a specific part of it :
I’m asking if there’s a solution to make it work, or if I’m wrong and should concider a different approach.