2012-06-05 15 views
-4

我有所谓的自由航运自定义属性的Magento商店的顶部 眼下这使产品本身把图像放在另一个PHP和HTML

下方的免费送货图标,但我想让它通过在产品本身上放置一个新按钮更具吸引力。

下面是Magento的页面的PHP代码:

的页面是如何呈现的样例: http://www.theprinterdepo.com/lexmark-optra-t640-printer-20g0100

我需要修改代码gallery.phtml穿上顶部的图标产品,右上角。 我将修改图像为透明。

这是gallery.phtml文件:

<?php $_width=$this->getImageWidth() ?> 
<div class="product-image-popup" style="width:<?php echo $_width; ?>px;"> 
    <p class="a-right"><a href="#" onclick="window.close(); return false;"><?php echo $this->__('Close Window') ?></a></p> 
    <?php if($this->getPreviusImageUrl() || $this->getNextImageUrl()): ?> 
     <div class="nav"> 
      <?php if($_prevUrl = $this->getPreviusImageUrl()): ?> 
       <a href="<?php echo $_prevUrl ?>">&laquo; <?php echo $this->__('Prev') ?></a> 
      <?php endif; ?> 
      <?php if($_nextUrl = $this->getNextImageUrl()): ?> 
       <a href="<?php echo $_nextUrl ?>"><?php echo $this->__('Next') ?> &raquo;</a> 
      <?php endif; ?> 
     </div> 
    <?php endif; ?> 
    <?php if($_imageTitle = $this->htmlEscape($this->getCurrentImage()->getLabel())): ?> 
     <h1 class="image-label"><?php echo $_imageTitle ?></h1> 
    <?php endif; ?> 
    <img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'image', $this->getImageFile()); ?>"<?php if($_width): ?> width="<?php echo $_width ?>"<?php endif; ?> alt="<?php echo $this->htmlEscape($this->getCurrentImage()->getLabel()) ?>" title="<?php echo $this->htmlEscape($this->getCurrentImage()->getLabel()) ?>" id="product-gallery-image" class="image" /> 
    <?php if($this->getPreviusImageUrl() || $this->getNextImageUrl()): ?> 
     <div class="nav"> 
      <?php if($_prevUrl = $this->getPreviusImageUrl()): ?> 
       <a href="<?php echo $_prevUrl ?>">&laquo; <?php echo $this->__('Prev') ?></a> 
      <?php endif; ?> 
      <?php if($_nextUrl = $this->getNextImageUrl()): ?> 
       <a href="<?php echo $_nextUrl ?>"><?php echo $this->__('Next') ?> &raquo;</a> 
      <?php endif; ?> 
     </div> 
    <?php endif; ?> 
    <p class="a-right"><a href="#" onclick="window.close(); return false;"><?php echo $this->__('Close Window') ?></a></p> 
</div> 
<script type="text/javascript"> 
//<![CDATA[ 
Event.observe(window, 'load', function(){ 
    var demensions = $('product-gallery-image').getDimensions(); 
    window.resizeTo(demensions.width+90, demensions.height+210); 
}); 
//]]> 
</script> 

这是view.phtml

<?php $Deal = $_product->getResource()->getAttribute('deal')->getFrontend()->getValue($_product);?> 
               <?php $onSale = $_product->getResource()->getAttribute('on_sale')->getFrontend()->getValue($_product);?> 
               <?php $hotItem = $_product->getResource()->getAttribute('hot_item')->getFrontend()->getValue($_product);?> 
               <?php $freeShip = $_product->getResource()->getAttribute('free_shipping')->getFrontend()->getValue($_product);?> 
               <?php if($Deal == 'Yes'){ ?> 
                <img src="<?php echo $this->getSkinUrl('images/depot/icon-deal.gif') ?>" > 
               <?php } ?> 
               <?php if($onSale == 'Yes'){ ?> 
                <img src="<?php echo $this->getSkinUrl('images/depot/icon-sale.gif') ?>" > 
               <?php } ?> 
               <?php if($hotItem == 'Yes'){ ?> 
                <img src="<?php echo $this->getSkinUrl('images/depot/icon-hot.gif') ?>" > 
               <?php } ?> 
               <?php if($freeShip == 'Yes'){ ?> 
                <img src="<?php echo $this->getSkinUrl('images/depot/icon-freeship.gif') ?>" > 
               <?php }?> 
+0

[你尝试过什么(http://mattgemmell.com/2008/12/08/what-have-you-tried/),为什么没有它的工作?真正的问题是什么,“你能为我做好吗?” –

+0

PHP =服务器端。你的问题是客户端大小,所以这与PHP无关。 –

回答

2

不知道Magento的一个伟大的交易,但你在谈论需要CSS编码不算什么真的是PHP。理想情况下,您将需要两个图像输出到相同的容器DIV。

然后将图像设置为position: absolute,然后使用zindex将它们堆叠在一起。注意容器div将需要为position: absolouteposition: relative定位图像才能正常工作。

在这里看到更多 - How can we overlap two images using css style?