Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $_products = $this->getProductCollection();
- $_helper = $this->helper('catalog/output');
- if(Mage::registry('current_category')){
- $_products->addUrlRewrite(Mage::registry('current_category')->getId());
- }
- $limitproduct = $this->getLimitCount();
- $size = $_products->getSize();
- if($limitproduct == "" || $limitproduct > $size){
- $limitproduct = $size;
- }
- $title = $this->getFrontendTitle();
- $desc = $this->getFrontendDescription();
- $wrapclass = $this->getCustomClass();
- $w = $this->getThumbnailWidth();
- $h = $this->getThumbnailHeight();
- $_columnCount = $this->getColumnCount();
- $alt_img = $this->getAltImg();
- ?>
- <div <?php if($wrapclass):?>class="<?php echo $wrapclass;?>"<?php endif; ?>>
- <?php if($title): ?>
- <div class="widget-title">
- <h2><span><?php echo $title; ?></span></h2>
- </div>
- <?php endif; ?>
- <?php if($desc):?>
- <p><?php echo $desc; ?></p>
- <?php endif ?>
- <?php if ($limitproduct): ?>
- <div class="widget em-widget-featured-products-grid">
- <div class="widget-products">
- <?php $i=0; foreach ($_products as $_product): ?>
- <?php if ($_columnCount > 0 && $i%$_columnCount==0 || $_columnCount <= 0 && $i == 0): ?>
- <ul class="products-grid">
- <?php endif ?>
- <li class="<?php if($itemClass = $this->getData('item_class')) echo $itemClass.' '; ?>item<?php echo $_columnCount > 0 && $i%$_columnCount==0 || $_columnCount <= 0 && $i == 0 ?' first':''; ?><?php echo $_columnCount > 0 && ($i+1)%$_columnCount==0 || $i+1 == $limitproduct ?' last':''; ?>"
- style="<?php echo $this->getItemWidth() ? 'width:'.$this->getItemWidth().'px;' : '' ?> <?php echo $this->getItemHeight() ? 'height:'.$this->getItemHeight().'px;' : '' ?> <?php echo $this->getItemSpacing() ? 'margin-right:'.$this->getItemSpacing().'px;margin-bottom:'.$this->getItemSpacing().'px;' : '' ?>">
- <div class="product-item">
- <?php if ($this->ShowThumb()=='true'): ?>
- <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>" class="product-image">
- <?php if ($this->ShowLabel()=='true'):?>
- <!--show label product - label extension is required-->
- <?php Mage::helper('productlabels')->display($_product);?>
- <?php endif;?>
- <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($w,$h) ?>" width="<?php echo $w; ?>" height="<?php echo $h ;?>"<?php if ($alt_img): ?>
- rel="<?php echo $alt_img ?>"
- data-alt-src="<?php echo $this->helper('catalog/image')->init($_product, $alt_img)->resize($w,$h) ?>"
- <?php endif ?> alt="<?php echo $this->stripTags($_product->getName(), null, true) ?>" />
- <span class="bkg-hover"></span>
- </a>
- <?php else: ?>
- <?php if ($this->ShowLabel()=='true'):?>
- <!--show label product - label extension is required-->
- <?php Mage::helper('productlabels')->display($_product);?>
- <?php endif;?>
- <?php endif; ?>
- <div class="product-shop">
- <div class="f-fix">
- <!--product name-->
- <?php if ($this->ShowProductName()=='true'):?>
- <h3 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $this->helper('catalog/output')->productAttribute($_product, $_product->getName() , 'name') ?></a></h3>
- <?php endif;?>
- <!--product reviews-->
- <?php if ($this->ShowReview()=='true'):?>
- <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
- <?php endif ; ?>
- <!--product description-->
- <?php if ($this->ShowDesc()=='true'):
- $desc = $this->stripTags($_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description'));
- if(strlen($desc)>80) { //dem ki tu chuoi $str, 80 la chieu dai muon quy dinh
- $strCutTitle = substr($desc, 0, 80); //cat 80 ki tu dau
- $desc = substr($strCutTitle, 0, strrpos($strCutTitle, ' '));
- }
- ?>
- <p class="desc"><?php echo $desc; ?></p>
- <?php endif ;?>
- <?php
- $thePrice = Mage::helper('tax')->getPrice($_product, $_product->getFinalPrice());
- $newmsrp = $this->helper('core')->currency($_product->getMsrp(),false,false);
- $total_saving = $newmsrp - $thePrice;
- $_item = $this->getItem();
- $_product= Mage::getSingleton('catalog/product')->load($_item->getProductId());
- $rrp = $_product->getResource()->getAttribute('rrp')->getFrontend()->getValue($_product);
- ?>
- <!--product price-->
- <?php if ($this->ShowPrice()=='true'):?>
- <?php if (Mage::helper('catalog')->canApplyMsrp($_product)):?>
- <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $this->__('Detail') ?></a>
- <?php else : ?>
- <?php echo $this->getPriceHtml($_product, true, '-widget-new-list') ?>
- <?php if( $_product->getTypeId() == 'simple' ): ?>
- <div class="msrp-price">
- <span class="rrp">RRP: </span>
- <span class="rrpPrice"> <?php echo Mage::helper('core')->currency($_product->getMsrp(),true,false);?>
- </span>
- </div>
- <span class="price-label"><?php echo $this->__('You Save:') ?></span>
- <span class="savePrice" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
- <?php echo '£' . number_format(abs($total_saving),2); ?>
- </span>
- <?php endif;?>
- <?php endif;?>
- <?php endif;?>
- <?php if($this->ShowAddtoCart()=='true' || $this->ShowAddto()=='true'):?>
- <div class="actions-cart">
- <div class="actions">
- <!--product add to cart-->
- <?php if ($this->ShowAddtoCart()=='true'):?>
- <?php if ($_product->isSaleable()): ?>
- <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
- <?php else: ?>
- <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
- <?php endif; ?>
- <?php endif; ?>
- <!--product add to compare-wishlist-->
- <?php if($this->ShowAddto()=='true'):?>
- <ul class="add-to-links">
- <?php if ($this->helper('wishlist')->isAllow()) : ?>
- <li><a href="<?php echo $this->getAddToWishlistUrl($_product) ?>" class="link-wishlist" title="<?php echo $this->__('Add to Wishlist') ?>"><?php echo $this->__('Add to Wishlist') ?></a></li>
- <?php endif; ?>
- <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
- <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare" title="<?php echo $this->__('Add to Compare') ?>"><?php echo $this->__('Add to Compare') ?></a></li>
- <?php endif; ?>
- </ul>
- <?php endif; ?>
- </div>
- </div>
- <?php endif;?>
- </div>
- </div>
- </div>
- </li>
- <?php if ( $_columnCount > 0 && ($i+1)%$_columnCount==0 || $i+1==$limitproduct ): ?>
- </ul>
- <?php endif; ?>
- <?php $i++;?>
- <?php if ($i >= $limitproduct) break; ?>
- <?php endforeach; ?>
- </div>
- </div>
- <?php else:?>
- <p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
- <?php endif; ?>
- </div>
- <script type="text/javascript">
- decorateGeneric($$('ul.products-grid'),['last','first','odd','even']);
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement