Changing main image source on product page in magento

时间:2015-06-15 14:30:51

标签: php image magento media product

I need to change the way main image on product page is loaded (there is only one image) and make it be loaded from external url.

Now: image is loaded from media folder on my server.

Need: image is loaded from external url without being saved on my server

I have created an additional attribute "externalimg". Its value is eg "https://images.otto.de/is/image/mmo/12489608?$001PICT30$" I tried editing media.php file which for some reason deliver no changes at all, even if I delete it from server. I use a custom theme. I did this with catalog images and it worked fine. All products have different images, so changing base media path didn't work.

Thanks in advance.

UPDATE: I have now found out that with default magento theme changing media.phtml works fine. With my theme "yummy" it does not work. Any changes in media.phtml are just ignored.

1 个答案:

答案 0 :(得分:1)

You should be able to override /app/design/frontend/yournamespace/yourtheme/template/catalog/product/view/media.phtml

If it doesn't exist, copy it from base into your theme folder at the correct path.

However, your theme may also use an extension that is over-writing this default template file. You should be able to use something like https://github.com/AOEpeople/Aoe_TemplateHints to find the correct template, or simply find some specific HTML around the product image and then search your source code to find the relevant section to alter.