Advertisement
Guest User

Untitled

a guest
May 22nd, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 10.55 KB | None | 0 0
  1. <?php
  2. $_productCollection = Mage::getModel('catalog/product')->getCollection();
  3. $_productCollection->addAttributeToSelect(array(
  4.                                    'small_image',
  5.                                    'name',
  6.                                    'daudzums_veikala',
  7.                                    'price'
  8.                    ))
  9.                    ->addFieldToFilter('visibility', array(
  10.                               Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH,
  11.                                Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG
  12.                    )) //showing just products visible in catalog or both search and catalog
  13.                    ->addAttributeToFilter('daudzums_veikala', array('moreq' => 1))
  14. //                 ->addAttributeToSort('price', 'asc') //in case we would like to sort products by price ASC / DESC
  15.                    ->getSelect()
  16. //                 ->where('daudzums_veikala > 1')
  17. //                   ->limit(15) //we can specify how many products we want to show on this page
  18. //                        ->order(new Zend_Db_Expr('RAND()')) //in case we would like to sort products randomly
  19.                    ;
  20.  
  21. Mage::getModel('review/review')->appendSummary($_productCollection);
  22.  
  23. $_helper = $this->helper('catalog/output');
  24. ?>
  25.  
  26. <?php
  27. /**
  28. * Product list template
  29. *
  30. * @see Mage_Catalog_Block_Product_List
  31. */
  32. ?>
  33. <?php if(!$_productCollection->count()): ?>
  34. <p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
  35. <?php else: ?>
  36. <div class="category-products">
  37.     <div class="toolbar-bottom">
  38.         <?php echo $this->getToolbarBlock()->setTemplate('catalog/product/list/toolbar.phtml')->toHtml(); ?>
  39.     </div>
  40.     <?php // List mode ?>
  41.     <?php if($this->getMode()!='grid'): ?>
  42.     <?php $_iterator = 0; ?>
  43.     <ol class="products-list" id="products-list">
  44.     <?php foreach ($_productCollection as $_product): ?>
  45.         <li class="item<?php if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>">
  46. <?php $product = Mage::getModel('catalog/product')->load($_product->getId()); $specialprice = $product->getSpecialPrice();
  47. if ($specialprice && ( strtotime($product->getSpecialToDate()) > time() || !$product->getSpecialToDate())){?>
  48. <?php
  49. $_finalPrice = $this->helper('tax')->getPrice($_product, $_product->getFinalPrice());
  50. $_regularPrice = $this->helper('tax')->getPrice($_product, $_product->getPrice());
  51. if ($_regularPrice != $_finalPrice):
  52. $getpercentage = number_format($_finalPrice / $_regularPrice * 100, 2);
  53. $finalpercentage = 100 - $getpercentage;
  54.  
  55. echo '<div class="atlaide"><div class="procenti"> -'.number_format($finalpercentage, 0).'% </div></div>' ;
  56.  
  57. endif; ?><?php } ?>
  58. <div class="eiro_piegade"><?php
  59.    $eko=$_product->getResource()->getAttribute('shipping_rate')->getFrontend()->getValue($_product);
  60.     $filename= '/var/www/media/piegade/'.str_replace(' ', '_',$eko).'.png';
  61.     if (file_exists($filename)) {
  62.     echo '<img style="float: left; margin: 2px; margin-top: 6px;" src="/media/piegade/'.str_replace(' ', '_',$eko).'.png" alt="'.$eko.'" title="'.$eko.'"></img>';
  63.                        }
  64.                        ?></div>
  65. <?php if($_product->getBezmaksas()): ?>
  66. <div class="piegade2"><a onclick="popWin('http://www.elbox.lv/mps.html', 'deliveryinfo', 'width=650,height=1214,left=0,top=0,location=no,status=yes,scrollbars=yes,resizable=no'); return false;" href="#"><img src="<?php echo $this->getSkinUrl(); ?>images/bezmaksas_ps2.png" title="Bezmaksas piegāde uz 'Pasta Stacija' automātu" alt="Bezmaksas piegāde uz 'Pasta Stacija' automātu" width="104px" height="33px" /></a></div>
  67. <?php endif; ?>
  68.             <?php // Product Image ?>
  69.             <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(175,175); ?>" width="175" alt="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>" /></a>
  70.             <?php // Product description ?>
  71.             <div class="product-shop">
  72.                 <div class="f-fix">
  73.                     <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><?php echo $this->htmlEscape($_product->getName())?></a></h2>
  74.                     <?php if($_product->getRatingSummary()): ?>
  75.                     <?php echo $this->getReviewsSummaryHtml($_product) ?>
  76.                     <?php endif; ?>
  77.                     <?php echo $this->getPriceHtml($_product, true) ?>
  78.                     <?php if($_product->isSaleable()): ?>
  79.                         <p><button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span></span></span></button></p>
  80.                     <?php else: ?>
  81.                         <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
  82.                     <?php endif; ?>
  83.                     <div class="desc std">
  84.                         <?php echo nl2br($this->htmlEscape($_product->getShortDescription())) ?>
  85.                         <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>" class="link-more"><?php echo $this->__('Learn More') ?></a>
  86.                     </div>
  87.                     <ul class="add-to-links">
  88.                         <?php if ($this->helper('wishlist')->isAllow()) : ?>
  89.                             <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
  90.                         <?php endif; ?>
  91.                         <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
  92.                             <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
  93.                         <?php endif; ?>
  94.                     </ul>
  95.                     <div class="veikala2">
  96.                        <?php if($_product->getDaudzumsVeikala()): ?>
  97.                        ✔ Ir veikalā <span class="in-stock">(<?php echo $_product->getDaudzumsVeikala(); ?>)</span>
  98.                        </div>
  99. <?php endif; ?>
  100.                 </div>
  101.             </div>
  102.         </li>
  103.     <?php endforeach; ?>
  104.     </ol>
  105.     <script type="text/javascript">decorateList('products-list', 'none-recursive')</script>
  106.  
  107.     <?php else: ?>
  108.  
  109.     <?php // Grid Mode ?>
  110.  
  111.     <?php $_collectionSize = $_productCollection->count() ?>
  112.     <?php $_columnCount = $this->getColumnCount();
  113.     ?>
  114.     <?php $i=0; foreach ($_productCollection as $_product): ?>
  115.         <?php if ($i++%$_columnCount==0): ?>
  116.         <ul class="products-grid">
  117.         <?php endif ?>
  118.             <li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
  119. <?php $product = Mage::getModel('catalog/product')->load($_product->getId()); $specialprice = $product->getSpecialPrice();
  120. if ($specialprice && ( strtotime($product->getSpecialToDate()) > time() || !$product->getSpecialToDate())){?>
  121. <?php
  122. $_finalPrice = $this->helper('tax')->getPrice($_product, $_product->getFinalPrice());
  123. $_regularPrice = $this->helper('tax')->getPrice($_product, $_product->getPrice());
  124. if ($_regularPrice != $_finalPrice):
  125. $getpercentage = number_format($_finalPrice / $_regularPrice * 100, 2);
  126. $finalpercentage = 100 - $getpercentage;
  127.  
  128. echo '<div class="atlaide"><div class="procenti"> -'.number_format($finalpercentage, 0).'% </div></div>' ;
  129.  
  130. endif; ?><?php } ?>
  131. <div class="eiro_piegade2"><?php
  132.    $eko=$_product->getResource()->getAttribute('shipping_rate')->getFrontend()->getValue($_product);
  133.     $filename= '/var/www/media/piegade/'.str_replace(' ', '_',$eko).'.png';
  134.     if (file_exists($filename)) {
  135.     echo '<img style="float: left; margin: 2px; margin-top: 16px;" src="/media/piegade/'.str_replace(' ', '_',$eko).'.png" alt="'.$eko.'" title="'.$eko.'"></img>';
  136.                        }
  137.                        ?></div>
  138. <?php if($_product->getBezmaksas()): ?>
  139. <div class="piegade"><a onclick="popWin('http://www.elbox.lv/mps.html', 'deliveryinfo', 'width=650,height=1214,left=0,top=0,location=no,status=yes,scrollbars=yes,resizable=no'); return false;" href="#"><img src="<?php echo $this->getSkinUrl(); ?>images/bezmaksas_ps2.png" title="Bezmaksas piegāde uz 'Pasta Stacija' automātu" alt="Bezmaksas piegāde uz 'Pasta Stacija' automātu" width="104px" height="33px" /></a></div>
  140. <?php endif; ?>
  141. <a href="<?php echo $_product->getProductUrl() ?>"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(175); ?>" width="175" height="175" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
  142. </a>
  143.             <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><?php echo $this->htmlEscape($_product->getName()) ?></a></h2>
  144.                 <?php if($_product->getRatingSummary()): ?>
  145.                 <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
  146.                 <?php endif; ?>
  147.               <!--  <div class="shortDescription">
  148.                     <?php echo nl2br($_product->getShortDescription()); ?>
  149.                </div> -->
  150.                 <div class="atributi">
  151.                 <?php echo $this->getPriceHtml($_product, true) ?>
  152.                 </div>
  153.  
  154.                 <div class="actions">
  155.                     <?php if($_product->isSaleable()): ?>
  156.                         <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span></span></span></button>
  157.                     <?php else: ?>
  158.  
  159.                     <?php endif; ?>
  160.                 </div>
  161.                
  162.                 <div class="veikala2">
  163.                        <?php if($_product->getDaudzumsVeikala()): ?>
  164.                        ✔ Ir veikalā <span class="in-stock">(<?php echo $_product->getDaudzumsVeikala(); ?>)</span>
  165.                        </div>
  166. <?php endif; ?>
  167.             </li>
  168.         <?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
  169.         </ul>
  170.         <?php endif ?>
  171.         <?php endforeach ?>
  172.         <div class="toolbar-bottom">
  173.         <?php echo $this->getToolbarBlock()->setTemplate('catalog/product/list/toolbar2.phtml')->toHtml(); ?>
  174.     </div>
  175.         <script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
  176.     <?php endif; ?>
  177. </div>
  178. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement