Put an image on top of another one with php and html -
i have magento store custom attribute called free shipping right renders free shipping icon below product itself
but want make more appealing putting new button on top of product itself.
here php code magento page:
sample of how page rendered: http://www.theprinterdepo.com/lexmark-optra-t640-printer-20g0100
i need modify code in gallery.phtml put icon on top of product, right top corner. modify image transparent.
this gallery.phtml file:
<?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 ?>">« <?php echo $this->__('prev') ?></a> <?php endif; ?> <?php if($_nexturl = $this->getnextimageurl()): ?> <a href="<?php echo $_nexturl ?>"><?php echo $this->__('next') ?> »</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 ?>">« <?php echo $this->__('prev') ?></a> <?php endif; ?> <?php if($_nexturl = $this->getnextimageurl()): ?> <a href="<?php echo $_nexturl ?>"><?php echo $this->__('next') ?> »</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> this 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 }?>
don't know great deal magento talking require css coding not php. ideally need both images output same container div.
then set images position: absolute , use zindex stack them on top of each other. note container div either need position: absoloute or position: relative positioning of images work properly.
see here more - how can overlap 2 images using css style?
Comments
Post a Comment