1

I've isolated a bit of Magento code which accesses a template file catalog\product\view\media.phtml:

<?php echo $this->getImagesMedia(); ?>

How is this different than the below example which does the same thing:

<?php echo $this->getChildHtml('media') ?>

The second example makes sense to me because it's defined in the layout.xml.. The first example is easier to implement on a catalog page where you have multiple objects but where is the $this->getImagesMedia() defined or setup?

How would I create a $this->getImagesMediaMobile().. that's my goal.. to have a 2nd way to display images on mobile devices.

5
  • you can refer the iphone theme media.phtml file
    – Keyul Shah
    Commented Apr 22, 2014 at 16:20
  • @KeyulShah That doesn't resolve the question though as requires running the iPhone theme for mobiles (as opposed to a global responsive theme with conditional loading as required).
    – zigojacko
    Commented Apr 23, 2014 at 8:40
  • @zigojacko .. you're right on with what im trying to do.. could you please extrapolate a little bit more about this (if you can) as an answer??
    – JustinP
    Commented Apr 23, 2014 at 12:16
  • Where did you find <?php echo $this->getImagesMedia(); ?> ? I wasn't able to find it anywhere.
    – Marius
    Commented May 28, 2014 at 11:22
  • Marius, I can look into this for you.. but could it be EE specific?
    – JustinP
    Commented May 28, 2014 at 14:05

2 Answers 2

2

So I cannot find the code getImagesMedia anywhere and in the media.phtml the following is used

$this->getGalleryImages()

But even though I am not sure what you are talking about I can give you a general answer as to the difference between the following calls.

$this->getSomething() or $this->getData('something')

These are calls to get values directly from the block object, there will either be a function that matches in the block or at some point there will be a call to setSomething

$this->getChildHtml('something') or $this->getChild('something')

Now these two will either return the html or the block itself from a child block defined via the layout xml as follows.

<block name="your_parent_block">
    <block type="some/type" name="something" />
</block>
1
  • Your more generalized answer is more helpful. Thank you for breaking this down.
    – JustinP
    Commented May 29, 2014 at 14:50
0

Function and Method Cross Reference

getgalleryimages()

Defined at: /app/code/core/Mage/Catalog/Block/Product/View/Media.php -> line 43

Referenced 6 times:

  • /app/design/frontend/base/default/template/catalog/product/view/media.phtml -> line 67
  • /app/design/frontend/base/default/template/catalog/product/view/media.phtml -> line 71
  • /app/design/frontend/default/modern/template/catalog/product/view/media.phtml -> line 67
  • /app/design/frontend/default/modern/template/catalog/product/view/media.phtml -> line 71
  • /app/design/frontend/default/iphone/template/catalog/product/view/media.phtml -> line 46
  • /app/design/frontend/default/iphone/template/catalog/product/view/media.phtml -> line 47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.