SHARE
TWEET

new media.phtml

a guest Jan 9th, 2015 207 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.        
  2.  
  3.     <?php
  4.     /**
  5.      * Magento
  6.      *
  7.      * NOTICE OF LICENSE
  8.      *
  9.      * This source file is subject to the Academic Free License (AFL 3.0)
  10.      * that is bundled with this package in the file LICENSE_AFL.txt.
  11.      * It is also available through the world-wide-web at this URL:
  12.      * http://opensource.org/licenses/afl-3.0.php
  13.      * If you did not receive a copy of the license and are unable to
  14.      * obtain it through the world-wide-web, please send an email
  15.      * to license@magentocommerce.com so we can send you a copy immediately.
  16.      *
  17.      * DISCLAIMER
  18.      *
  19.      * Do not edit or add to this file if you wish to upgrade Magento to newer
  20.      * versions in the future. If you wish to customize Magento for your
  21.      * needs please refer to http://www.magentocommerce.com for more information.
  22.      *
  23.      * @category    design
  24.      * @package     base_default
  25.      * @copyright   Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
  26.      * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  27.      */
  28.      
  29.     /**
  30.      * Product media data template
  31.      *
  32.      * @see Mage_Catalog_Block_Product_View_Media
  33.      */
  34.     ?>
  35.     <?php
  36.         $_product = $this->getProduct();
  37.         $_helper = $this->helper('catalog/output');
  38.         $setting = Mage::helper('em0113settings');
  39.         $viewmode = $setting->getImageProduct_Viewmode();
  40.     ?>
  41.     <?php if ($_product->getImage() != 'no_selection' && $_product->getImage()): ?>
  42.         <?php if ($viewmode == 'cloudzoom'): ?>
  43.         <p class="product-image">
  44.             <?php
  45.                 $_img = $this->helper('catalog/image')->init($_product, 'image');
  46.                 $_img2 = clone $_img;
  47.                 $config = "zoomWidth: ".min($setting->getImageProduct_CloudZoomWidth(390), $_img->getOriginalWidth()).",";
  48.                 $config .= "zoomHeight: ".min($setting->getImageProduct_CloudZoomHeight(390), $_img->getOriginalHeight()).",";
  49.                 $config .= 'adjustX: 10, adjustY:-4';
  50.                 if($_img->getOriginalWidth() >= 390)
  51.                     $w  =   $setting->getImageProduct_BaseImageWidth(390);
  52.                 else
  53.                     $w  =   $_img->getOriginalWidth();
  54.                 $ratio = $w / $_img->getOriginalWidth();
  55.                 //$h = $ratio * $_img->getOriginalHeight();
  56.                 $h = $setting->getImageProduct_BaseImageHeight(390);
  57.             ?>
  58.             <a class="cloud-zoom" id="image_zoom" rel="<?php echo $config ?>" href="<?php echo $_img ?>" >
  59.                 <img itemprop="image" src="<?php echo $_img->resize($w, $h); ?>" alt='' title="<?php echo $this->escapeHtml($this->getImageLabel());?>" />
  60.             </a>
  61.                         <?php if($w < 400 && $h < 400): ?>
  62.             <a id="zoom-btn" rel="lightbox[em_lightbox]" href="<?php echo $this->helper('catalog/image')->init($_product, 'image') ?>" title="<?php echo $this->escapeHtml($this->getImageLabel());?>">Zoom</a>
  63.       <?php endif; ?>
  64.           </p>
  65.         <?php elseif ($viewmode == 'lightbox'): ?>
  66.         <p class="product-image">
  67.             <a rel="lightbox[em_lightbox]"  href="<?php echo $this->helper('catalog/image')->init($_product, 'image'); ?>"  title="<?php echo $this->escapeHtml($this->getImageLabel())?>">
  68.             <?php
  69.                 $w = $setting->getImageProduct_BaseImageWidth(390);
  70.                 $h = $setting->getImageProduct_BaseImageHeight(390) ? $setting->getImageProduct_BaseImageHeight(390) : null;
  71.                 $_img = '<img id="image" itemprop="image" src="'.$this->helper('catalog/image')->init($_product, 'image')->resize($w, $h).'" alt="'.$this->escapeHtml($this->getImageLabel()).'" title="'.$this->escapeHtml($this->getImageLabel()).'" />';
  72.                 echo $_helper->productAttribute($_product, $_img, 'image');
  73.             ?>
  74.             </a>
  75.         </p>
  76.         <?php else: ?>
  77.         <p class="product-image product-image-zoom" style="width:<?php echo $setting->getImageProduct_BaseImageWidth(390) ?>px;height:<?php echo $setting->getImageProduct_BaseImageHeight(390) ?>px; overflow:hidden;">
  78.             <?php
  79.                 $_img = '<img style="max-width:none;" id="image" itemprop="image" src="'.$this->helper('catalog/image')->init($_product, 'image').'" alt="'.$this->escapeHtml($this->getImageLabel()).'" title="'.$this->escapeHtml($this->getImageLabel()).'" />';
  80.                 echo $_helper->productAttribute($_product, $_img, 'image');
  81.             ?>
  82.         </p>
  83.         <p class="zoom-notice" id="track_hint"><?php echo $this->__('Double click on above image to view full picture') ?></p>
  84.         <div class="zoom" style="width:<?php echo $setting->getImageProduct_BaseImageWidth(390) ?>px;">
  85.             <img id="zoom_out" src="<?php echo $this->getSkinUrl('images/slider_btn_zoom_out.gif') ?>" alt="<?php echo $this->__('Zoom Out') ?>" title="<?php echo $this->__('Zoom Out') ?>" class="btn-zoom-out" />
  86.             <div id="track">
  87.                 <div id="handle"></div>
  88.             </div>
  89.             <img id="zoom_in" src="<?php echo $this->getSkinUrl('images/slider_btn_zoom_in.gif') ?>" alt="<?php echo $this->__('Zoom In') ?>" title="<?php echo $this->__('Zoom In') ?>" class="btn-zoom-in" />
  90.         </div>
  91.         <script type="text/javascript">
  92.         //<![CDATA[
  93.             Event.observe(window, 'load', function() {
  94.                 product_zoom = new Product.Zoom('image', 'track', 'handle', 'zoom_in', 'zoom_out', 'track_hint');
  95.             });
  96.         //]]>
  97.         </script>
  98.         <?php endif ?>
  99.     <?php else: ?>
  100.     <p class="product-image">
  101.         <?php
  102.             $_img = '<img itemprop="image" src="'.$this->helper('catalog/image')->init($_product, 'image')->resize(
  103.                 $setting->getImageProduct_BaseImageWidth(390),
  104.                 $setting->getImageProduct_BaseImageHeight(390)).'" alt="'.$this->escapeHtml($this->getImageLabel()).'" title="'.$this->escapeHtml($this->getImageLabel()).'" />';
  105.             echo $_helper->productAttribute($_product, $_img, 'image');
  106.         ?>
  107.     </p>
  108.     <?php endif; ?>
  109.     <?php if (count($this->getGalleryImages()) > 0): ?>
  110.         <?php $limitmore = count($this->getGalleryImages()); ?>
  111.     <div class="more-views slideshow-more-views">
  112.         <span><?php echo $this->__('More View') ?></span>
  113.         <ul>
  114.         <?php foreach ($this->getGalleryImages() as $_image): ?>
  115.             <li class="item" width="<?php echo $setting->getImageProduct_ThumbBaseWidth(80) ?>px">
  116.                 <?php
  117.                     $_img = $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile());
  118.                 ?>
  119.                 <?php if ($viewmode == 'cloudzoom'): ?>
  120.                 <?php
  121.                     $_img_thumb = (string)$_img->resize(null);
  122.                     if($_img->getOriginalWidth() >= 390)
  123.                         $mv_w   =   $setting->getImageProduct_BaseImageWidth(390);
  124.                     else
  125.                         $mv_w   =   $_img->getOriginalWidth();
  126.                     $ratio = $mv_w / $_img->getOriginalWidth();
  127.                     $mv_h = $ratio * $_img->getOriginalHeight();
  128.                     $_img_thumb = (string)$_img->resize($setting->getImageProduct_ThumbBaseWidth(80), $setting->getImageProduct_ThumbBaseHeight(80));
  129.                     $_img_small = (string)$this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize($mv_w,$mv_h);
  130.                     $_img_big = (string)$this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile());
  131.                 ?>
  132.                 <a class="cloud-zoom-gallery" rel="
  133.                     useZoom:'image_zoom',              
  134.                     smallImage:'<?php echo $_img_small ?>',
  135.                     adjustX:5, adjustY:-5" onclick="return false" href="<?php echo $_img_big ?>"><img
  136.                     src="<?php echo $_img_thumb ?>"
  137.                         alt="<?php echo $this->escapeHtml($_image->getLabel()) ?>" width="<?php echo $setting->getImageProduct_ThumbBaseWidth(80) ?>px" />
  138.                 </a>
  139.                     <a class="no-display" href="<?php echo $_img_big ?>" rel="lightbox[em_lightbox]">lightbox moreview</a>
  140.                 <?php elseif ($viewmode == 'lightbox'): ?>
  141.                 <?php $_img_thumb = (string)$_img->resize($setting->getImageProduct_ThumbBaseWidth(80), $setting->getImageProduct_ThumbBaseHeight(80)); ?>
  142.                 <a rel="lightbox[em_lightbox]"  href="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile()); ?>"  title="<?php echo $this->escapeHtml($_image->getLabel()) ?>">
  143.                     <img src="<?php echo $_img_thumb; ?>" alt="<?php echo $this->escapeHtml($_image->getLabel()) ?>" width="<?php echo $setting->getImageProduct_ThumbBaseWidth(80) ?>px" />
  144.                 </a>            
  145.                 <?php else: ?>
  146.                 <?php $_img_thumb = (string)$_img->resize($setting->getImageProduct_ThumbBaseWidth(80), $setting->getImageProduct_ThumbBaseHeight(80)); ?>
  147.                 <a href="#" onclick="popWin('<?php echo $this->getGalleryUrl($_image) ?>', 'gallery', 'width=300,height=300,left=0,top=0,location=no,status=yes,scrollbars=yes,resizable=yes'); return false;" title="<?php echo $this->escapeHtml($_image->getLabel()) ?>"><img
  148.                     src="<?php echo $_img_thumb; ?>"
  149.                     alt="<?php echo $this->escapeHtml($_image->getLabel()) ?>" width="<?php echo $setting->getImageProduct_ThumbBaseWidth(80) ?>px" /></a>
  150.                 <?php endif ?>
  151.             </li>
  152.         <?php endforeach; ?>
  153.         </ul>
  154.     </div>
  155.     <script type="text/javascript">
  156.     jQuery(window).load(function() {
  157.         jQuery('.slideshow-more-views ul').addClass('slides');
  158.         jQuery('.slideshow-more-views').csslider({
  159.                 move : 1,
  160.                 circular : 0,
  161.                 direction : 'horizontal',
  162.                 parentHidden : '.product-img-box'
  163.             });
  164.     });
  165.     jQuery('.cloud-zoom-gallery').click(function () {
  166.         jQuery('#zoom-btn').attr('href', this.href);
  167.     });
  168.     </script>
  169.     <?php endif; ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top