Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $_productCollection = Mage::getModel('catalog/product')->getCollection();
- $_productCollection->addAttributeToSelect(array(
- 'small_image',
- 'name',
- 'daudzums_veikala',
- 'price'
- ))
- ->addFieldToFilter('visibility', array(
- Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH,
- Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG
- )) //showing just products visible in catalog or both search and catalog
- ->addAttributeToFilter('daudzums_veikala', array('moreq' => 1))
- // ->addAttributeToSort('price', 'asc') //in case we would like to sort products by price ASC / DESC
- ->getSelect()
- // ->where('daudzums_veikala > 1')
- // ->limit(15) //we can specify how many products we want to show on this page
- // ->order(new Zend_Db_Expr('RAND()')) //in case we would like to sort products randomly
- ;
- Mage::getModel('review/review')->appendSummary($_productCollection);
- $_helper = $this->helper('catalog/output');
- ?>
- <?php
- /**
- * Product list template
- *
- * @see Mage_Catalog_Block_Product_List
- */
- ?>
- <?php if(!$_productCollection->count()): ?>
- <p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
- <?php else: ?>
- <div class="category-products">
- <div class="toolbar-bottom">
- <?php echo $this->getToolbarBlock()->setTemplate('catalog/product/list/toolbar.phtml')->toHtml(); ?>
- </div>
- <?php // List mode ?>
- <?php if($this->getMode()!='grid'): ?>
- <?php $_iterator = 0; ?>
- <ol class="products-list" id="products-list">
- <?php foreach ($_productCollection as $_product): ?>
- <li class="item<?php if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>">
- <?php $product = Mage::getModel('catalog/product')->load($_product->getId()); $specialprice = $product->getSpecialPrice();
- if ($specialprice && ( strtotime($product->getSpecialToDate()) > time() || !$product->getSpecialToDate())){?>
- <?php
- $_finalPrice = $this->helper('tax')->getPrice($_product, $_product->getFinalPrice());
- $_regularPrice = $this->helper('tax')->getPrice($_product, $_product->getPrice());
- if ($_regularPrice != $_finalPrice):
- $getpercentage = number_format($_finalPrice / $_regularPrice * 100, 2);
- $finalpercentage = 100 - $getpercentage;
- echo '<div class="atlaide"><div class="procenti"> -'.number_format($finalpercentage, 0).'% </div></div>' ;
- endif; ?><?php } ?>
- <div class="eiro_piegade"><?php
- $eko=$_product->getResource()->getAttribute('shipping_rate')->getFrontend()->getValue($_product);
- $filename= '/var/www/media/piegade/'.str_replace(' ', '_',$eko).'.png';
- if (file_exists($filename)) {
- echo '<img style="float: left; margin: 2px; margin-top: 6px;" src="/media/piegade/'.str_replace(' ', '_',$eko).'.png" alt="'.$eko.'" title="'.$eko.'"></img>';
- }
- ?></div>
- <?php if($_product->getBezmaksas()): ?>
- <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>
- <?php endif; ?>
- <?php // Product Image ?>
- <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>
- <?php // Product description ?>
- <div class="product-shop">
- <div class="f-fix">
- <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>
- <?php if($_product->getRatingSummary()): ?>
- <?php echo $this->getReviewsSummaryHtml($_product) ?>
- <?php endif; ?>
- <?php echo $this->getPriceHtml($_product, true) ?>
- <?php if($_product->isSaleable()): ?>
- <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>
- <?php else: ?>
- <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
- <?php endif; ?>
- <div class="desc std">
- <?php echo nl2br($this->htmlEscape($_product->getShortDescription())) ?>
- <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>" class="link-more"><?php echo $this->__('Learn More') ?></a>
- </div>
- <ul class="add-to-links">
- <?php if ($this->helper('wishlist')->isAllow()) : ?>
- <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-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"><?php echo $this->__('Add to Compare') ?></a></li>
- <?php endif; ?>
- </ul>
- <div class="veikala2">
- <?php if($_product->getDaudzumsVeikala()): ?>
- ✔ Ir veikalā <span class="in-stock">(<?php echo $_product->getDaudzumsVeikala(); ?>)</span>
- </div>
- <?php endif; ?>
- </div>
- </div>
- </li>
- <?php endforeach; ?>
- </ol>
- <script type="text/javascript">decorateList('products-list', 'none-recursive')</script>
- <?php else: ?>
- <?php // Grid Mode ?>
- <?php $_collectionSize = $_productCollection->count() ?>
- <?php $_columnCount = $this->getColumnCount();
- ?>
- <?php $i=0; foreach ($_productCollection as $_product): ?>
- <?php if ($i++%$_columnCount==0): ?>
- <ul class="products-grid">
- <?php endif ?>
- <li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
- <?php $product = Mage::getModel('catalog/product')->load($_product->getId()); $specialprice = $product->getSpecialPrice();
- if ($specialprice && ( strtotime($product->getSpecialToDate()) > time() || !$product->getSpecialToDate())){?>
- <?php
- $_finalPrice = $this->helper('tax')->getPrice($_product, $_product->getFinalPrice());
- $_regularPrice = $this->helper('tax')->getPrice($_product, $_product->getPrice());
- if ($_regularPrice != $_finalPrice):
- $getpercentage = number_format($_finalPrice / $_regularPrice * 100, 2);
- $finalpercentage = 100 - $getpercentage;
- echo '<div class="atlaide"><div class="procenti"> -'.number_format($finalpercentage, 0).'% </div></div>' ;
- endif; ?><?php } ?>
- <div class="eiro_piegade2"><?php
- $eko=$_product->getResource()->getAttribute('shipping_rate')->getFrontend()->getValue($_product);
- $filename= '/var/www/media/piegade/'.str_replace(' ', '_',$eko).'.png';
- if (file_exists($filename)) {
- echo '<img style="float: left; margin: 2px; margin-top: 16px;" src="/media/piegade/'.str_replace(' ', '_',$eko).'.png" alt="'.$eko.'" title="'.$eko.'"></img>';
- }
- ?></div>
- <?php if($_product->getBezmaksas()): ?>
- <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>
- <?php endif; ?>
- <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) ?>" />
- </a>
- <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>
- <?php if($_product->getRatingSummary()): ?>
- <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
- <?php endif; ?>
- <!-- <div class="shortDescription">
- <?php echo nl2br($_product->getShortDescription()); ?>
- </div> -->
- <div class="atributi">
- <?php echo $this->getPriceHtml($_product, true) ?>
- </div>
- <div class="actions">
- <?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></span></span></button>
- <?php else: ?>
- <?php endif; ?>
- </div>
- <div class="veikala2">
- <?php if($_product->getDaudzumsVeikala()): ?>
- ✔ Ir veikalā <span class="in-stock">(<?php echo $_product->getDaudzumsVeikala(); ?>)</span>
- </div>
- <?php endif; ?>
- </li>
- <?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
- </ul>
- <?php endif ?>
- <?php endforeach ?>
- <div class="toolbar-bottom">
- <?php echo $this->getToolbarBlock()->setTemplate('catalog/product/list/toolbar2.phtml')->toHtml(); ?>
- </div>
- <script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
- <?php endif; ?>
- </div>
- <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement